[英]Android merged manifest error
I am getting the following error. 我收到以下错误。
Merging Errors: Error: Attribute activity# com.facebook.FacebookActivity@ theme value = (@android: style / Theme.Translucent.NoTitleBar) from AndroidManifest.xml: 50: 13 - 72 is also present at AndroidManifest.xml: 32: 13 - 63 value = (@style / com_facebook_activity_theme).Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml: 45: 9 - 52: 16 to override.app main manifest(this file), line 49
合并错误:错误:AndroidManifest.xml中的属性活动#com.facebook.FacebookActivity @ theme value =(@android:style / Theme.Translucent.NoTitleBar):50:13 - 72也存在于AndroidManifest.xml:32:13 - 63 value =(@ style / com_facebook_activity_theme)。建议:在AndroidManifest.xml中将'tools:replace =“android:theme”'添加到元素:45:9 - 52:16以覆盖.app主清单(此文件),第49行
My AndroidManifest file 我的AndroidManifest文件
<?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.example.android.blogtry"
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
tools:replace="icon, label"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="Disaster Management"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"
tools:replace="android:value"/>
<provider android:authorities="com.facebook.app.FacebookContentProvider21"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".PostActivity" />
<activity android:name=".RegisterActivity" />
<activity android:name=".LoginActivity" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat" />
<activity android:name=".BlogSingleActivity" />
<activity android:name=".MyProfileActivity">
</activity>
<activity
tools:replace="android:theme"
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
/>
<activity
android:name=".FbHomeActivity"
android:label="@string/title_activity_home"
android:theme="@style/AppTheme.NoActionBar"
/>
</application>
</manifest>
My build.gradle file: 我的build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.android.blogtry"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.firebase:firebase-appindexing:11.0.2'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.google.android.gms:play-services-auth:11.0.2'
compile 'com.google.firebase:firebase-database:11.0.2'
compile 'com.google.firebase:firebase-storage:11.0.2'
compile 'com.firebaseui:firebase-ui:2.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:design:24.1.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Try to use theme style/com_facebook_activity_theme from Facebook SDK: 尝试使用Facebook SDK中的主题样式/ com_facebook_activity_theme :
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@style/com_facebook_activity_theme" />
Or just remove theme line at all. 或者只是删除主题行。 Like:
喜欢:
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
In this case theme will be pasted in manifest from Facebook SDK. 在这种情况下,主题将粘贴在Facebook SDK的清单中。
But in general tools:replace="android:theme" should work. 但在一般工具中:replace =“android:theme”应该有效。 At least in my projects it solves issues with facebook themes.
至少在我的项目中它解决了facebook主题的问题。
Try this 试试这个
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="Disaster Management"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:theme,icon,label">
Remove tools:replace="android:theme
and also remove android:theme="@android:style/Theme.Translucent.NoTitleBar"
删除
tools:replace="android:theme
也删除android:theme="@android:style/Theme.Translucent.NoTitleBar"
from facebookActivity
(from the <activity>
tag) in your AndroidManifest.xml file since the latest Facebook SDK already includes it. 来自AndroidManifest.xml文件中的
facebookActivity
(来自<activity>
标签),因为最新的Facebook SDK已包含它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.