rive-app / rive-app/rive-react-native
Android unable to load files that contains sound
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 783
- Forks
- 81
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 3
Description
Description
1 - Android unable to load any .riv files that contains sound, shows blank space. When i export same file without sound, it works.
2 - Android unable to load .riv file around 25mb. App crashes 'cause of out of memory with below error. Android only works with adding this option to manifest; android:largeHeap="true". Is this option has any drawbacks?
Error i get;
Abort message: 'JNI DETECTED ERROR IN APPLICATION: JNI GetArrayLength called with pending exception java.lang.OutOfMemoryError: Failed to allocate a 41333784 byte allocation with 9940736 free bytes and 9707KB until OOM, target footprint 201326592, growth limit 201326592
06-05 23:44:27.250 12778 12778 F DEBUG : at int[] app.rive.runtime.kotlin.core.Decoder.decodeToPixels(byte[]) (Decoder.java:22)
Provide a Repro
import React from 'react';
import {
Dimensions, StyleSheet, Text, View,
} from 'react-native';
import Rive, { RiveRenderer, RiveRendererAndroid, RiveRendererIOS } from 'rive-react-native';
import Button from '../components/Button';
const App = () => {
const riveRef = React.useRef();
return (
<View style={{
flex: 1,
alignItems: 'center',
paddingVertical: 50,
gap: 10,
}}
>
<Rive
ref={riveRef}
resourceName="rockstar3"
onError={(err) => {
console.log('err', err);
}}
onPlay={() => {
console.log('here');
}}
style={{ width: Dimensions.get('window').width }}
stateMachineName="Rockstar Avatar Creator"
autoplay={false}
/>
<Button
text="Green Skin"
onPress={() => {
riveRef.current?.setInputState('Rockstar Avatar Creator', 'Skin Tone', 3);
}}
/>
<Button
text="Yellow Skin"
onPress={() => {
riveRef.current?.setInputState('Rockstar Avatar Creator', 'Skin Tone', 1);
}}
/>
</View>
);
};
export default App;
const styles = StyleSheet.create({});
Source .riv/.rev file
https://rive.app/community/files/9909-18904-rockstar-avatar-creator/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied React Native reproduction and the Android stack trace at Decoder.decodeToPixels (Decoder.java:22). Compare loading the linked .riv file with and without sound, and test the roughly 25 MB file under the reported memory limit. Done means sound-containing files load and large files no longer trigger the reported Android out-of-memory crash without relying on largeHeap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, react-native, typescript
- Domain
- audio-video-rtc, mobile, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100