16

am purchased app(beetle game) from internet to edit on it .. but when i run app this msg appears to me

    Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 9 declared in library /Users/omar/Downloads/BeetleGame1/app/build/intermediates/exploded-aar/com.google.android.gms/play-services/7.5.0/AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="com.google.android.gms.all" to force usage

build.grade(project:beetlegame1)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

build.grade(module:app)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "23.0.0 rc2"

    defaultConfig {
        applicationId "com.game"
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_5
            targetCompatibility JavaVersion.VERSION_1_5
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.google.android.gms:play-services:+'
}

build.grade(module:google-play-services-lib)

    configurations.create("default")
artifacts.add("default", file('google-play-services_lib.jar'))

i can attach the link to download app game which i have .. to see it :)

omar hassan
  • 171
  • 1
  • 1
  • 4

7 Answers7

24

The imported library google play services has a minsdk specified as 9 whereas you seem to be targeting much lower versions. To override it you need to add tools:overrideLibrary with the package name in AndroidManifest.xml file which will ignore the library specified minSDK version.

<?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="your package name">

       <uses-sdk tools:overrideLibrary="com.google.android.gms.all"/>
       --------------------------------
       --------------------------------
 </manifest>

tools:overrideLibrary marker

A special marker that can only be used with uses-sdk declaration to override importing a library which minimum SDK version is more recent than that application's minimum SDK version. Without such a marker, the manifest merger will fail. The marker will allow users to select which libraries can be imported ignoring the minimum SDK version.

Psypher
  • 10,717
  • 12
  • 59
  • 83
  • 2
    same error,, but when i use this code he told me to merge it in one element ,, when i made it ... (Error:(6, 5) uses-sdk element cannot have a "tools:node" attribute) (Error:(6, 5) Execution failed for task ':app:processDebugManifest'. > Manifest merger failed : uses-sdk element cannot have a "tools:node" attribute) – omar hassan Jul 05 '15 at 11:33
  • 1
    but the old error disappeared ,, and this new one :D – omar hassan Jul 05 '15 at 11:35
  • Just remove the tools:node="replace" line..I have corrected in my answer too – Psypher Jul 05 '15 at 11:53
  • I have add the line and still having problem – Vincent Paing Oct 02 '15 at 11:07
  • 2
    @Renges Also often inserting one library is not enough, you should specify a set of such libraries like – Beloo Oct 06 '15 at 15:27
15
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="22"
    tools:overrideLibrary="
    com.google.android.gms.all,
    com.google.android.gms.ads,
    com.google.android.gms.auth,
    com.google.android.gms.base,
    com.google.android.gms.measurement,
    com.google.android.gms,
    com.google.android.gms.analytics,
    com.google.android.gms.appindexing,
    com.google.android.gms.appinvite,
    com.google.android.gms.appstate,
    com.google.android.gms.cast,
    com.google.android.gms.drive,
    com.google.android.gms.fitness,
    com.google.android.gms.location,
    com.google.android.gms.maps,
    com.google.android.gms.games,
    com.google.android.gms.gcm,
    com.google.android.gms.identity,
    com.google.android.gms.nearby,
    com.google.android.gms.panorama,
    com.google.android.gms.plus,
    com.google.android.gms.safetynet,
    com.google.android.gms.wallet,
    com.google.android.gms.wearable" />
Ahamadullah Saikat
  • 4,437
  • 42
  • 39
5

You are getting this error because you do not declare a minSdkVersion in your app's build.gradle file:

 defaultConfig {
    applicationId "com.game"
    minSdkVersion 9
    targetSdkVersion 22
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_5
        targetCompatibility JavaVersion.VERSION_1_5
    }
}
ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • 'A big error' is not descriptive enough to help you fix any remaining issues. I assume that this fix *did* remove the error this question was asking and instead started on whole new errors? If so, it would seem those would be appropriate for more questions. – ianhanniballake Jul 05 '15 at 11:30
1

enter image description here

make minSdkVersion=9 like in the picture. Worked for me.

jim
  • 228
  • 4
  • 10
0

Open Android Studio -> Open Manifest File

add don't forget to include xmlns:tools="http://schemas.android.com/tools" too, before the tag

<uses-sdk tools:overrideLibrary="com.google.android.gms.all"/>
Community
  • 1
  • 1
Atul
  • 1,477
  • 12
  • 9
0

use this code in manifest.xml

<uses-sdk
    android:minSdkVersion="10"
    android:maxSdkVersion="14"
    tools:overrideLibrary="x"/>
ali bagheri
  • 139
  • 2
  • 5
0

My code to override libraries and avoid the "suggestion: use a compatible library with a minSdk of at most 21, or increase this project's minSdk version to at least 23":

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.facephi.sdk.demo">

    <uses-sdk tools:overrideLibrary="
      com.company.licensing.lite;
      com.company.license_checker_component;
      com.company.some_component;" />

Very important to add: xmlns:tools="http://schemas.android.com/tools" in the AndroidManifest.

Leandro Ariel
  • 727
  • 8
  • 5