gpt4 book ai didi

java - 无法使用 CompileSDKVersion 'android-Q' 安装 apk

转载 作者:行者123 更新时间:2023-11-29 23:06:08 32 4
gpt4 key购买 nike

“我尝试安装我的 apk,但它给出了这条消息。包似乎已损坏。这是我的 build.gradle 文件”。然而,当我将 compilesdkversion 更改为 28 时,它正在运行。在直接从 android studio 运行应用程序时,它正在运行,但在生成 apk 之后它没有安装?

apply plugin: 'com.android.application'

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 'android-Q'
defaultConfig {
applicationId "com.example.deskneedui"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.wdullaer:materialdatetimepicker:4.2.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.volley:dc-volley:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.wdullaer:materialdatetimepicker:4.2.0'

androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
}

最佳答案

全面测试您的应用与 Android Q 的兼容性并开始使用新的 API,打开您的module-level build.gradle 文件并更新 compileSdkVersion 和 targetSdkVersion如下图

android {
compileSdkVersion 29

defaultConfig {
targetSdkVersion 29
}

}

仅供引用

您的类路径将是

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

distributionUrl 将是

distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

关于java - 无法使用 CompileSDKVersion 'android-Q' 安装 apk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56504623/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com