我有一個 android 專案導致方法沒有簽名,經過一些研究,這似乎來自
android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileSdkVersion 30
buildToolsVersion '31.0.0'
defaultConfig {
applicationId 'ch.workouttracker'
minSdkVersion 24
targetSdkVersion 30
versionCode 0.901
versionName '0.9.0.1'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resConfigs "de" // And any other languages you support
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
productFlavors {
}
compileOptions {
sourceCompatibility VERSION_11
targetCompatibility VERSION_11
}
}
此配置有什么問題或缺失?我想這主要是版本的問題,因為我改變了它們
uj5u.com熱心網友回復:
我認為問題出在 Gradle 檔案中的 VersionCode 上。你有這個:
versionCode 0.901
versionName '0.9.0.1'
問題是 versionCode 只能是正整數,而不是帶小數位的數字。這來自檔案
versionCode — 用作內部版本號的正整數。此數字僅用于確定一個版本是否比另一個版本更新,數字越大表示版本越新。這不是向用戶顯示的版本號;該數字由下面的 versionName 設定設定。Android 系統使用 versionCode 值來防止用戶安裝版本代碼低于其設備上當前安裝的版本的 APK,從而防止降級。
所以只需將其更改為 1。您可以更改 versionName,但每個未來版本的 versionCode 都會有 1。所以 versionCode 將是 2 和 versionName '0.9.0.2' 等。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/322949.html
