Можно ли нацеливаться на Android 28 (например, `targetSdkVersion 28`) и использовать как appcompat-v7, так и Firebase? - PullRequest
0 голосов
/ 03 сентября 2018

Кто-нибудь успел нацелиться на Android 28 (например, установить targetSdkVersion 28) и использовать Firebase? Мой build.gradle, как показано ниже:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.google.firebase.example.fireeats"
        minSdkVersion 28
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

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

Android Studio предупреждает о смешанных версиях: Found versions 28.0.0-rc02, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-rc02 and com.android.support:support-media-compat:26.1.0

Android Studio Warning Является ли Firebase 16.0.3 несовместимым с библиотекой поддержки Android 28?

1 Ответ

0 голосов
/ 29 октября 2018

На момент написания Firebase зависит от версии библиотеки поддержки 27, поэтому вам необходимо предоставить явные переопределения. Смотрите рабочий файл сборки ниже.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.google.firebase.example.fireeats"
        minSdkVersion 28
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0' // NEED TO ADD
    implementation 'com.android.support:support-v4:28.0.0' //NEED TO ADD
    implementation 'com.google.firebase:firebase-core:16.0.4'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

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