Android~Unable to get provider androidx.lifecycle.ProcessLifecycleOwnerInitializer
16lz
2021-01-26
在新项目中已开始迁移到Androidx遇到Unable to get provider androidx.lifecycle.ProcessLifecycleOwnerInitializer错误,APP在安卓4.4上面启动奔溃,记录解决办法。参考原文
在安卓4.4中,这是一个dex问题。解决办法是
1、在app.gradle中,defaultconfig内启用multidex
defaultConfig{
…
multiDexEnabled true
}
2、在gradle中添加 multidex依赖
implementation ‘com.android.support:multidex:1.0.3’
3、如你创建了Application类,不能继承自Application 需要继承MultiDexApplication。相反,在清单文件中添加标记
<application android:name="android.support.multidex.MultiDexApplication" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:theme="@style/AppTheme.Launcher" android:supportsRtl="true">
更多相关文章
- Android(安卓)Studio 点击按钮跳转新界面
- Android(安卓)添加动画的标签栏
- android 4.4 沉浸式状态栏实现
- 【Java】从内部类中访问变量,需要声明为final
- Android(安卓)Studio 3.0+添加ButterKnife依赖报错的解决办法
- android 关于使用retrofit2.0的一些问题
- Android(安卓)Studio配置AspectJ(使用jar包的方法)
- GridView添加网格线
- Android上使用camera拍照,把获取的照片上传到远程服务器