apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.59k stars 1.52k forks source link

Error 'App not Installed' use --packageType=apk flag #1387

Closed eviv3k closed 2 years ago

eviv3k commented 2 years ago

Bug Report

Problem

If use cordova build android --release -- --packageType=apk then an apk file is generated. (when cordova-android is 10.x)

I get the error message "App not installed" when I try to install the .apk. It runs fine (download the APK from the play store).

What is expected to happen?

The --packageType=apk flag should control an apk file is generated. I get the error message "App not installed".

What does actually happen?

The --packageType=apk flag should control an apk file is generated. I need to test a release build.

Information

Command or Code

cordova build android --release -- --packageType=apk

Environment, Platform, Device

Only happens when cordova-android is version 10 or higher

Version information

Cordova CLI: 10.0.0 Cordova Platforms: android 10.1.0 Android SDK Tools : 30.0.3 NodeJS : v14.16.1 npm : 6.14.12 OS : Window

Checklist

JLWINC commented 2 years ago

+1 same error , do you find any solution ?

JLWINC commented 2 years ago

@eviv3k do you find any solution ?

breautek commented 2 years ago

There seems to be some kind of disconnect. cordova build... responsibility is build a distributable binary in either a form of a bundle or apk. Which it sounds like it's doing successfully.

"App not installed"

What is showing this error message and what is being done leading up to this error message? (e.g. are you using adb or cordova run or some other method of installing the apk?)

dpchami commented 2 years ago

same problem happen to me Any solution available?

eviv3k commented 2 years ago

@JLWINC @dpchami The complete way we had to do:

  1. Download bundletool-all-1.8.2.jar from this link, download the latest version available.

  2. Create an app bundle using cordova cordova build android --prod --release

  3. Copy the bundletool jar to some location and get its path. In my case its C:\Users\eviv3k\Desktop\bundletool-all-1.8.2.jar

  4. Use this command: java -jar "BUNDLE_TOOL_JAR_PATH" build-apks --mode=universal --bundle="BUNDLE_PATH" --output=YOUR_OUTPUT_NAME.apks In my case it will be java -jar "C:\Users\eviv3k\Desktop\bundletool-all-1.8.2.jar" build-apks --mode=universal --bundle="C:\Users\eviv3k\Desktop\app-release.aab" --output="C:\Users\eviv3k\Desktop\my_app.apks" --ks="D:\Works\certificates\my-release-key.keystore" --ks-key-alias=alias_name"

  5. This will create a file my_app.apks, rename it to .zip my_app.zip, extract this file, and done You will have universal.apk.

gmalignon commented 2 years ago

Thank you so much!!! I was trying to figure out for hours why APKs generated were not working any more. This really saved me, it works!!!

breautek commented 2 years ago

OS : Window

On windows, particularly with powershell, instead of

cordova build android --release -- --packageType=apk

You need to wrap the intermediate -- in quotations, like so:

cordova build android --release "--" --packageType=apk

Closing this issue cause I don't believe this is an actual bug.

mkurzweil commented 2 years ago

works also for mac user: cordova build android --release "--" --packageType=apk

rajiv-eulogik commented 1 year ago

@JLWINC @dpchami The complete way we had to do:

  1. Download bundletool-all-1.8.2.jar from this link, download the latest version available.
  2. Create an app bundle using cordova cordova build android --prod --release
  3. Copy the bundletool jar to some location and get its path. In my case its C:\Users\eviv3k\Desktop\bundletool-all-1.8.2.jar
  4. Use this command: java -jar "BUNDLE_TOOL_JAR_PATH" build-apks --mode=universal --bundle="BUNDLE_PATH" --output=YOUR_OUTPUT_NAME.apks In my case it will be java -jar "C:\Users\eviv3k\Desktop\bundletool-all-1.8.2.jar" build-apks --mode=universal --bundle="C:\Users\eviv3k\Desktop\app-release.aab" --output="C:\Users\eviv3k\Desktop\my_app.apks" --ks="D:\Works\certificates\my-release-key.keystore" --ks-key-alias=alias_name"
  5. This will create a file my_app.apks, rename it to .zip my_app.zip, extract this file, and done You will have universal.apk.

This one works, above all didn't work for me. May be some cli issue.

baesumin commented 6 months ago

@JLWINC @dpchami 우리가 해야 할 완전한 방법은 다음과 같습니다.

  1. 이 링크bundletool-all-1.8.2.jar 에서 다운로드하고 사용 가능한 최신 버전을 다운로드하세요.
  2. Cordova를 사용하여 App Bundle 만들기cordova build android --prod --release
  3. Bundletool jar를 특정 위치에 복사하고 해당 경로를 가져옵니다. 내 경우에는C:\Users\eviv3k\Desktop\bundletool-all-1.8.2.jar
  4. 다음 명령을 사용하세요. java -jar "BUNDLE_TOOL_JAR_PATH" build-apks --mode=universal --bundle="BUNDLE_PATH" --output=YOUR_OUTPUT_NAME.apks제 경우에는java -jar "C:\Users\eviv3k\Desktop\bundletool-all-1.8.2.jar" build-apks --mode=universal --bundle="C:\Users\eviv3k\Desktop\app-release.aab" --output="C:\Users\eviv3k\Desktop\my_app.apks" --ks="D:\Works\certificates\my-release-key.keystore" --ks-key-alias=alias_name"
  5. 이렇게 하면 파일이 생성되고 my_app.apks이름이 .zip으로 바뀌며 my_app.zip이 파일의 압축이 풀리고 완료됩니다 universal.apk.

you save my life

ParisMichael commented 3 months ago

You saved my life too!!! A million thanks a million :)

TotomisPanos commented 3 months ago

@JLWINC @dpchami The complete way we had to do:

  1. Download bundletool-all-1.8.2.jar from this link, download the latest version available.
  2. Create an app bundle using cordova cordova build android --prod --release
  3. Copy the bundletool jar to some location and get its path. In my case its C:\Users\eviv3k\Desktop\bundletool-all-1.8.2.jar
  4. Use this command: java -jar "BUNDLE_TOOL_JAR_PATH" build-apks --mode=universal --bundle="BUNDLE_PATH" --output=YOUR_OUTPUT_NAME.apks In my case it will be java -jar "C:\Users\eviv3k\Desktop\bundletool-all-1.8.2.jar" build-apks --mode=universal --bundle="C:\Users\eviv3k\Desktop\app-release.aab" --output="C:\Users\eviv3k\Desktop\my_app.apks" --ks="D:\Works\certificates\my-release-key.keystore" --ks-key-alias=alias_name"
  5. This will create a file my_app.apks, rename it to .zip my_app.zip, extract this file, and done You will have universal.apk.

Bump! This fixed it! Works great