Lottie-react-native: Insta-Crash on Android

Created on 11 Jan 2019  路  5Comments  路  Source: lottie-react-native/lottie-react-native

Description

I get a crash on Android even though the same code+animation works fine on iOS.

01-11 14:50:45.656  7601  7601 E AndroidRuntime: java.lang.BootstrapMethodError: Exception from call site #9 bootstrap method
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.airbnb.lottie.LottieDrawable.setProgress(LottieDrawable.java:508)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.airbnb.lottie.LottieAnimationView.setProgress(LottieAnimationView.java:849)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.airbnb.lottie.LottieAnimationView.init(LottieAnimationView.java:158)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.airbnb.lottie.LottieAnimationView.<init>(LottieAnimationView.java:101)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.airbnb.android.react.lottie.LottieAnimationViewManager.createViewInstance(LottieAnimationViewManager.java:48)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.airbnb.android.react.lottie.LottieAnimationViewManager.createViewInstance(LottieAnimationViewManager.java:27)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:42)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:260)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:200)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1085)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1056)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:134)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:105)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:909)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at android.view.Choreographer.doCallbacks(Choreographer.java:723)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at android.view.Choreographer.doFrame(Choreographer.java:655)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:790)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:164)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6494)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
01-11 14:50:45.656  7601  7601 E AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Invalid descriptor: VL.
01-11 14:50:45.656  7601  7601 E AndroidRuntime:    ... 25 more

Tested with a bunch of different animations so its probably not related to a particular asset.

Steps to Reproduce

Any screen that displays a crashes as soon as component mounts.

Versions

"react": "16.6.3",
"react-native": "0.57.8"
"lottie-react-native": "^2.5.11",

All 5 comments

I ran into this same problem after upgrading from react-native 0.57.8 to 0.58.3. Among some other Android build related changes that I made, I increased my minSdkVersion setting to 26. Is your minSdkVersion set to 26 or higher?

From my testing, https://github.com/react-native-community/lottie-react-native/commit/500bd40a9e7ae021214fc4436d5613d3e8f320fb fixes this issue if you are. Unfortunately though, it hasn't been released yet: https://github.com/react-native-community/lottie-react-native/compare/v2.5.11...master

While you're waiting on that commit to ship, you can add an explicit lottie 2.6.0 dependency to your app/build.gradle and that should get you up and running again:

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  testImplementation 'junit:junit:4.12'
  implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
  implementation 'com.facebook.react:react-native:+'
 ...
  implementation 'com.airbnb.android:lottie:2.6.0'
  implementation project(':lottie-react-native')

}

Alternatively, you could lower your minSdkVersion setting assuming that's viable for your particular situation.

Add these code to the android section in your ProjectPath/android/app/build.gradle file:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

@amoljain , I face this issue now with "lottie-react-native": "^2.6.1". How did you solve it?. Please share.

same problem, help please

i fixed this by adding:
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}

in build.gradlew

Was this page helpful?
0 / 5 - 0 ratings