我知道以前曾问过这种类型的问题,但这些问题并未解决我的问题。 今天,我在我的应用程序中添加了新版本的PayU Money,突然显示出错误。我已将整个项目转换为 androidx ,出现了同样的错误。
清单合并失败:来自[androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86的属性application @ appComponentFactory value =(androidx.core.app.CoreComponentFactory) 也出现在[com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value =(android.support.v4.app.CoreComponentFactory)。 建议:在AndroidManifest.xml:31:5-163:19的元素上添加'tools:replace =“ android:appComponentFactory”'以进行覆盖。
如果我在清单文件中添加了此 tools:replace =“ android:appComponentFactory ,则会显示新错误
清单合并失败,并出现多个错误,请参阅日志
在检查清单合并时,它会显示
合并错误:错误:在属性:android:appComponentFactory的行:31处指定了tools:replace,但未指定新的值app main清单(此文件),第30行错误:验证失败,退出了app main清单(此文件)
我无法弄清错误。这是build.gradle(app)
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.packagename"
minSdkVersion 16
targetSdkVersion 28
versionCode 54
versionName "5.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-database:19.1.0'
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:multidex:1.0.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.google.android.gms:play-services-identity:17.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-perf:19.0.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true;
}
implementation 'com.google.code.gson:gson:2.8.2'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation 'com.github.bumptech.glide:glide:4.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'
implementation 'com.facebook.android:facebook-android-sdk:4.22.0'
implementation 'com.wefika:flowlayout:0.4.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation project(':sdkui')
implementation 'com.android.support:design:28.0.0'
implementation 'com.zopim.android:sdk:1.4.2'
/* Snappydb (cache/db) */
/*For shimmer effect*/
implementation 'com.facebook.shimmer:shimmer:0.4.0'
implementation 'com.snappydb:snappydb-lib:0.5.2'
}
apply plugin: 'com.google.gms.google-services'
请帮助我解决这个问题
答案 0 :(得分:1)
在清单的<application />
标记内添加这2行
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"
这对我有帮助。希望这也可以为您提供帮助。
您应该尝试一次。您还需要添加此行。
android:appComponentFactory="whateverString"
对于GoogleAPIClient初始化,您应该在AppCompactActivity中使用它:
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
删除enableAutoManage()
enableAutoManage()
需要一个FragmentActivity
或其中的某个子类,例如AppCompatActivity
。您不能将enableAutoManage()
与常规活动一起使用。要么:
将您的代码切换为使用FragmentActivity
或AppCompatActivity
或
请勿致电enableAutoManage()