1 回答

TA貢獻2012條經驗 獲得超12個贊
assembleDebug
這會使用調試變體為您的項目構建一個apk 。
這會在 project_name/module_name/build/outputs/apk/ 中創建一個名為 module_name-debug.apk 的 APK。該文件已使用調試密鑰簽名并與 zipalign 對齊,因此您可以立即將其安裝到設備上。
installDebug
這會使用調試變體為您的項目構建一個apk,然后將其安裝在連接的設備上
或者構建 APK 并立即將其安裝在正在運行的模擬器或連接的設備上,而不是調用
installDebug
assembleRelease
這會創建您的應用程序的發布apk。然后您需要使用命令行或通過在您的(見下文)中設置簽名詳細信息來build.gradle
對其進行簽名,然后您可以使用adb
.
通過命令行簽署apk所涉及的步驟相當長,這可能取決于您的項目是如何設置的。
bundleRelease
這將創建一個版本aab,這是 Google 上傳到 Play 商店的首選格式。
Android App Bundle 包括您應用的所有編譯代碼和資源,但將 APK 生成和簽名推遲到 Google Play。與 APK 不同,您不能將應用程序包直接部署到設備。因此,如果您想快速測試 APK 或與其他人共享 APK,您應該改為構建 APK。
簽署你的 apk/aab
您可以配置您的app/build.gradle
,以便在構建完成后進行簽名。
在你的app/build.gradle
android {
? ? ...
? ? defaultConfig { ... }
? ? signingConfigs {
? ? ? ? release {
? ? ? ? ? ? // You need to specify either an absolute path or include the
? ? ? ? ? ? // keystore file in the same directory as the build.gradle file.
? ? ? ? ? ? storeFile file("my-release-key.jks")
? ? ? ? ? ? storePassword "password"
? ? ? ? ? ? keyAlias "my-alias"
? ? ? ? ? ? keyPassword "password"
? ? ? ? }
? ? }
? ? buildTypes {
? ? ? ? release {
? ? ? ? ? ? signingConfig signingConfigs.release
? ? ? ? ? ? ...
? ? ? ? }
? ? }
}
添加回答
舉報