Detailed explanation of how Android changes APK file name in gradle

preface

This article mainly introduces the content about Android changing APK file name in gradle for your reference and learning. Let's take a look at the detailed introduction:

By default, the gradle build in Android studio is named. APK file app-release.apk. Some minor changes have been made to the application build.gradle file. You can change the. APK name to < app name > - release - < version >. APK.

You need to modify the build.gradle file under the directory of the app.

The first step is to set project. Archivesbasename to your application name.

The second step is to add the following code in the buildtypes section of the gradle file:

That's all you need to rename the. APK file.

One thing to note here is: if we use the productflavors {} attribute, we don't need to add defaultconfig.versionname, because if we add it, the name of the outgoing package will have one more versionname.

For example:

When productflavors {} is not used: appname-1.0.0.apk

When using productflavors {}: appname-test-release-1.0.0.apk, if you add defaultconfig.versionname, the package will be appname-test-release-1.0.0.apk.

That's all about modifying the application package name.

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>