17

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

alex
  • 8,904
  • 6
  • 49
  • 75

6 Answers6

6

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"
}
samin
  • 482
  • 5
  • 9
2

In case of Ionic project

preference name="android-minSdkVersion" value="19"

In Config.xml (Project directory) file set above field to the version required.

Phonolog
  • 6,321
  • 3
  • 36
  • 64
Keerthesh
  • 77
  • 8
1

The only way I made it work was:

  1. Uninstall the android platform: ionic cordova platform rm android
  2. Update the config.xml file at the root of the Ionic project: from

    <preference name="android-minSdkVersion" value="16" />

    to

    <preference name="android-minSdkVersion" value="19" />

I'm assuming that for OP's situation the value should be 25 and not 19 (in my case it was 19 in the error).

  1. Add the android platform to the project again: ionic cordova platform add android

then prepare and build - should not return that same error anymore.

BoDeX
  • 846
  • 8
  • 18
1

You can change it in file build.gradle this works for me.

defaultConfig {
    minSdkVersion 21
    targetSdkVersion 33
}
CaptainCrunch
  • 1,230
  • 14
  • 15
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 27 '22 at 11:48
0

It seems to Gradle issue, as your 'wearable'module has minimum 23 sdk, not 25.

Please check also AndroidManifest.xml of that module as it may contains uses-sdk:minSdkVersion with '25'.

If there is no value, you can add it thereto override Gradle configuration value.

Hope it will help.

piotrek1543
  • 19,130
  • 7
  • 81
  • 94
0

I faced the same problem using platform IONIC and CORDOVA. I solved this problem doing the following:

Check both files:

[folder_your_app]\platforms\android\app\src\main\AndroidManifest.xml

and for example:

\Users\[your_user]\.gradle\caches\transforms-1\files-1.1\tbxml-android.aar\f0d6a971caeb6d952bf6b9b62464f2ab\AndroidManifest.xml

In first file check following line:

uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26"

and compare with folowing line of the second file:

android:minSdkVersion="16"

Adjust the versions and enjoy!

Mihai Chelaru
  • 7,614
  • 14
  • 45
  • 51
Ita
  • 29
  • 4