* I have rephrased the post since originally posted *
When I try to run a just-built release apk, I get an error "the apk for your currently selected variant ... is not signed." This is in the Edit Configuration popup. Here are my steps:
- In the Build Variants tab, select "release"
- In the menu, choose Build -> Generate Signed APK
- In the popup, fill in the fields for the key store and passwords.
- In the second panel, change the destination folder to ...\app\build\outputs\apk (see note * below)
- Observe notification in upper right of studio: APK(s) generated successfully.
- In the menu, click Run -> Run App.
- I get an "Edit configuration" popup with the error "The apk for your currently selected variant ... is not signed.
So, why this error? The APK generated appears to be valid. I have successfully posted it to the Android Store (alpha testing only) and verified that stack dumps are obfuscated.
What I can't do is download it (step 6 above) to my device. I guess that's ok since I can download the debug version just fine.
(*) Android Studio defaults the output for the release apk to a higher, presumably more convenient directory. However I find it harder to manage the consistency of generated files when they are scattered about so I prefer all the generated apks in one place.
Go to File\Project Structure
Done! ;)
Set signing config in project structure.
Key Alias and Key Password comes first. Not same order in "Generate Signed APK" dialog.
Select "config" in Signing config dropdown list.
Run (or Debug) app seems to use apks built with "Buiild -> Build APK". So, we should set signing config if build variants of app module is "release".
In https://developer.android.com/studio/publish/app-signing#secure-shared-keystore it is written that you shouldn't keep credentials information in
build.gradle
and VCS. So create a signing config file (Build > Generate Signed APK...), then do so.Optionally in
build.gradle
you can add:Now you may make a signed apk. Don't forget to exclude
keystore.properties
from VCS.I had the same issue turned out I misconfigured the
signingConfigs
property.Specifically, I thought I didn't have a password for the key where I actually had set it. After adding the missing information, it worked.
First, Create a keystore file if there isn't one.
Second update the app build gradle file to someting like this one to include the signing config.
Third, build and run the app, done.
Try add this in your build file: