Viro: Crash in Android: Didn't find class "com.facebook.marketing.internal.MarketingInitProvider"

Created on 19 Jul 2018  路  4Comments  路  Source: viromedia/viro

I just follow install the instructions and the app crashs on launch. Here are crash logs:

E/AndroidRuntime( 8460): FATAL EXCEPTION: main
E/AndroidRuntime( 8460): Process: com.app.app, PID: 8460
E/AndroidRuntime( 8460): java.lang.RuntimeException: Unable to get provider com.facebook.marketing.internal.MarketingInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.marketing.internal.MarketingInitProvider" on path: DexPathList[[zip file "/data/app/com.app.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.app.app-1/lib/x86, /vendor/lib, /system/lib]]
E/AndroidRuntime( 8460):    at android.app.ActivityThread.installProvider(ActivityThread.java:5002)
E/AndroidRuntime( 8460):    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
E/AndroidRuntime( 8460):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
E/AndroidRuntime( 8460):    at android.app.ActivityThread.access$1500(ActivityThread.java:151)
E/AndroidRuntime( 8460):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
E/AndroidRuntime( 8460):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 8460):    at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 8460):    at android.app.ActivityThread.main(ActivityThread.java:5254)
E/AndroidRuntime( 8460):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 8460):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 8460):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/AndroidRuntime( 8460):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
E/AndroidRuntime( 8460): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.marketing.internal.MarketingInitProvider" on path: DexPathList[[zip file "/data/app/com.app.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.app.app-1/lib/x86, /vendor/lib, /system/lib]]
E/AndroidRuntime( 8460):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime( 8460):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime( 8460):    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime( 8460):    at android.app.ActivityThread.installProvider(ActivityThread.java:4987)
E/AndroidRuntime( 8460):    ... 11 more
E/AndroidRuntime( 8460):    Suppressed: java.lang.ClassNotFoundException: com.facebook.marketing.internal.MarketingInitProvider
E/AndroidRuntime( 8460):        at java.lang.Class.classForName(Native Method)
E/AndroidRuntime( 8460):        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime( 8460):        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime( 8460):        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime( 8460):        ... 13 more
E/AndroidRuntime( 8460):    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Version:

  • React Native 0.55.4 (I tried 0.52.x too)
  • React Viro 2.8.2
  • Gradle 3.3

My app build.gradle

    compile project(':arcore_client') // remove this if AR not required
    compile project(':gvr_common')
    compile project(path: ':viro_renderer')
    compile project(path: ':react_viro')
    compile 'com.google.android.exoplayer:exoplayer:2.7.1'
    compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
    compile 'com.amazonaws:aws-android-sdk-core:2.2.+'
    compile 'com.amazonaws:aws-android-sdk-ddb:2.2.+'
    compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.2.+'
    compile 'com.amazonaws:aws-android-sdk-cognito:2.2.+'
    compile 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.+'
compileSdkVersion 27
buildToolsVersion '27.0.3'
applicationId "com.app.app"
minSdkVersion 21
targetSdkVersion 27

Most helpful comment

I've finally found out the problem. The react-viro's dependencies create too much dex files in apk file and it's reaches the limit. The solution is add:

android {
   dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries false
    }
}

in the app build.gradle.

All 4 comments

Hi @yabeow,

Are you using some other react-native module w/ a Facebook requirement? The error is complaining about a missing Facebook class (not related to Viro).

Alternatively, if you're adding this to an existing application, you might have to enable multidexing by adding multiDexEnabled true to your app's build.config under android->defaultConfig.

Thanks,

Hi @achuvm ,
I create a issue here because my android app work just fine before install react-viro. And i also have
multiDexEnabled true.
Does react-viro using any Facebook class?

It's seem that react-viro broke out my multiDex config and now my Android app can't found any class :(

I've finally found out the problem. The react-viro's dependencies create too much dex files in apk file and it's reaches the limit. The solution is add:

android {
   dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries false
    }
}

in the app build.gradle.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dittmarconsulting picture dittmarconsulting  路  6Comments

Thomas101 picture Thomas101  路  3Comments

JStein92 picture JStein92  路  5Comments

vuthanhtrung0504 picture vuthanhtrung0504  路  5Comments

funkyfourier picture funkyfourier  路  3Comments