我尝试了什么:
我多次尝试清理项目并重新构建,我也尝试过(使现金无效并从“文件”菜单中重新启动),我也尝试在gradle.properties上添加android.enableR8=false
,但是它没有工作。我还尝试将-keep class androidx.core.app.CoreComponentFactory { *; }
添加到pro卫士规则the文件中。这个错误已经把我逼疯了,请帮帮忙
很抱歉,错误是以奇怪的方式编写的,因为堆栈溢出,我不得不在每行上放置4个空格。
全错误:
2021-04-02 21:14:20.168 29124-
29124/com.AnimeStreaming.anime E/LoadedApk: Unable to
instantiate appComponentFactory
java.lang.ClassNotFoundException: Didn't find class
"android.support.v4.app.CoreComponentFactory" on path:
DexPathList[[zip file "/data/app/com.AnimeStreaming.anime-
QicKhTRny48LAMWkGzyuaQ==/base.apk"],nativeLibraryDire
ctories=
[/data/app/com.AnimeStreaming.anime-
QicKhTRny48LAMWkGzyuaQ==/lib/x86, /system/lib,
/system/product/lib]]
at
dalvik.system.BaseDexClassLoader.findClass
(BaseDexClassLoader.java:196)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at
android.app.LoadedApk.createAppFactory(LoadedApk.java:256)
at
android.app.LoadedApk.updateApplicationInf
o(LoadedApk.java:370)
at android.app.ActivityThread.handleApplication
InfoChanged(ActivityThread.java:5676)
at
android.app.ActivityThread$H.handleM
essage(ActivityThread.java:2005)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at
android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeIni
t$MethodAndArgsCaller.run(RuntimeInit.java:492)
at
com.android.internal.os.
ZygoteInit.main(ZygoteInit.java:930)
我的manifest
文件:
<application
tools:replace="android:appComponentFactory"
android:appComponentFactory="android.support.v4.app.
CoreComponentFactory"
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/Theme.MyApplication">
<activity android:name=".MainActivity">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
我的build.gradle
文件:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.AnimeStreaming.anime"
minSdkVersion 22
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner
'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-
android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation
'androidx.constraintlayout:constraintlayout:1.1.3'
//noinspection GradleCompatible
implementation 'androidx.recyclerview:recyclerview:1.1.0'
testImplementation 'junit:junit:4.+'
//noinspection GradleCompatible
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation
'androidx.test.espresso:espresso-
core:3.1.0'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'androidx.multidex:multidex:2.0.1'
}
我的proguard-rules.pro
文件:
-keep class androidx.core.app.CoreComponentFactory { *; }
my gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=false
发布于 2021-04-07 01:34:50
我通过从清单文件中删除这两行来解决这个问题。
tools:replace="android:appComponentFactory"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
https://stackoverflow.com/questions/66927540
复制相似问题