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

Split-apks build script is only generating one target which is not compatible with the device architecture. #290

Open
jkelleyrtp opened this issue Mar 15, 2024 · 1 comment

Comments

@jkelleyrtp
Copy link

Describe the bug

cargo mobile init // use the wry template
cargo android build
cargo android open
// run using the simulator

03/15 14:48:59: Launching 'app' on Pixel 6 API 34.
The currently selected variant "armDebug" uses split APKs, but none of the 1 split apks are compatible with the current device with ABIs "arm64-v8a".

If I reduce the rust plugin build targets down to just the arm64-v8a in RustPlugin.kt, then it works.

I'm sure we don't want that to be the fix - I think the issue is that the build script is only generating one split apk or it's generating the wrong one for the target platform.

From what I can tell, it's trying to use the "armeabi-v7a" arch which is why this is failing, so it might be down to selection.

I think we can fix this by getting RustPlugin.kt to select the right platform for the target simulator/device.

Screenshots
Screenshot 2024-03-15 at 2 49 26 PM

Platform and Versions (please complete the following information):
Host OS: macos
Target OS: android
Rustc: 1.76
Ouput of cargo mobile doctor:

❯ cargo mobile doctor

[✔] cargo-mobile v0.10.4
    • Contains commits up to "fix(deps): update rust crate heck to 0.5 (#287)\n"
    • Installed at "~/.cargo/.cargo-mobile2"
    • macOS v14.3.1 (23D60)
    • rustc v1.76.0 (07dca489a 2024-2-4)

[✔] Apple developer tools
    • Xcode v15.2
    • Active developer dir: "/Applications/Xcode.app/Contents/Developer"
    • ios-deploy v1.12.0
    • XcodeGen v2.38.0
    • xcode-rust-plugin plugin present
    ✗ xcode-rust-plugin lang spec absent
    ✗ xcode-rust-plugin lang metadata absent
    • xcode-rust-plugin is up-to-date
    ✗ xcode-rust-plugin doesn't support Xcode UUID "EB2858C6-D4A9-4096-9AA3-BB5872AE7EF9"
    • Development team: Ronald Kelley (34U4FG9TJ8)

[✔] Android developer tools
    • SDK v26.1.1 installed at "~/Library/Android/sdk"
    • NDK v25.2.9519653 installed at "~/Library/Android/sdk/ndk/25.2.9519653"

[✔] Connected devices
    • Jon’s iPhone (2) (iPhone16,2)
    • Pixel_6_API_34 (sdk_gphone64_arm64)
@jkelleyrtp
Copy link
Author

jkelleyrtp commented Mar 15, 2024

https://stackoverflow.com/a/43742161

Here's an SO answer that fixes it - I think the fact that android studio defaults to arm instead of arm64 on mac is causing the issue.

We can set a default one, but the default behavior is to choose the first option alphabetically.

https://stackoverflow.com/questions/17656826/what-product-flavor-does-android-studio-build-by-default-in-build-gradle

However, I'm not sure we want the glue to generate different plugin code.

Ideally we want to generate arm64 as the default since most android devices run arm64 these days, however there are many x86 users out there that don't want to run under emulation.

We could set the default to be based on the user's OS target, but really it should be building for whatever simulator they have running...

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

1 participant