2017-10-09 62 views
3

我收到以下错误。Android合并清单错误

Merging Errors: Error: Attribute activity# [email protected] 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 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> 

我的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' 
+0

只是你必须清理项目,而不是在构建工具中重建项目。 –

+0

请参阅此https://stackoverflow.com/questions/46556571/manifest-merger-failed-while-adding-io-github-jeancsanchez-jcplayerjcplayer0-0/46556600#46556600 –

+0

@jigarsavaliya我清理并重建项目。仍然得到相同的错误。 – Ros

回答

1

尝试使用主题风格/ com_facebook_activity_theme从Facebook SDK:

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

或者只是删除主题行。如:

<activity 
     android:name="com.facebook.FacebookActivity" 
     android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" 
     android:label="@string/app_name" /> 

在这种情况下,主题将粘贴在来自Facebook SDK的清单中。

但一般工具:替换=“android:主题”应该工作。至少在我的项目中,它解决了facebook主题的问题。

0

试试这个

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

在AndroidManifest.xml文件删除tools:replace="android:theme ,也从facebookActivity删除android:theme="@android:style/Theme.Translucent.NoTitleBar"
(从<activity>标签) 因为最新的Facebook SDK已经包含了它。