Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 25 declared in library [Wear App sub-manifest]

I'm trying to add a wearable module to my existing android (min sdk version 16) app. If I run the app (release mode), I'm getting this error:

Error:Execution failed for task ':app:processReleaseManifest'. Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 25 declared in library [Wear App sub-manifest] c:\workspaces\sampleapp\android\app\build\generated\manifests\microapk\release\AndroidManifest.xml Suggestion: use tools:overrideLibrary="" to force usage

I don't want to increase the minSdkVersion. So how can I fix the issue without changing minSdkVersion of my app?

here are my gradle files:

phone app

apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            [...]
        }
    }

    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    repositories {
        jcenter()
        maven {
            url "https://maven.java.net/content/groups/public/"
        }
    }
    defaultConfig {
        applicationId "com.sample.app"
        minSdkVersion 16
        targetSdkVersion 25
        signingConfig signingConfigs.config
    }
    buildTypes {
        release {
            debuggable true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    [...]

    compile 'com.google.android.gms:play-services-wearable:10.2.0'
    wearApp project(':sample-wear')
}

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

waerable app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    signingConfigs {
        config {
            [...]
        }
    }

    defaultConfig {
        applicationId "com.sample.app"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        signingConfig signingConfigs.config
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.google.android.support:wearable:2.0.0'
    compile 'com.google.android.gms:play-services-wearable:10.2.0'
    provided 'com.google.android.wearable:wearable:2.0.0'
}

Note: The error occurs only with Gradle 2.3.0. Gradle 2.2.3 works as expected...

Similar issue on code.google.com: https://code.google.com/p/android/issues/detail?id=232834

like image 950
dieter Avatar asked Mar 08 '17 22:03

dieter


1 Answers

In your gradle file just update the minSdkVersion into 23

android {
compileSdkVersion 30
defaultConfig {
    applicationId "com.oaics.customer"
    minSdkVersion 23
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
}
like image 196
samin Avatar answered Sep 19 '22 18:09

samin