Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android studio: release apk is not signed

* 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:

  1. In the Build Variants tab, select "release"
  2. In the menu, choose Build -> Generate Signed APK
  3. In the popup, fill in the fields for the key store and passwords.
  4. In the second panel, change the destination folder to ...\app\build\outputs\apk (see note * below)
  5. Observe notification in upper right of studio: APK(s) generated successfully.
  6. In the menu, click Run -> Run App.
  7. 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.

like image 997
Peri Hartman Avatar asked Sep 05 '25 10:09

Peri Hartman


2 Answers

Go to File\Project Structure

Signing Tab

Flavor Tab

Build Type

Done! ;)

like image 198
D B Avatar answered Sep 09 '25 17:09

D B


Set signing config in project structure.

  1. File -> Project Structure...
  2. Select Modules/app (or other module)
  3. Click Signing tab and fill in.
    Key Alias and Key Password comes first. Not same order in "Generate Signed APK" dialog.
  4. Click Build Types tab and select release.
    Select "config" in Signing config dropdown list.
  5. Click OK to close Project Structure.
  6. Run -> Run app

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

like image 26
Toris Avatar answered Sep 09 '25 16:09

Toris