清单合并失败了吗?建议:将'tools:replace =“ android:appComponentFactory”添加到AndroidManifest.xml中的<application>元素:8:5-34:19以覆盖

时间:2019-06-23 06:52:46

标签: java android

我正在尝试设置解析器服务器,我提供了我在新项目中添加的内容,添加了一些代码后出现此错误:

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

2 个答案:

答案 0 :(得分:0)

只需执行确切的错误行所述! 这意味着添加此行:

tools:replace="android:appComponentFactory"

到清单应用程序标签

答案 1 :(得分:0)

您的错误不言自明。您需要将给定标签添加到<application>元素中。

因此,更改后的应用程序标签将变为:

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

看到错误中提到的如何将tools:replace="android:appComponentFactory"添加到application中的AndroidManifest.xml元素中?

相关问题