首页 > 解决方案 > 我的应用无法安装在 Android 11 上,但可以在旧版本中使用

问题描述

我有一个问题,我昨晚刚刚将我的设备更新到 android 11,而我的应用程序似乎没有安装在 android 11 上。即使在尝试完成安装后也会恢复到安装按钮。知道我做错了什么吗?这是我的 build.gradle 的一个片段:

 compileSdkVersion 30
    buildToolsVersion "30.0.2"
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }
    defaultConfig {
        applicationId  "myapp.android"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 44
        versionName "1.1.3"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true

    }

标签: androidkotlingradleandroid-gradle-pluginandroid-11

解决方案


尝试升级你的gradle。

之后 File -> Invalidate caches and Restart you Android studio。

  classpath 'com.android.tools.build:gradle:4.1.2'

在 gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

推荐阅读