RN项目在5.0及以后项目都运行正常,5.0之前版本有问题。
com.facebook.react.CoreModulesPackage$1
com.facebook.react.CoreModulesPackage.getNativeModules(CoreModulesPackage.java:97)
问题原因,是因为用了MultiDex分包
解决办法:
import android.content.Context;
import android.support.multidex.MultiDex;
public class MyApplication extends SomeOtherApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(context);
Multidex.install(this);
}
}
其他参考
https://blog.youkuaiyun.com/changsimeng/article/details/70946156
MultiDex精补篇,进一步知道MultiDex的配置
官方说明:
https://developer.android.com/studio/build/multidex
优化参考: