5

Environment: Windows 10 64 bit, Android Studio 3.2 Canary 15.

I have added free and paid flavours to a test project and than built signed APK's.

When Running the release APK's I get the following error -

Installation failed with message Failed to finalize session : 
INSTALL_PARSE_FAILED_NO_CERTIFICATES: Package 
/data/app/vmdl2005941423.tmp/0_base-master has no certificates at entry 
AndroidManifest.xml.
It is possible that this issue is resolved by uninstalling an existing 
version of the apk if it is present, and then re-installing.

I tried to re sign my APK with both V1 and V2 signature versions and still I get the same error when running release versions.

After analyzing the release APK's it turns out that AndroidManifest.xml shows the xmlns:android of the Manifest tag in red :

    <manifest
    xmlns:android="http://schemas.android.com/apk/res/android"

When I hover the red text it says "URI is not registered..."

I have no idea what it means...

What is the cause for this error ?

2 Answers 2

1

According here,

When building the APK Set, set the --ks and --ks-key-alias flags to ensure that the APKs are signed. Only signed APKs can be installed on a device. The Android SDK should come with a debug keystore. Try looking under ~/.android/debug.keystore (alias: AndroidDebugKey, pwd: android).

In other words, only signed apk could be install to devices. This makes sense since App Bundle is really use for distribution.

Sign up to request clarification or add additional context in comments.

2 Comments

So this means we can not even run debug version of application for testing and development purpose. Actually I am encountering the same problem when I run using debug keystore
You don't have to sign your apk just to run a debug version of your app. Debug Keystore isn't a valid signing key. You could sign your apk with it but you cannot distribute that APK.
0

I was facing the same issue, as per the documentations and lots of googling, i fixed it. here is how: Tools: OS : Windows

  • Java Version : java version "22" 2024-03-19
  • Android SDK : android-34
  • apktool : (2.9.3) https://apktool.org/
  • apksigner : (AppData\Local\Android\Sdk\build-tools\34.0.0)
  • zipalign : (AppData\Local\Android\Sdk\build-tools\34.0.0)
  • adb : (AppData\Local\Android\Sdk\platform-tools)
  • keytool : (%JAVA_HOME%\bin)

Steps:

  • Apktool decompile apk :

apktool d <app_name>.apk

  • Modify your application by editing smali code.
  • Apktool recompile (you will find compiled app in <app_folder_name>/dist):

apktool b <app_folder_name>

  • Generate certificate :

keytool -genkey -V -keystore <key_name>.keystore -alias <keystore_alias> -keyalg RSA -keysize 2048 -validity 10000

  • Use zipalign :

zipalign -v 4 "<path_to_apk><app_name>.apk" "<path_to_apk><app_name>-aligned.apk"

  • sign using apksigner :

apksigner sign --ks-key-alias <keystore_alias> --ks "<path_to_keystore><key_name>.keystore" "<path_to_app_apk><app_name>-aligned.apk"

  • Install Apk in Virtual Device or your can install it in your real device (optional) :

adb install <app_name>-aligned.apk

Note : Earlier, I was using recompile >> jarsigner >> zipalign, but it didn't worked for me.

(Optional) : In real device, while installing if "Google play protection" asks you to scan the app before installation, just expand it and select "Install without scan".

I hope this solution help to fix this issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.