Home > Java > javaTutorial > body text

How to change the default name of APK in Android

高洛峰
Release: 2017-02-07 16:07:54
Original
1562 people have browsed it

Android How to modify the default name of APK

The name generated when packaging the App with Android Studio defaults to app-release.apk (signed) or app-debug.apk (test version).

If you want to change the default name when packaging, you can open the build.gradle (module: app) file and add the following code in android{}:

android.applicationVariants.all { variant ->
    variant.outputs.each { output ->
      def outputFile = output.outputFile
      if (outputFile != null && outputFile.name.endsWith('.apk')) {
        //这里修改apk文件名
        def fileName = outputFile.name.replace("app", "你想要的名字")
        output.outputFile = new File(outputFile.parent, fileName)
      }
    }
  }
Copy after login

Write Simply click BuildApk in the Build toolbar or use signature packaging.

The rendering is as follows:

Android 如何修改APK的默认名称

In fact, it can also be like this: right click -> Rename.

Thank you for reading, I hope it can help you, thank you for your support of this site!

For more Android related articles on how to change the default name of APK, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!