Sunday, December 28, 2014

merger failed : uses-sdk:minSdkVersion 16 cannot be different than version L declared in library [project_path]\AndroidManifest.xml

After so long design and draw system/solution/software architecture, my programming skill seem rusted. Thought of venturing into programming again as part-time, I started to look into java (still love Netbeans) and Android programming (used Android Studio v1.0.2) for mobile development....And it throw the first challenge to me... can't compiled a sample program. HUH!

First time loading.. got this error:
merger failed : uses-sdk:minSdkVersion 16 cannot be different than version L declared in library [project_path]\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0-rc1\AndroidManifest.xml

Google the issues and found many link.. mostly at StackOverflow ... but it does not helpful at all. After a while googling it, found a solutions that solve my 2 days problem. A simple solutions; change all sdkVersion to "android-L" and compiled it again... and it works... yeeehaaa... here is how it looks like.

before change in file build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.app.masteramuk.myfirstapp"
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.+'

after change in file build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion "android-L"
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.app.masteramuk.myfirstapp"
        minSdkVersion "android-L"
        targetSdkVersion "android-L"
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])


notes:
  • just change the file build.gradle
  • only apply to code using Android SDK or Android Studio
  • only apply to code that requires to be compatible with lower SDK @ lower Android
Thanks to simple but workable solutions from reddit

0 comments :

Share It

Gadget

This content is not yet available over encrypted connections.

Popular Posts