简体   繁体   English

Android studio(gradle) 版本兼容性

[英]Android studio(gradle) versions compatibility

I have this issue.我有这个问题。 Android studio(Gradle) versions compatibility issue. Android studio(Gradle) 版本兼容性问题。 Can anyone please help me to solve this issue.任何人都可以帮我解决这个问题。 All the versions of dependencies that I have used are mentioned below.下面提到了我使用的所有依赖项版本。 I think this is a version problem.我认为这是一个版本问题。 Tried much.试了很多。 But couldn't solve.却无法解决。 Can you please help me.你能帮我么。 What can i do to solve this problem.我能做些什么来解决这个问题。

Project Level Gradle file:项目级 Gradle 文件:

allprojects {
    ext {
        appName = "FbaseDemo"
        majorVersion = "0"
        minorVersion = "1"
        patchVersion = "1"

        supportLibrary = '26.0.0'
        constraintLayout = '2.0.0-beta2'
        virgilSdk = '5.1.2'
        virgilCrypto = "5.0.2@aar"
        rxJava = "2.1.5"
        rxAndroid = "2.0.2"
        retrofit = "2.3.0"
        gson = "2.8.0"
        butterKnife = '10.1.0'
        networkTracker = '3.0.3'
        dagger = '2.24'
        loggingInterceptor = '4.0.1'
        rxRetrofitAdapter = '2.6.0'
        converterGson = "2.3.0"
        apacheCommons = "3.7"
        firebaseCore = '17.0.1'
        firebaseAuth = '18.1.0'
        firebaseFirestore = "17.0.1"
        room = '1.1.1'
//        crashlytics = "2.9.3"
    }


apply plugin: 'com.android.application'
//apply plugin: 'io.fabric'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.android.virgilsecurity.virgilonfire"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName majorVersion + "." + minorVersion + "." + patchVersion
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        setProperty("archivesBaseName", appName + "-v" + versionName)
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Project Level Dependencies:项目级依赖:

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // Support

    implementation "com.android.support:appcompat-v7:21.0.0"
    implementation "com.android.support.constraint:constraint-layout:$constraintLayout"
    implementation "com.android.support:design:$supportLibrary"

    // RxJava
    implementation "io.reactivex.rxjava2:rxandroid:$rxAndroid"
    implementation "io.reactivex.rxjava2:rxjava:$rxJava"
    implementation "com.squareup.retrofit2:adapter-rxjava:$rxRetrofitAdapter"

    // Retrofit
    implementation "com.squareup.retrofit2:retrofit:2.6.1"

    // Gson
    implementation "com.google.code.gson:gson:2.8.5"
    implementation "com.squareup.retrofit2:converter-gson:2.6.1"

    // Logging Interceptor
    implementation "com.squareup.okhttp3:logging-interceptor:$loggingInterceptor"

    // ButterKnife
    implementation "com.jakewharton:butterknife:$butterKnife"
    annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnife"

    // Network Tracker
    implementation "com.github.pwittchen:reactivenetwork-rx2:$networkTracker"

    // Virgil Security
    implementation "com.virgilsecurity.sdk:crypto-android:$virgilCrypto"
    implementation "com.virgilsecurity.sdk:sdk:$virgilSdk"

    // Dagger
    implementation "com.google.dagger:dagger-android:$dagger"
    annotationProcessor "com.google.dagger:dagger-compiler:$dagger"
    annotationProcessor "com.google.dagger:dagger-android-processor:$dagger"

    // Apache commons
    implementation "org.apache.commons:commons-lang3:3.9"

    // Firebase
    implementation "com.google.firebase:firebase-core:$firebaseCore"
    implementation "com.google.firebase:firebase-auth:$firebaseAuth"
    implementation "com.google.firebase:firebase-firestore:20.2.0"
//    implementation "com.crashlytics.sdk.android:crashlytics:$crashlytics"

    // Room
    implementation "android.arch.persistence.room:runtime:$room"
    annotationProcessor "android.arch.persistence.room:compiler:$room"
    implementation "android.arch.persistence.room:rxjava2:$room"
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.0'
            }
        }
    }
}
apply plugin: 'com.google.gms.google-services'

App level Gradle file:应用级 Gradle 文件:

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'

        classpath 'com.google.gms:google-services:4.3.0'

        // Crashlytics
//        classpath 'io.fabric.tools:gradle:1.25.4'
    }
}





android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.android.virgilsecurity.virgilonfire"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName majorVersion + "." + minorVersion + "." + patchVersion
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        setProperty("archivesBaseName", appName + "-v" + versionName)
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}



dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "com.android.support:appcompat-v7:21.0.0"
    implementation "com.android.support.constraint:constraint-layout:$constraintLayout"
    implementation "com.android.support:design:$supportLibrary"

Android resource linking failed with the next error: Android 资源链接失败,出现下一个错误:

C:\Users\isufernando\Desktop\New folder\demo-firebase-android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2476: error: resource android:attr/fontVariationSettings not found.
C:\Users\isufernando\Desktop\New folder\demo-firebase-android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2476: error: resource android:attr/ttcIndex not found.
error: failed linking references.

resource android:attr/fontVariationSettings not found.资源 android:attr/fontVariationSettings 未找到。
resource android:attr/ttcIndex not found.资源 android:attr/ttcIndex 未找到。

Change the compileSdkVersion to:compileSdkVersion更改为:

compileSdkVersion 28

fontVariationSettings andttcIndex were added in api level 28 . fontVariationSettingsttcIndex是在 api level 28中添加的。

Also you are using你也在使用

implementation "com.google.firebase:firebase-auth:18.1.0"

Firebase migrated to AndroidX in the latest release. Firebase 在最新版本中迁移到 AndroidX。 It means that you are using both, support libraries and androidx libraries.这意味着您同时使用了支持库和 androidx 库。

You can:你可以:

  • migrate to androidx as described below如下所述迁移到 androidx
  • downgrade your firebase dependencies (but it is not a real solution because you have to migrate before or after)降级您的 firebase 依赖项(但这不是真正的解决方案,因为您必须在之前或之后进行迁移)

You can check theofficial release notes :您可以查看官方发行说明

Warning: This release is a MAJOR version update and breaking change.警告:此版本是主要版本更新和重大更改。 The latest update to Google Play services and Firebase includes the following changes: Google Play 服务和 Firebase 的最新更新包括以下更改:

Migration from Android Support Libraries to Jetpack (AndroidX) Libraries.从 Android 支持库迁移到 Jetpack (AndroidX) 库。 Libraries will not work unless you make the following changes in your app:除非您在应用程序中进行以下更改,否则库将无法工作:

  • Upgrade com.android.tools.build:gradle to v3.2.1 or later.com.android.tools.build:gradle升级到 v3.2.1 或更高版本。
  • Upgrade compileSdkVersion to 28 or later.compileSdkVersion升级到 28 或更高版本。
  • Update your app to use Jetpack (AndroidX) ;更新您的应用以使用 Jetpack (AndroidX) follow the instructions in Migrating to AndroidX .按照迁移到 AndroidX 中的说明进行操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM