Error: 1 : Manifest Merger failed with multiple errors in Android Studio - Migrate Android to AndroidX



Errors are : (Maybe both In Android or AndroidX) 

1. Android X: tools:replace specified at line: for attribute, but no new value specified


2. Android Studio 3.0 Gradle sync failed: java.lang.AssertionError (in UnresolvedDependenciesReporter)


3. Configuration on demand is not supported by the current version of the Android Gradle plugin


4. Manifest Merger failed with multiple errors in Android Studio

5. Error After Migrating to AndroidX .

6. Migrate Andorid  to AndroidX.

First go to Refactor  menu then click on Migrate to AndroidX. See below picture :





Solving : 

1.Add these codes to your app/build.gradle (in Module:app) :

configurations.all {
   resolutionStrategy.force 'com.android.support:support-v4:26.1.0' // the lib is old dependencies version;       
}


2.Modified sdk and tools version to 28:
compileSdkVersion 28
buildToolsVersion '28.0.3'
targetSdkVersion  28

2.In your AndroidManifest.xml file, you should add three lines:



<application
    android:name=".YourApplication"
    android:appComponentFactory="anystrings be placeholder" // this one 
    tools:replace="android:appComponentFactory"  // and this one 
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:largeHeap="true" // also this one 
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">


Your Gradle (Module:App)  file look like  this in Android Part :


 compileSdkVersion 28
    buildToolsVersion '28.0.3'
    aaptOptions.cruncherEnabled = false
    aaptOptions.useNewCruncher = false
    defaultConfig {
        applicationId "com.alquran.tafhimul_quran"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 13
        versionName "1.0"
        multiDexEnabled true
    }
    configurations.all {
        resolutionStrategy.force 'com.android.support:support-v4:26.1.0' // the lib is old dependencies version;
    }


No comments:

Post a Comment