rem
rem

Reputation: 82

Didn't find class "android.support.v4.app.CoreComponentFactory"

what I tried:

I tried cleaning the project and rebuild many times, and I also tried (Invalidate Cashes and restart from the File menu), I also tried adding android.enableR8=false on gradle.properties but it didn't work. i Also tried adding -keep class androidx.core.app.CoreComponentFactory { *; } on the proguard-rules.pro file. this error has been driving me crazy please help

sorry for having the error written in a weird way I had to put 4 spaces on each line because of stack overflow.

Full error:

    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)

My manifest file:

    <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>

my build.gradle file:

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'

  }

my proguard-rules.pro file:

 -keep class androidx.core.app.CoreComponentFactory { *; }

my gradle.properties:

 android.useAndroidX=true
 android.enableJetifier=true
 android.enableR8=false   

Upvotes: 1

Views: 4701

Answers (1)

rem
rem

Reputation: 82

I fixed the problem by removing these two lines from the manifest file

 tools:replace="android:appComponentFactory"
 android:appComponentFactory="android.support.v4.app.CoreComponentFactory"

Upvotes: 2

Related Questions