合并清单失败

时间:2018-04-03 14:35:29

标签: android react-native android-manifest build.gradle

我正在尝试执行我的android反应原生项目,我收到此错误:

  

:应用程序:processDebugManifest   /Users/me/project/android/app/src/main/AndroidManifest.xml:28:13-35   错误:           来自[com.android.support:appcompat-v7:26.0.2]的属性meta-data#android.support.VERSION@value value =(26.0.2)   AndroidManifest.xml中:28:13-35           也出现在[com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value =(26.1.0)。           建议:在AndroidManifest.xml:26:9-28:38中添加'tools:replace =“android:value”'以覆盖。

     

有关详细信息,请参阅http://g.co/androidstudio/manifest-merger   关于清单合并。

     

:app:processDebugManifest FAILED

     

失败:构建因异常而失败。

     
      
  • 出了什么问题:任务执行失败':app:processDebugManifest'。      
        

    清单合并失败:属性meta-data#android.support.VERSION@value value =(26.0.2)from     [com.android.support:appcompat-v7:26.0.2] AndroidManifest.xml:28:13-35         也出现在[com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value =(26.1.0)。         建议:在AndroidManifest.xml:26:9-28:38中添加'tools:replace =“android:value”'以覆盖。

      
  •   

这是我的清单:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:allowBackup="true"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/> 
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

这是我的build.gradle:

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "project.com"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 27
        versionName "5.1.1"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.each { output ->

            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile (project(':pushwoosh-react-native-plugin'))
    {
      exclude group: 'com.google.android.gms'
    }
    compile project(':react-native-google-analytics-bridge')
    compile project(':react-native-fetch-blob')
    compile project(':react-native-video')
    compile("com.google.firebase:firebase-messaging:11.8.0") {
        force = true
    }
    compile("com.google.firebase:firebase-core:11.8.0") {
        force = true
    }
    compile("com.google.android.gms:play-services-gcm:11.8.0") {
        force = true
    }
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:26.0.2"
    compile "com.facebook.react:react-native:+"
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

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

有人帮我修复错误吗?谢谢!

1 个答案:

答案 0 :(得分:0)

在您的AndroidManifest.xml的应用程序标记中写入tools:replace =“ android:value”,如果您遇到其他版本问题,请转到android平台文件夹中的project.properties文件并更正版本。