【问题标题】:Manifest and Build Errors清单和构建错误
【发布时间】:2019-06-30 14:56:49
【问题描述】:

突然出现所有这些错误所有构建错误 “清单合并失败,Android Studio 中出现多个错误”

那是当我没有得到这个时,我做 android studio 的替换建议

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

这就是清单

 <application

            android:allowBackup="true"
            android:icon="@drawable/messengered"
            android:label="@string/app_name"
            android:roundIcon="@drawable/messengered"
            android:supportsRtl="true"
            android:theme="@style/AppTheme"
            tools:ignore="GoogleAppIndexingWarning"
            >

        <activity android:name=".NewMessegesActivity">
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                       android:value=".LatestMessagesActivity"/>
        </activity>

        <activity android:name=".LatestMessagesActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

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

        <activity android:name=".LoginActivity">
        </activity>

        <activity android:name=".RegisterActivity">
        </activity>

    </application>

这是应用程序 gradle

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.xwray:groupie:2.3.0'

    implementation 'com.android.support:recyclerview-v7:28.+'
    implementation 'com.squareup.picasso:picasso:2.71828'
    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'

}

在我尝试了标记的解决方案后,我得到了一个编译错误,并通过将依赖项从“android.support”更改为“androidx.support”来修复它

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.firebase:firebase-storage:18.0.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.xwray:groupie:2.3.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    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'
} 

然后将布局重新分配给“AppCompatActivity()”,因为它出现了错误,将在 Manifest 中修复它

【问题讨论】:

标签: android android-studio android-activity kotlin android-manifest


【解决方案1】:

问题在于您的构建使用旧的com.android.support 命名空间以及新的androidx 命名空间。

为了解决这个问题,谷歌创建了他们的“jetifier”工具,请参阅StackOverflow/What is Jetifier了解更多信息以及如何使用它。

【讨论】:

  • 我试过这个解决方案,它给我一个编译错误注意:“我卸载了 Android Studio 并重新安装了它”
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-27
  • 1970-01-01
相关资源
最近更新 更多