我该如何解决清单合并错误

时间:2019-05-05 14:43:22

标签: java android

MANIFEST.XML:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        package="com.example.dictionary">

        <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=".WordMeaningActtivity"></activity>
            <activity android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>

    </manifest>

我的错误:

  

清单合并失败:来自> [com.android.support:support-compat:28.0.0]> AndroidManifest.xml:22:18的属性application @ appComponentFactory> value =(android.support.v4.app.CoreComponentFactory) -91也存在于> [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86> value =(androidx.core.app.CoreComponentFactory)。建议:在AndroidManifest.xml:6:5-23:19的元素>上添加>'tools:replace =“ android:appComponentFactory”'以覆盖。

build.gradle(module:app)代码:

apply plugin: 'com.android.application' 
android { 
   compileSdkVersion 28 
   defaultConfig { 
      applicationId "com.example.dictionary"
      minSdkVersion 17 
      targetSdkVersion 28
      versionCode 1 
      versionName "1.0"
      multiDexEnabled true 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.android.support:support-v4:28.0.0' 
   implementation 'com.android.support:design:28.0.0'
   implementation 'com.android.support:recyclerview-v7:28.0.0'
   implementation 'com.android.support:cardview-v7:28.0.0'
   implementation 'com.google.android.gms:play-services-ads:11.0.2'
   implementation 'com.google.android.gms:play-services-gcm:11.0.2'
   implementation 'com.onesignal:OneSignal:3.+@aar'
   implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1' 
}

1 个答案:

答案 0 :(得分:0)

您可以尝试在gradle.properties文件中添加这些行

android.useAndroidX=true
android.enableJetifier=true