Joky
Joky

Reputation: 41

How to rename android-debug.apk

I am using Cordova (5.1.1) and ionic framework to create my android. However, when I try to build the apk, why the file name is always "android-debug.apk" ? Is there any way to rename it ?

  1. cordova create hello com.example.hello HelloWorld
  2. cd hello
  3. cordova platform add android
  4. cordova build android

In the hello\config.xml, name tag is defined as HelloWorld already:

Please help.

Upvotes: 4

Views: 4528

Answers (1)

Sunil Sunny
Sunil Sunny

Reputation: 3994

Yes you can change the name of the apk try this

buildTypes {
    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig getSigningConfig()
        applicationVariants.all { variant ->
            variant.outputs.each { output ->
                output.outputFile = new File(output.outputFile.parent,
                    output.outputFile.name.replace("-debug", "-" + whatever name you want
                )
            }
        }
    }
}

Also sync and clean the project after this.

Edit

Write this in build.gradle file.

Upvotes: 5

Related Questions