Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems updating new version 10.2.0 of PlayServices and Firebase

I develop an Android app using Android Studio and I got the message today that there is a new version of Google Play services and Firebase.

From 10.0.1 to 10.2.0.

I'm using Google play services analytics and ads that's all.

I am already choose an API min 9 and Now I think the ads can't be show in API < 14 .

My build.gradle File:

 apply plugin: 'com.android.application'

android {

    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.ilyo.x1application"
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.google.firebase:firebase-ads:10.2.0'
    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.android.gms:play-services-ads:10.2.0'
    testCompile 'junit:junit:4.12'
}

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

Error Message

Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.google.firebase:firebase-ads:10.2.0]

/Users/mac/Documents/AndroidStudioProjects/Project1/app/build/intermediates/exploded-aar/com.google.firebase/firebase-ads/10.2.0/AndroidManifest.xml Suggestion: use tools:overrideLibrary="com.google.firebase.firebase_ads" to force usage

I want to all my ads of my Application can show in all devices, What do you recommend ?

like image 399
iLyas Avatar asked Feb 18 '17 13:02

iLyas


2 Answers

The 10.2.0 version of ALL google related services require a minimum of API version 14. This is a choice done by Google, so they don't have to support API versions below 14.

So you'll have to stick to version 10.0.1 forever if you want to support API versions below 14. Or, you will have to raise your apps minimum API version to 14, and then use the new google services.

Article: https://www.xda-developers.com/google-play-services-release-notes-are-available-for-the-10-2-update-bye-gingerbread/

like image 198
Moonbloom Avatar answered Nov 05 '22 18:11

Moonbloom


Here you can find the official blog post by Google.

Version 10.0.0 of the Google Play services client libraries, as well as the Firebase client libraries for Android, will be the last version of these libraries that support Android API level 9 (Android 2.3, Gingerbread). The next scheduled release of these libraries, version 10.2.0, will increase the minimum supported API level from 9 to 14.

Since you are using:

minSdkVersion 9

you have to change it with:

minSdkVersion 14

Otherwise you can build multiple APKs to support devices with an API level less than 14 using:

productFlavors {
    legacy {
        minSdkVersion 9

    }
    current {
        minSdkVersion 14

    }
}

dependencies {
    legacyCompile 'com.google.android.gms:play-services:10.0.0'
    currentCompile 'com.google.android.gms:play-services:10.2.0'
}
like image 36
Gabriele Mariotti Avatar answered Nov 05 '22 19:11

Gabriele Mariotti