简体   繁体   中英

Manifest merger failed?Suggestion:add'tools:replace=“android:appComponentFactory”'to<application>element at AndroidManifest.xml:8:5-34:19 to overide

I am trying to set up parser server,i have provided what i have added in new project,after adding some code i get this error:

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory)from[com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91is also present at[androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).Suggestion:add'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:8:5-34:19 to override.

AndroidManifest.xml :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.twitterclone">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<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">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <meta-data
        android:name="com.parse.SERVER_URL"
        android:value="@string/back4app_server_url" />
    <meta-data
        android:name="com.parse.APPLICATION_ID"
        android:value="@string/back4app_app_id" />
    <meta-data
        android:name="com.parse.CLIENT_KEY"
        android:value="@string/back4app_client_key" />
</application>
</manifest>

strings.xml :

<resources>
    <string name="app_name">TWITTERCLONE</string>
    <string 
name="back4app_server_url">https://parseapi.back4app.com/</string>


    <string 
name="back4app_app_id">FoNKflS8fScGGDZDBieATC4ITLTNTTZrKLPP8LEx</string>
    <string 

name="back4app_client_key">84Vz6vvuz3SZv0OBQTfLmBFdDaLFkVrJ0dKuADon

app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.twitterclone"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android- 
optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation "com.github.parse-community.Parse-SDK-Android:parse:1.20.0"

}

repositories {
    mavenCentral()
    jcenter()
    maven { url 'https://jitpack.io' }
}

just do what exact error line said! it mean add this line :

tools:replace="android:appComponentFactory"

to your manifest application tag

Your error is self explanatory. You need to add the given tag to your <application> element.

So, your application tag after changes will become like:

<application
    tools:replace="android:appComponentFactory"
    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">
.
.
..
...
</application>

See how I added tools:replace="android:appComponentFactory" to application element in AndroidManifest.xml as mentioned in the error?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM