Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run my Android custom build type?

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?

like image 327
Nigel Avatar asked Mar 13 '14 15:03

Nigel


People also ask

How do I change my build type?

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.

How do I run an APK file in Android Studio?

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.

Can I build APK without Android Studio?

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).


1 Answers

Choose the release build variant from the Build Variants tool window, as shown:

IDE screenshot, showing Build Variants tool window

like image 177
Scott Barta Avatar answered Oct 02 '22 19:10

Scott Barta