Java 无法使用CompileSDKVersion'安装apk;android-Q';
“我试图安装我的apk,但它给出了这个消息。 软件包似乎已损坏。 这是我的build.gradle文件”。然而,当我将compilesdkversion更改为28时,它正在运行。从android studio直接运行应用程序时,它正在运行,但在生成apk后,它没有安装Java 无法使用CompileSDKVersion'安装apk;android-Q';,java,android,Java,Android,“我试图安装我的apk,但它给出了这个消息。 软件包似乎已损坏。 这是我的build.gradle文件”。然而,当我将compilesdkversion更改为28时,它正在运行。从android studio直接运行应用程序时,它正在运行,但在生成apk后,它没有安装 apply plugin: 'com.android.application' android { compileOptions { sourceCompatibility JavaVersion.VER
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'
}
要全面测试应用程序与新API的兼容性并开始使用新API,请打开模块级
build.gradle
文件,并更新编译器dkVersion和targetSdkVersion,如下所示
android {
compileSdkVersion 29
defaultConfig {
targetSdkVersion 29
}
}
FYI
您的类路径将是
classpath 'com.android.tools.build:gradle:3.4.1'
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
分布式URL
将
classpath 'com.android.tools.build:gradle:3.4.1'
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
是的,我的问题解决了。我下载了api 29的sdk,并按照下面的答案做了。