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

Failed to compile for Android: Unresolved references in Gradle script #392

Closed
matthunz opened this issue Sep 18, 2024 · 0 comments · Fixed by #404
Closed

Failed to compile for Android: Unresolved references in Gradle script #392

matthunz opened this issue Sep 18, 2024 · 0 comments · Fixed by #404

Comments

@matthunz
Copy link
Contributor

Describe the bug
I've been getting this error for a little while now, but I'm not sure if it has to do with my SDK/JDK version 🤔 removing the lines with errors seems to solve this however.

FAILURE: Build failed with an exception.

* Where:
Build file '/home/matt/Documents/dev2/gen/android/app/build.gradle.kts' line: 42

* What went wrong:
Script compilation errors:

  Line 42:     kotlinOptions {
               ^ Unresolved reference: kotlinOptions

  Line 43:         jvmTarget = "1.8"
                   ^ Unresolved reference: jvmTarget

Steps To Reproduce
Create a new project with any template and run cargo android run.

Expected behavior
I think we can just remove those lines, doing so has fixed compilation for me on both platforms.

Platform and Versions (please complete the following information):
Host OS: MacOS Sequoia/Ubuntu 24.04.1 LTS
Target OS: Android 13
Rustc: rustc 1.81.0 (eeb90cda1 2024-09-04)

Ouput of cargo mobile doctor:

[✔] cargo-mobile v0.17.2
    • Contains commits up to ""
    • Installed at "~/.cargo/.cargo-mobile2"
    • Ubuntu v24.04.1 LTS (Noble Numbat
    • rustc v1.81.0 (eeb90cda1 2024-9-4)

[✔] Android developer tools
    • SDK v26.1.1 installed at "~/Android/Sdk"
    • NDK v27.1.12297006 installed at "~/Android/Sdk/ndk/27.1.12297006"

[✔] Connected devices
    • Pixel 6
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

Successfully merging a pull request may close this issue.

1 participant