我刚完成我的android项目,并决定将其发布在Google Play商店中。当我将签名的APK文件上传到Google Play控制台的生产标签中时,遇到以下问题:
这是gradle信息:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.parma.torupee"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:26.1.0'
compile 'com.jjoe64:graphview:4.2.1'
}
我已经在Android Studio 3.0.1中开发了该应用程序(未更新)。我尝试将目标SDK更改为29,但随后在gradle文件中收到implementation 'com.android.support:appcompat-v7:26.1.0'
和implementation 'com.android.support:design:26.1.0'
行的错误。
如何将目标SDK更改为29,以使其支持最新版本并支持API级别26(Oreo)?任何帮助将不胜感激!
答案 0 :(得分:2)
编译SDK版本 编译SDK版本是您在其中编写代码的Android版本。如果选择9,则可以使用版本28中的所有API编写代码。
最低SDK版本 Android操作系统(OS)版本向后兼容。如果您的minSdkVersion设置为Android 22版,则您的应用程序将在Lolipop(5.1)及更高版本上运行。
目标SDK版本 您应该将targetSdkVersion设置为经过测试的最新版本的Android。
每当出现新版本的Android时,您都希望将targetSdkVersion更新为最新的Android版本,并测试您的应用程序以解决任何问题。如果您不使用google,则可能会迫使您对其进行更新。这样,您就可以使用通常适用于大多数OS版本的新安全补丁。
增加目标sdk不会影响您定义的最低版本号。
已编辑:更新了对支持库的评论
如果要将目标SDK更新到28,则可能会更容易,因为可以使用以下支持库
com.android.support:support-compat:28.0.0,但是如果您打算将目标sdk设为29,则必须将所有支持包迁移到androidx库。
https://developer.android.com/topic/libraries/support-library/packages
为便于迁移,您可以按照这里的提示进行操作https://developer.android.com/jetpack/androidx/migrate
让我知道这是否有帮助
答案 1 :(得分:-1)
您可以使用:
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.android.support:design:29.0.0'