Android-“清单合并失败"实施Stripe库后出现错误 [英] Android - "Manifest Merger Failed" Error after implementing Stripe library
问题描述
我在我的应用gradle中实现了'com.stripe:stripe-android:8.5.0'
,然后在尝试构建项目时遇到以下错误:
i implemented 'com.stripe:stripe-android:8.5.0'
into my app gradle, and then i got the following error trying to build my project:
清单合并失败:来自[com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91的属性application @ appComponentFactory value =(android.support.v4.app.CoreComponentFactory) 也出现在[androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value =(androidx.core.app.CoreComponentFactory). 建议:在AndroidManifest.xml:14:5-68:19的元素上添加'tools:replace ="android:appComponentFactory"'以进行覆盖.
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-91 is 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 element at AndroidManifest.xml:14:5-68:19 to override.
我的应用gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.khoi.myApp"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.android.support:design: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.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.ncapdevi:frag-nav:3.0.0'
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation "android.arch.lifecycle:viewmodel:1.1.1"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.20"
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
implementation 'com.stripe:stripe-android:8.5.0'
}
apply plugin: 'com.google.gms.google-services'
清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.khoi.myApp">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<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=".activities.RentActivity"
android:label="Rent">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
</activity>
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".activities.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.MainActivity"
android:theme="@style/AppTheme"></activity>
<activity
android:name=".activities.LoginActivity"
android:theme="@style/HiddenTitleTheme"></activity>
<activity
android:name=".activities.RegisterActivity"
android:theme="@style/HiddenTitleTheme">
<intent-filter>
<!-- <action android:name="android.intent.action.MAIN"/> -->
<action android:name="android.intent.action.VIEW" />
<!-- <category android:name="android.intent.category.LAUNCHER"/> -->
</intent-filter>
</activity>
</application>
</manifest>
推荐答案
stripe-android
使用的是AndroidX并且包含了CoreComponentFactory
类.实际上,您的项目已经具有此类,因此请尝试从gradle中排除已存在的模块,或者按照IDE的建议覆盖Manifest文件中的值,或者将项目从Refactor-> Migrate To AndroidX
迁移到AndroidX.
stripe-android
is using AndroidX and included CoreComponentFactory
class. Actually, your project already has this class, so try excluding the module from gradle which already exists or override the values in Manifest file as suggested by IDE or migrate your project to AndroidX from Refactor-> Migrate To AndroidX
.
另一种解决方案是使用内部不使用AndroidX的条纹Android库的较早版本.
Another solution is to use the older version of the stripe android library that doesn't use AndroidX inside.
这篇关于Android-“清单合并失败"实施Stripe库后出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!