我在Android studio Gradle icon error, Manifest Merger发现了类似的问题。
但是这个建议对我都不起作用。我正在使用Android Studio 3.2。在我的应用程序中,我正在使用app-> build.gradle:-
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '28.0.2'
defaultConfig {
applicationId "com.home.ma.photolocationnote"
minSdkVersion 16
targetSdkVersion 27
versionCode 6
versionName "6.0"
multiDexEnabled = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:25.0.0'
implementation 'com.android.support:design:25.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.microsoft.azure.android:azure-storage-android:2.0.0@aar'
implementation 'javax.xml.stream:stax-api:1.0-2'
implementation 'org.apache.commons:commons-lang3:3.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
// after adding this lib
implementation 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar'
// after adding this lib
implementation 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'
testImplementation 'junit:junit:4.12'
}
项目-> build.gradle:-
buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我遇到了错误,因为清单合并失败并出现多个错误,请参阅日志
我添加了建议 xmlns:tools =“ http://schemas.android.com/tools”和tools:replace =“ android:icon,android:theme,android:label,android:name”
这是我的AndroidManifest.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.home.ma.photolocationnote">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<permission
android:name="com.home.ma.photolocationnote.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.home.ma.photolocationnote.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permisson.READ_GSERVICES" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
tools:replace="android:icon,android:theme,android:label,android:name"
android:allowBackup="true"
android:icon="@mipmap/app_icon" // I tried "@drawable/app_icon" also.
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="xxxxxxxxx" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"></activity>
<meta-data
android:name="com.google.android.gms.vision"
android:value="@integer/google_play_services_version" />
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".CameraActivity" />
<activity
android:name=".NoteEditorActivity"
android:label="@string/title_activity_note_editor"
android:theme="@style/AppTheme.NoActionBar" />
<provider
android:name=".contentProvider.NoteContentProvider"
android:authorities="authorities.photolocationnote.contentprovider"
android:exported="true" />
<activity
android:name=".NoteListActivity"
android:label="@string/title_activity_note_list"
android:theme="@style/AppTheme.NoActionBar" />
</application>
</manifest>
错误消息:-
清单合并失败:来自AndroidManifest.xml:31:9-42的属性application @ icon value =(@ drawable / app_icon) 也出现在[com.microsoft.azure:azure-notifications-handler:1.0.1] AndroidManifest.xml:13:9-45 value =(@ drawable / ic_launcher)中。 建议:在AndroidManifest.xml:29:5-76:19的元素上添加'tools:replace =“ android:icon”'以进行覆盖。
答案 0 :(得分:2)
解决方案:
从此更改您的应用程序标签:
<application
tools:replace="android:icon,android:theme,android:label,android:name"
android:allowBackup="true"
android:icon="@mipmap/app_icon" // I tried "@drawable/app_icon" also.
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
对此:
<application
android:allowBackup="true"
android:icon="@mipmap/app_icon"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:icon">
尝试一下,希望对您有所帮助。