Android合并了清单错误

时间:2017-10-09 04:23:46

标签: android

我收到以下错误。

  

合并错误:错误:属性活动#   com.facebook.FacebookActivity @ theme value =(@ android:style /   AndroidManifest.xml中的T​​heme.Translucent.NoTitleBar:50:13 -   72也出现在AndroidManifest.xml:32:13 - 63 value =(@ style   / com_facebook_activity_theme)。建议:添加   'tools:replace =“android:theme”'到AndroidManifest.xml中的元素:45:   9 - 52:16覆盖.app主要清单(此文件),第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'

3 个答案:

答案 0 :(得分:2)

尝试使用Facebook SDK中的主题 style / 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" />

或者只删除主题行。像:

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

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

但总的来说工具:replace =“android:theme”应该可行。至少在我的项目中,它解决了facebook主题的问题。

答案 1 :(得分: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">

答案 2 :(得分:0)

删除// md-tooltip-component { // div { // background: red; // } // } .success-class { md-tooltip-component { div { background: green; } } }  并删除tools:replace="android:theme
 来自android:theme="@android:style/Theme.Translucent.NoTitleBar"(来自facebookActivity标记)  在AndroidManifest.xml文件中,因为最新的Facebook SDK已包含它。