Problems updating new version 10.2.0 of PlayServices and Firebase

只愿长相守 提交于 2019-12-28 06:17:12

问题


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 ?


回答1:


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/




回答2:


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'
}


来源:https://stackoverflow.com/questions/42315548/problems-updating-new-version-10-2-0-of-playservices-and-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!