我的Android Studio升级到Arctic Fox版本后,在这个项目中无法正确运行模拟器,为什么?

时间:2021-08-01 07:32:10

标签: android-studio android-emulator build.gradle

我的Android Studio升级到Arctic Fox版本后,在这个项目中无法正确运行模拟器,为什么?

build.gradle(模块)

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id 'dagger.hilt.android.plugin'
    id "androidx.navigation.safeargs.kotlin" }

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.squall.doodlekong_android"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

    buildFeatures {
        viewBinding true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    } }

dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.6.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation "androidx.recyclerview:recyclerview:1.2.1"

    //Scarlet
    def scarletVersion = '0.1.12'
    implementation "com.tinder.scarlet:scarlet:$scarletVersion"
    implementation "com.tinder.scarlet:websocket-okhttp:$scarletVersion"
    implementation "com.tinder.scarlet:lifecycle-android:$scarletVersion"
    implementation "com.tinder.scarlet:message-adapter-gson:$scarletVersion"
    implementation "com.tinder.scarlet:stream-adapter-coroutines:$scarletVersion"

    //retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

    //okhttp3
    // define a BOM and its version
    implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.0"))
    // define any required OkHttp artifacts without version
    implementation("com.squareup.okhttp3:okhttp")
    implementation("com.squareup.okhttp3:logging-interceptor")

    //Easy Permissions
    implementation 'pub.devrel:easypermissions:3.0.0'

    //Preferences DataStore
    implementation "androidx.datastore:datastore-preferences:1.0.0-rc02"
    implementation "androidx.datastore:datastore-preferences-core:1.0.0-rc02"

    //Dagger Hilt
    implementation 'com.google.dagger:hilt-android:2.38.1'
    kapt 'com.google.dagger:hilt-compiler:2.38.1'

    //Timber
    implementation 'com.jakewharton.timber:timber:4.7.1'

    def lifecycle_version = "2.4.0-alpha02"
    // ViewModel
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    // LiveData
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
    // Lifecycles only (without ViewModel or LiveData)
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"

    // alternately - if using Java8, use the following instead of lifecycle-compiler
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

    //Coroutine
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1'

    // Navigation component
    def nav_version = "2.3.5"
    implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
    implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

    //Gson
    implementation 'com.google.code.gson:gson:2.8.7'

    //Lottie
    implementation 'com.airbnb.android:lottie:4.0.0' }

build.gradle(项目)

buildscript {
    ext.kotlin_version = "1.5.21"
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
        def nav_version = "2.3.5"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    } }

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
    } }

task clean(type: Delete) {
    delete rootProject.buildDir }

构建错误:

<块引用>

API 'BaseVariant.getApplicationIdTextResource' 已过时并已 已替换为“VariantProperties.applicationId”。这将是 在 Android Gradle 插件的 7.0 版中删除。更多 信息,见待定。确定调用的是什么 BaseVariant.getApplicationIdTextResource,使用 -Pandroid.debug.obsoleteApi=true 在命令行上显示更多信息。

0 个答案:

没有答案