Manifest merge failed

0

I am trying to run an android project in native react and I find the following error:

  

: app: processDebugManifest   /Users/me/project/android/app/src/main/AndroidManifest.xml:28:13-35   Error: Attribute meta-data#android.support.VERSION@value   value = (26.0.2) from [com.android.support:appcompat-v7:26.0.2]   AndroidManifest.xml: 28: 13-35 is also present at   [com.android.support:support-v4:26.1.0] AndroidManifest.xml: 28: 13-35   value = (26.1.0). Suggestion: add 'tools: replace="android: value"' to   element at AndroidManifest.xml: 26: 9-28: 38 to override.

     

See link for more information   about the manifest merger.

     

: app: processDebugManifest FAILED

     

FAILURE: Build failed with an exception.

     

What went wrong: Execution failed for task   ': app: processDebugManifest'. Manifest merger failed: Attribute   meta-data#android.support.VERSION@value value = (26.0.2) from   [com.android.support:appcompat-v7:26.0.2] AndroidManifest.xml: 28: 13-35   is also present at [com.android.support:support-v4:26.1.0]   AndroidManifest.xml: 28: 13-35 value = (26.1.0). Suggestion: add   'tools: replace="android: value"' to element at   AndroidManifest.xml: 26: 9-28: 38 to override.

This is my Manifest:

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

This is my 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'

I have been suggested to add tools: replace="android: value" to the manifest but this does not solve my problem.

    
asked by Jhonmer Araujo 03.04.2018 в 18:17
source

2 answers

0

Review the error message:

  

Error: Attribute meta-data#android.support.VERSION@value   value = (26.0.2) from [com.android.support:appcompat-v7:26.0.2]   AndroidManifest.xml

Suggest to define the meta data containing the value of the version, therefore add within <application> in your file AndroidManifest.xml :

   ...
   ...
   <meta-data
       tools:replace="android:value"
       android:name="android.support.VERSION"
       android:value="26.0.2" />

</application>
    
answered by 03.04.2018 / 18:25
source
-1

do not worry I'll help you modify it and that's it; 3

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 27
    buildToolsVersion "27.0.2"

    defaultConfig {
        applicationId "project.com"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 27
        versionName "7.1.3"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x58"
        }
    }
    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, "x82":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 162156 + defaultConfig.versionCode
            }
        }
    }
}

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

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

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

You're welcome: 3

    
answered by 03.04.2018 в 18:20