Release version of *.apk in Android Studio

我是研究僧i 提交于 2020-01-11 04:24:05

问题


I want to submite an application to Google Market. I found there is only one apk file generated in a project, its path is Project1Project/Project1/build/apk/Project1-debug-unaligned.apk

It looks like it's a debug version. Where do I find (if any) a release version of an application or how do I generate it?


回答1:


Since Android Studio is based on IntelliJ, that's how to do it in IntelliJ:

Build -> Generate Signed APK

and provide it with your key and its password.




回答2:


You can build an unsigned release version. See the answer here. I don't see an easy way to do it from the GUI, but you can use the shell command:

./gradlew assembleRelease

Make sure to cd to your project's directory before running the command. This will produce the file

Project1Project/Project1/build/apk/Project1-release-unaligned.apk

If you run ./gradlew assemble, both the release and debug version will be built.

More documentation here.




回答3:


From Android Studio 1.3.1, the ready-to-publish apk location is :

app -> app-release.apk

This should be published to Google Play

Intermediate apks are at :

app -> build -> outputs -> apk -> app-release-unaligned.apk

This is Intermediate result of Signing process, should not be published to Google Play




回答4:


Android gradle produces apk in two binaries: Unaligned and Aligned. Unaligned refers to how the data, files are structured within the APK file. A utility called zipalign modifies the APK to align data in a way that is optimized for users. Unaligned simply skips the zipalign stage.

Whereas an Aligned APK is an optimized version. The files are more structured and compressed, which helps the app run faster. They are also optimized for RAM usage so they can consume less RAM on the devices. you will also see size difference in the APK generated.



来源:https://stackoverflow.com/questions/17637700/release-version-of-apk-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!