How to change apk name by editing manifest file?

Viewed 83407

I want to change my apk name in the project workspace. How to do it by editing the AndroidManifest.xml file?

12 Answers

from the manifest.xml you can change application lebel only. you cant change apk name from there.

By default, Android Studio generates APK name like app-debug.apk or app-release.apk. But, i want to generate my own APK name. You can change it with your whatever name you desire with small changes in build.gradle file. Then Android Studio will generate signed APK for you.

This is the simple one that works for me using Android Studio 3.

Edit module(app) build.gradle, and add below:

android.applicationVariants.all { variant ->
    variant.outputs.all {
        def appName = "YourAPKName"
        outputFileName = appName+"-${variant.versionName}.apk"
    }
}

This code will generate file with name: YourAPKName-1.0.apk

Now you can try it changing the Gradle file :

   android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "com.company.app"
        minSdkVersion 13
        targetSdkVersion 21
        versionCode 14   
        versionName '1.4.8' 
        setProperty("archivesBaseName", "MyAppName-$versionName")
    }
}
Related