Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apk can not be installed (INSTALL_FAILED_DEXOPT && manifest malformed) #414

Open
LuckyTurtleDev opened this issue Nov 21, 2023 · 7 comments

Comments

@LuckyTurtleDev
Copy link

LuckyTurtleDev commented Nov 21, 2023

I have try to run the example from the build instructions on android, but the generated apk file can not be installed on my phone.

I have build the apk with

sudo docker run --rm -v $(pwd)":/root/src" -w /root/src notfl3/cargo-apk cargo quad-apk build --release

The installation fails on both of my devices with different error messages.

Sony Xperia 10 III (XQ-BT52) (Android 13)

❯ adb install -r target/android-artifacts/release/apk/android-diashow.apk
Performing Incremental Install
Serving...
All files should be loaded. Notifying the device.
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl568843217.tmp/base.apk (at Binary XML file line #20): rust.android_diashow.MainActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]
Performing Streamed Install
adb: failed to install target/android-artifacts/release/apk/android-diashow.apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl2104543790.tmp/base.apk (at Binary XML file line #20): rust.android_diashow.MainActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]

Dell Venue 8 7840 (Android 5.1)

❯ adb install -r target/android-artifacts/release/apk/android-diashow.apk
Performing Push Install
target/android-artifacts/release/apk/android-diashow.apk: 1 file pushed, 0 skipped. 1905.6 MB/s (1123011 bytes in 0.001s)
	pkg: /data/local/tmp/android-diashow.apk
Failure [INSTALL_FAILED_DEXOPT]
@not-fl3
Copy link
Owner

not-fl3 commented Nov 22, 2023

Thanks for report!

android:exported really does need to be exported for newer androids :(

It should be implemented on quad-apk level, but right now you can put this in your Cargo.toml instead:

[package.metadata.android.activity_attributes]
"android:exported" =  "true"

@LuckyTurtleDev
Copy link
Author

This has fix, the issue for my Sony device. But I still need to find the old Dell device. What is the minimal supported android/sdk version?

@LuckyTurtleDev
Copy link
Author

Sadly this have not fix the issue with the Dell device. Since the minimal supported sdk seems to be 18 it should be supported.

@not-fl3
Copy link
Owner

not-fl3 commented Nov 22, 2023

Sadly this have not fix the issue with the Dell device. Since the minimal supported sdk seems to be 18 it should be supported.

might be a bug! feel free to upload all the logs etc, maybe someone have a solution

@LuckyTurtleDev LuckyTurtleDev changed the title apk can not be installed (manifest malformed) apk can not be installed (INSTALL_FAILED_DEXOPT && manifest malformed) Nov 23, 2023
@LuckyTurtleDev
Copy link
Author

LuckyTurtleDev commented Nov 23, 2023

Apparently this is caused by the DEX D8 compiler.
I have try various "solutions" found on the internet

  • increasing the min sdk version to 21 or above -> add min_sdk_version = 22 to cargo.toml
  • decreasing sdk version to lower 21 -> not yet tested
  • do not use adb install app -> installation fails: "app was not installed"
  • disable DEX D8 compiler by adding android.enableD8=false and android.enableD8.desugaring= false to gradle.properties -> I have no gradle?, so I am not sure how to disable DEX D8
  • delete build folder -> sudo rm -rf target
  • make sure enough storage is available -> currently more than 7gb are free

feel free to upload all the logs etc, maybe someone have a solution

How do I git additional logs?

current Cargo.toml

[package]
name = "android-diashow"
version = "0.1.0"
edition = "2021"

[dependencies]
macroquad = "0.4.4"

[profile.release]
strip = true

[package.metadata.android]
fullscreen = true
target_sdk_version = 19
min_sdk_version = 19

[package.metadata.android.activity_attributes]
"android:exported" =  "true"

@LuckyTurtleDev
Copy link
Author

LuckyTurtleDev commented Nov 23, 2023

I also can set min/target_sdk_version to 10.
This does compile, but rustc should only support 18 and newer?`.
So this values has probably no effect.

[package.metadata.android]
fullscreen = true
target_sdk_version = 10
min_sdk_version = 10

I can even set them to 40 and it does still compile.

@not-fl3
Copy link
Owner

not-fl3 commented Nov 23, 2023

disable DEX D8 compiler by adding android.enableD8=false and android.enableD8.desugaring= false to gradle.properties -> I have no gradle?, so I am not sure how to disable DEX D8

this is the place D8 is being called: https://github.com/not-fl3/cargo-quad-apk/blob/master/src/ops/build.rs#L274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants