我的应用程序无法启动,我的logcat在下面,我无法理解此错误,我是初学者, 我犯了什么错误,所以我遇到了这个错误,在这里我发现了类似的问题,但是答案太混乱了,我无法得到E/LoadedApk: Unable to instantiate appComponentFactory only on Android Q (API 29)
也得到了
在此版本中使用了不推荐使用的Gradle功能,使其与Gradle 7.0不兼容。 使用“ --warning-mode all”来显示各个弃用警告。
E/LoadedApk: Unable to instantiate appComponentFactory
java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.CoreComponentFactory" on path:
DexPathList[[],nativeLibraryDirectories=[/data/app/com.whatsapp-fssQPC-1LXhux2cD4hnAgQ==/lib/arm64,
/data/app/com.whatsapp-fssQPC-1LXhux2cD4hnAgQ==/base.apk!/lib/arm64-v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:171)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.LoadedApk.createAppFactory(LoadedApk.java:228)
at android.app.LoadedApk.updateApplicationInfo(LoadedApk.java:340)
at android.app.ActivityThread.handleDispatchPackageBroadcast(ActivityThread.java:5451)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1756)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at com.android.server.SystemServer.run(SystemServer.java:475)
at com.android.server.SystemServer.main(SystemServer.java:310)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:853)
我的gradle.build是
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.somusmall"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.agrawalsuneet.androidlibs:dotsloader:1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
我的清单文件是
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"></activity>
<activity android:name=".video_layout" />
<activity android:name=".RegisterActivity" />
<activity android:name=".Splash_Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>
答案 0 :(得分:0)
尝试将上述类添加到proguard-rules中。
-keep class androidx.core.app.CoreComponentFactory { *; }
https://dzone.com/articles/enabling-proguard-for-android
为我工作。 :)