I'm sure this is the dumb question of the day, but here it goes... I have an app that I need to distribute "in house" to be used by sales at a trade show. I successfully created a self signed, zipaligned, release apk file using Android Studio (in Windows 7). The name of the output file though is simply app-release.apk. Why is my app name not prefixed to the output file like MyApplication-release.apk? I suspect it has something to do with the folder structure in Android Studio where it is: MyApplication -> app -> src -> etc,etc. I tried refactoring the "app" folder to match my app name but it gives an error. I'm sure I am missing something simple.
2 Answers
Yes, it uses the folder name of your application's module. If you rename the folder, you also need to update your settings.gradle file with the updated name; the refactoring doesn't automatically change it there.
After you change settings.gradle, make sure you re-sync your project with the Gradle files. It should put a banner at the top of your editor windows reminding you that you need to do it; if you don't, then click the button in the toolbar.

- 79,344
- 24
- 180
- 163
-
When I first tried this it gave me an error. The second time it worked but I had to re-sync Gradle twice after updating settings.gradle. A little buggy but all seems fine now. – john8791 Oct 21 '14 at 19:17
-
One more question. How do I prevent this from happening in the future? The Create New Project dialog in Android studio does not ask for the module name so it defaults to "app" – john8791 Oct 21 '14 at 19:32
-
I don't think you can set it when creating a new project. You have to change it manually afterward. The fact that it doesn't update settings.gradle when you rename in the IDE is a bug: https://code.google.com/p/android/issues/detail?id=57692 – Scott Barta Oct 21 '14 at 19:58
-
Instead of renaming module names, wouldn't it be better if the output file name is configured to contain the project name, variant and build type (and maybe a version) in the gradle build script?! – Draško Kokić Jun 21 '15 at 10:24
-
1for more details (with a link to a sample project) follow http://www.jayway.com/2015/03/13/producing-better-named-android-apks-with-gradle/ – Draško Kokić Jun 21 '15 at 11:30
May be it is too late to answer but i was having same problem to show my app name with the apk generated. i just update the defaultConfig
in build.gradle(Module:app)
as following
defaultConfig {
applicationId "com.test.testapp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", "TestApp")
}
This works by modifying the archivesBaseName
property and works for Gradle Version >= 2.0, last tested with gradle-3.3-all
.
Output would be TestApp-debug.apk
instead of app-debug.apk

- 2,759
- 2
- 28
- 42