簡體   English   中英

您上傳了在調試模式下簽名的 APK。 您需要在發布模式錯誤中簽署您的 APK

[英]You uploaded an APK that was signed in debug mode. You need to sign your APK in release mode error

我正在嘗試在 Google Play 商店上傳應用程序。 我正在構建 .apk 並使用 Maven 對其進行簽名。 我已經使用 maven-jarsigner-plugin 來簽署 .apk 文件。 我正在使用我使用 Eclipse 向導創建的密鑰來簽署另一個 Android 應用程序。 我使用以下命令壓縮 .apk 文件:zipalign [-f] [-v] infile.apk outfile.apk

當我嘗試在 Playstore 上上傳應用程序時,出現錯誤您上傳了在調試模式下簽名的 APK。 您需要在發布模式下簽署您的 APK。 誰能告訴我如何在發布模式下簽署apk? 我是 Maven 的新手(今天開始使用它)。 謝謝

更改為:signingConfigsigningConfigs.release

從signingConfigsigningConfigs.debug

在您的 build.gradle 應用程序級別

我不知道您如何在 Maven 中執行此操作,但是您需要使用發布密鑰庫編譯您的應用程序。 您可以使用keytool創建一個,它位於您的 Java bin 文件夾中:

$ keytool -genkey -v -keystore my-release-key.keystore
-alias alias_name -keyalg RSA -keysize 2048 -validity 10000

創建它時,您必須提供兩個密碼,一個用於密鑰庫,一個用於密鑰。 創建密鑰庫后,您可以使用 Eclipse 導出向導在發布模式下編譯您的應用程序。

有關更多詳細信息,請參閱http://developer.android.com/tools/publishing/app-signing.html#releasemode

始終使用包含“發布”而不是“調試”的名稱和別名創建您的密鑰庫。 如果您遇到“您上傳了在調試模式下簽名的 APK。您需要在發布模式下簽名您的 APK 錯誤”,則可以肯定您使用的是默認密鑰庫,即“debug.keystore”,因此在調試模式下生成了 apk。

解決方案

  1. 生成新的密鑰庫
  2. 在 build.gradle 文件中給出參考
  3. 將構建變體更改為“發布”
  4. 建造

這應該可以解決問題。

轉到android/app/build.gradle

在文件末尾:

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug <==== change this to release
    }
}

結果應該是這樣的:

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.release
    }
}

我的顫振應用程序遇到了同樣的問題,

將這些添加到您的 android/app/build.gradle 文件中。 搖籃:

在 android { compileSdkVersion 30 之前

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

然后在 defaultConfig {

}
signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
        storePassword keystoreProperties['storePassword']
    }
}
buildTypes {
    release {
        signingConfig signingConfigs.release
    }
}

對於顫振錯誤,默認情況下顫振會創建如下所示的構建類型

  buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}

你應該改變signingconfig行

        signingConfig signingConfigs.release

使用 -genkeypair 而不是 -genkey 為我解決了這個問題。

所以:keytool -genkeypair -keystore name.keystore -alias nameapp -keyalg RSA

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM