项目运行在安卓7.0没问题,可是运行在安卓4.4就直接奔溃了,提示应用停止运行。
Unable to get provider cn.jpush.android.service.DataProvider:
java.lang.ClassNotFoundException:Didn't find class "cn.jpush.android.service.DataProvider" on path:
DexPathList[[zip file "/data/app/com.zhwy.apk"],nativeLibraryDirectories=[/data/app-lib/com.zhwy, /vendor/lib, /system/lib]
解决方案
- build.gradle设置multiDexEnabled=true
- 在dependencies内加入compile ‘com.android.support:multidex:1.0.3’
- 在Application类重写attachBaseContext方法,设置MultiDex.install(this);
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
参考
https://blog.csdn.net/gdcsy168/article/details/78880997