Android 5.1 has an arbitrary limit of 100 dex files
Here we will see in runtime / dex_file.cc
bool DexFile::OpenFromZip(...) {
...
while (i < 100) {
std::string name = StringPrintf("classes%zu.dex", i)
...
}
...
}
So, if you have more than 100 dex files, you get this NoClassDefFoundError.
You can avoid this error by disabling pre-deletion.
One possible workaround is to disable preDexLibraries, which reduces the number of classes.dex files included in apk.
Add
android {
dexOptions {
preDexLibraries false
}
}
to the build.gradle application file
java.lang.NoClassDefFoundError Android 5.1 Android Studio 2.2RC
:
, fbjni .
, , ,
import com.facebook.soloader.SoLoader;
@Override public void onCreate() {
...
...
SoLoader.init(getApplicationContext(), false);
}