相关疑难解决方法(0)

Android Material和appcompat Manifest合并失败

我有下一个年级

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    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.android.material:material:1.0.0-rc01'
}
Run Code Online (Sandbox Code Playgroud)

但是当我想构建应用程序时,我会得到下一个日志:

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0-alpha3] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0-alpha3] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.
Run Code Online (Sandbox Code Playgroud)

好! 去清单并执行:

<?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="ru.chopcode.myapplication">

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

</manifest>
Run Code Online (Sandbox Code Playgroud)

然后我在Logcat中收到此错误:

Manifest merger failed with multiple errors, see logs that I have …
Run Code Online (Sandbox Code Playgroud)

android build.gradle android-gradle-plugin gradle-plugin

193
推荐指数
19
解决办法
29万
查看次数

工具:在Android清单中替换不替换

我正在使用具有许多不同库依赖项的gradle项目并使用新的清单合并.在我的<application />标签中,我将其设置为:

<application tools:replace="android:icon, android:label, android:theme, android:name"
    android:name="com.example.myapp.MyApplcation"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/application_name"
    android:logo="@drawable/logo_ab"
    android:theme="@style/AppTheme"
    >
....
</application>
Run Code Online (Sandbox Code Playgroud)

然而,我收到错误:

/android/MyApp/app/src/main/AndroidManifest.xml:29:9        Error:
Attribute application@icon value=(@drawable/ic_launcher) from AndroidManifest.xml:29:9
is also present at {Library Name} value=(@drawable/app_icon)
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:26:5 to override

/android/MyApp/app/src/main/AndroidManifest.xml:30:9 Error:
Attribute application@label value=(@string/application_name) from AndroidManifest.xml:30:9
is also present at {Library Name} value=(@string/app_name)
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:26:5 to override

/android/MyApp/app/src/main/AndroidManifest.xml:27:9 Error:
Attribute application@name value=(com.example.myapp.MyApplication) from AndroidManifest.xml:27:9
is also present at {Another Library} …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin

135
推荐指数
9
解决办法
16万
查看次数

API 28(P)的Android设计支持库无法正常工作

我已经成功配置了android-P SDK环境.当我尝试使用android设计支持库时,我面临项目构建错误.项目配置是:

IDE:3.2 Canary 17目标API:28编译API:28

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.app.navigationpoc"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.1'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'

    implementation 'com.android.support:design:28.0.0-alpha3'
    implementation 'com.android.support:cardview-v7:28.0.0-alpha3'
}
Run Code Online (Sandbox Code Playgroud)

并且构建失败的错误是:

清单合并失败:来自[androidx.core:core:1.0.0-alpha3] AndroidManifest.xml:22:18-86的属性应用程序@ appComponentFactory值=(androidx.core.app.CoreComponentFactory)也出现在[com.android] .support:support-compat:28.0.0-alpha3] AndroidManifest.xml:22:18-91 value =(android.support.v4.app.CoreComponentFactory).建议:在AndroidManifest.xml:6:5-40:19中添加'tools:replace ="android:appComponentFactory"'来覆盖.

android android-studio android-design-library android-9.0-pie

90
推荐指数
10
解决办法
15万
查看次数

Android X:工具:替换为line:for属性,但没有指定新值

我在这个网站上尝试了很多解决方案,但问题仍未解决.问题是由于Android X库.当我添加Android X时,此问题已得到解决,但它开启了新问题.我不想添加Android X.如何解决这个问题?

早些时候这个错误即将来临:

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.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:19:5-142:19 to override.
Run Code Online (Sandbox Code Playgroud)

我添加后tools:replace="android:appComponentFactory",出现此错误:

 java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:540)    
at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:173)
Run Code Online (Sandbox Code Playgroud)

合并错误(在Android Manifest中):

错误:工具:替换为line:2指定属性android:appComponentFactory,但没有指定新值的应用程序主清单(此文件),第1行

表现:

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

    ...

    <application
        android:name="com.example"
        android:icon="@mipmap/icon"
        android:debuggable="true"
        android:hardwareAccelerated="false"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:allowBackup="false"
        tools:ignore="GoogleAppIndexingWarning,HardcodedDebugMode">
       ...
Run Code Online (Sandbox Code Playgroud)

模块级build.gradle中的依赖项块:

Manifest merger failed : Attribute …
Run Code Online (Sandbox Code Playgroud)

java android android-manifest android-gradle-plugin androidx

53
推荐指数
6
解决办法
5万
查看次数

在'android'包中找不到属性'appComponentFactory'的资源标识符

我使用谷歌材料设计作为这个https://material.io/develop/android/docs/getting-started/但是当同步项目我有以下错误

在'android'包中找不到属性'appComponentFactory'的资源标识符消息{kind = ERROR,text =在'android'包中找不到属性'appComponentFactory'的资源标识符,sources = [\?\ E:\ Projects\xoxo- android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:17],原始消息=,工具名称= Optional.of(AAPT)}

这是我的build.gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"

    defaultConfig {
        applicationId "com.example.official2.xoxo"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.1'
    compile 'org.apache.httpcomponents:httpclient:4.5'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.android.support:design:26.0.1'
    compile 'com.google.android.gms:play-services-appindexing:8.1.0'
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile …
Run Code Online (Sandbox Code Playgroud)

android

32
推荐指数
4
解决办法
4万
查看次数

尝试将AndroidX迁移到Android AppCompat

从AndroidX迁移到Appcompat时出现错误。这是日志构建:

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 <application> element at AndroidManifest.xml:18:5-138:19 to override.
Run Code Online (Sandbox Code Playgroud)

android android-manifest androidx

8
推荐指数
1
解决办法
2693
查看次数

清单合并失败:属性application @ appComponentFactory更新Firebase库

我正在尝试在我的项目中添加firebase,但是当我实现'com.google.firebase:firebase-messaging:19.0.0'and时'com.google.firebase:firebase-core:17.0.0'

build.gradle(这是错误)

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
 compileSdkVersion 28
 defaultConfig {
    applicationId "com.example.user.mikripoli"
    minSdkVersion 15
    targetSdkVersion 28
    multiDexEnabled true
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
 "android.support.test.runner.AndroidJUnitRunner"
 }
 buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
 'proguard-rules.pro'
    }
 }

 dexOptions {
    javaMaxHeapSize "2g"
 }
}

dependencies {
 implementation 'com.roughike:bottom-bar:2.0'
 implementation 'com.android.support:support-v4:28.0.0'
 implementation 'com.android.support:exifinterface:28.0.0'
 implementation 'com.android.support:animated-vector-drawable:28.0.0'
 implementation 'com.flaviofaria:kenburnsview:1.0.7'
 implementation fileTree(include: ['*.jar'], dir: 'libs')
 implementation 'com.android.support:appcompat-v7:28.0.0'
 implementation 'com.android.support.constraint:constraint-layout:1.1.3'
 implementation 'com.android.support:design:28.0.0'
 implementation 'com.github.chrisbanes:PhotoView:2.1.4'
 implementation 'com.google.firebase:firebase-messaging:19.0.0'
 implementation 'com.google.firebase:firebase-core:17.0.0' …
Run Code Online (Sandbox Code Playgroud)

java gradle firebase build.gradle androidx

8
推荐指数
1
解决办法
4791
查看次数

收到错误消息:清单合并在创建Google Maps Activity项目后失败

我想了解有关Google Maps API的更多信息,因此决定创建一个Google Maps Activity类型的项目。在创建项目之后,没有更改任何代码,立即收到消息:

错误:清单合并失败:[com.android.support:support-compat:28.0.0]的属性application @ appComponentFactory value =(android.support.v4.app.CoreComponentFactory)也是AndroidManifest.xml:22:18-91出现在[androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value =(androidx.core.app.CoreComponentFactory)。建议:在AndroidManifest.xml:12:5-41:19的元素上添加'tools:replace =“ android:appComponentFactory”'以进行覆盖。

我已经按照https://developers.google.com/maps/documentation/android-sdk/start上的教程进行操作,因此,我已使用最新的可用SDK和生成的API密钥(已插入google_maps_api中)更新了环境。 xml)。

我从您的网站找到的可能解决方案是在应用程序模块build.gradle的末尾添加以下代码段

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但是之后,我出现了错误:

不可转换的类型;无法将“ android.support.v4.app.Fragment”转换为“ com.google.android.gms.maps.SupportMapFragment”

对于以下行:

SupportMapFragment mapFragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);
Run Code Online (Sandbox Code Playgroud)

这是我的activity_maps.xml和MapsActivity.java的样子:

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MapsActivity" />
Run Code Online (Sandbox Code Playgroud)
package com.example.myapplication;

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback; …
Run Code Online (Sandbox Code Playgroud)

android

2
推荐指数
2
解决办法
2016
查看次数