ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.22k stars 1.01k forks source link

bug: apk cannot be installed #6737

Closed zdu-strong closed 1 year ago

zdu-strong commented 1 year ago

Bug Report

Capacitor Version

version

Platform(s)

android

Current Behavior

InstallFailed

Expected Behavior

apk installed successfully.

Code Reproduction

Git Repository: https://github.com/zdu-strong/temp-capacitor Run Command: npm run make Generated apk: https://github.com/zdu-strong/temp-apk/blob/master/app-release-signed.apk

Other Technical Details

npm --version output: 9.8.0 node --version output: v18.16.1 Windows System Info output: windows Android Studio Info output: Android Studio

tiga05 commented 1 year ago

You should have a look in the android logs for a more specific reason. Most of the time the reason for not being able to install an app is written down there.

Use adb logcat or the log window of Android Studio (which is also just adb logcat) to track down the issue.

zdu-strong commented 1 year ago

I'm sorry, I can't understand the log, and there are too many logs.

In my main repository, with the same code, use android studio to build the apk, install and use, everything work fine. I'm looking forward to using command line packaging, it's easier and faster.

tiga05 commented 1 year ago

2023-07-18 18:15:24.115 1090-8993 ActivityTaskManager system_process I START u0 {act=android.intent.action.VIEW dat=content://com.android.externalstorage.documents/document/primary:app-release-signed.apk typ=application/vnd.android.package-archive flg=0x23000003 cmp=com.google.android.packageinstaller/com.android.packageinstaller.InstallStart} from uid 10104 2023-07-18 18:15:24.120 605-605 android.ha...ervice-qti android.hardware.power-service-qti I Power setMode: 5 to: 1 2023-07-18 18:15:24.135 1090-17315 ActivityTaskManager system_process W Tried to set launchTime (0) < mLastActivityLaunchTime (220982849) 2023-07-18 18:15:24.154 1090-17315 ActivityTaskManager system_process I START u0 {act=android.intent.action.VIEW dat=content://com.android.externalstorage.documents/document/primary:app-release-signed.apk typ=application/vnd.android.package-archive flg=0x2000000 cmp=com.google.android.packageinstaller/com.android.packageinstaller.InstallStaging (has extras)} from uid 10103 2023-07-18 18:15:24.165 1090-17315 ActivityTaskManager system_process W Tried to set launchTime (0) < mLastActivityLaunchTime (221061878) 2023-07-18 18:15:24.156 605-605 android.ha...ervice-qti android.hardware.power-service-qti I Power setMode: 5 to: 1 2023-07-18 18:15:24.247 1090-1270 ActivityTaskManager system_process I Displayed com.google.android.packageinstaller/com.android.packageinstaller.InstallStaging: +125ms 2023-07-18 18:15:24.247 1090-17315 ActivityTaskManager system_process I START u0 {act=android.intent.action.VIEW dat=file:///data/user_de/0/com.google.android.packageinstaller/no_backup/package7854099423873161284.apk flg=0x2010000 cmp=com.google.android.packageinstaller/com.android.packageinstaller.DeleteStagedFileOnResult (has extras)} from uid 10103 2023-07-18 18:15:24.249 605-605 android.ha...ervice-qti android.hardware.power-service-qti I Power setMode: 5 to: 1 2023-07-18 18:15:24.265 1090-17315 ActivityTaskManager system_process W Tried to set launchTime (0) < mLastActivityLaunchTime (221061908) 2023-07-18 18:15:24.280 1090-2868 ActivityTaskManager system_process I START u0 {act=android.intent.action.VIEW dat=file:///data/user_de/0/com.google.android.packageinstaller/no_backup/package7854099423873161284.apk flg=0x10000 cmp=com.google.android.packageinstaller/com.android.packageinstaller.PackageInstallerActivity (has extras)} from uid 10103 2023-07-18 18:15:24.317 1090-2868 ActivityTaskManager system_process W Tried to set launchTime (0) < mLastActivityLaunchTime (221062008) 2023-07-18 18:15:24.282 605-605 android.ha...ervice-qti android.hardware.power-service-qti I Power setMode: 5 to: 1 2023-07-18 18:15:24.348 17944-17944 PackageInstaller com.google.android.packageinstaller W Parse error when parsing manifest. Discontinuing installation 2023-07-18 18:15:24.412 1090-1270 ActivityTaskManager system_process I Displayed com.google.android.packageinstaller/com.android.packageinstaller.PackageInstallerActivity: +160ms

For me it looks like your apk is broken somehow. This is what the marked lines says. But I can not build your project. On the other side: you should really find out how to read android logfiles. And the internet says to this message: you are maybe signing your apk wrong. Is the debug version working?

On the other side: I dont think its related to Capacitor.

zdu-strong commented 1 year ago

Thanks for your help.

Has anyone ever used "npx cap build" to get an apk that works on android 13? This command has never worked for me, and I'm not sure it works.

build

zdu-strong commented 1 year ago

I will try to build apk using other way.

ionitron-bot[bot] commented 1 year ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.