So I am trying to get my project to generate a signed and aligned apk and run it on my phone all through the Android Studio IDE.
My build.gradle looks like this:
signingConfigs {
release {
keyAlias 'key'
keyPassword 'pwd'
storeFile file('..\\m-release-key.keystore')
storePassword 'pwd'
}
}
buildTypes {
release {
debuggable false
jniDebugBuild false
signingConfig signingConfigs.release
runProguard false
zipAlign true
}
}
The problem is that when I build, all that is getting produced is a debug-unaligned.apk, whether I click on Run or Debug, I get the same thing. I can't see any setting for this in Build Configurations either. How can I tell Android Studio to use my release build type? What am I missing?
NOTE: By default, the Android Studio will generate "debug" and "release" Build Types for your project. So, to change a Build Type, all you need to do is just select your Build Type from the Build Variant and after the project sync, you are good to go.
Or, if you already have a project open, click File > Profile or Debug APK from the menu bar. In the next dialog window, select the APK you want to import into Android Studio and click OK. Android Studio then displays the unpacked APK files, similar to figure 1.
Check out the official docs - Build your app from the commandline. You can use gradle commands depending on which variant you want. For example, ./gradlew installDebug will make a debug apk and load it onto a connected device (though it won't open it like Android Studio does).
Choose the release build variant from the Build Variants tool window, as shown:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With