corymsmith / react-native-fabric

A React Native library for Fabric, Crashlytics and Answers
MIT License
1.31k stars 236 forks source link

multidex problem with android 5.0 and above: ClassNotFoundException #122

Closed npomfret closed 7 years ago

npomfret commented 7 years ago

My deployed app is crashing (it's fine when running locally).

05-17 05:29:51.998: E/AndroidRuntime(12656): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/crashlytics/android/Crashlytics;
05-17 05:29:51.998: E/AndroidRuntime(12656):    at com.appname.MainApplication.onCreate(MainApplication.java:96)

Looks like some devices don't find the crashltyics class in the .dex files. I've not idea why, more info here

Any ideas?

IgorGanapolsky commented 7 years ago

@npomfret Did you check whether your APK is close to the 64K dex limit?

npomfret commented 7 years ago

It was above the limit yes.

But the problem was that a certain combination of the android version I targeted and the grade version broke the dexing process. It created over a hundred DEX files, which is normal apparently because eventually they get merged into a minimal number. However, there seems to be a bug (and I forget which particular versions caused it) where the merging of DEX files doesn't happen. Theres a 100 DEX file limit i think, and my particular build went over that so I had loads of classes missing. The actual number of classes I had was only about 80k.

I think solved it by downgrading my android version to API 16 (possibly from 22 but I forget).

IgorGanapolsky commented 7 years ago

@npomfret Thanks. So you downgraded the targetSDK to 16?

npomfret commented 7 years ago

As i recall yes.

sneerin commented 7 years ago

please google predex, it helped for us.

sibelius commented 7 years ago

this is not a problem with this lib

corymsmith commented 7 years ago

Closing as this is not a problem with this lib as @sibelius has pointed out.