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

WRY_ANDROID_KOTLIN_FILES_OUT_DIR issue on mobile_demo example #3068

Open
freedomtowin opened this issue Oct 17, 2024 · 0 comments
Open

WRY_ANDROID_KOTLIN_FILES_OUT_DIR issue on mobile_demo example #3068

freedomtowin opened this issue Oct 17, 2024 · 0 comments

Comments

@freedomtowin
Copy link

Problem
I've tried running the mobile example from both the DOC: https://dioxuslabs.com/learn/0.5/reference/mobile and the source Github Repo. The same error is shown for both.

--- stderr
thread 'main' panicked at C:\Users\rohan.cargo\registry\src\index.crates.io-6f17d22bba15001f\wry-0.43.1\build.rs:34:11:
Failed to canonicalize WRY_ANDROID_KOTLIN_FILES_OUT_DIR path C:\Users\rohan\dioxus\examples\mobile_demo\gen\android/app/src/main/kotlin/com/example/mobile_demo
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: Failed to compile lib
Failed to run cargo build`: command ["cargo", "build", "--package", "mobile-demo", "--manifest-path", "C:
\Users\rohan\dioxus\examples\mobile_demo\Cargo.toml", "--target", "aarch64-linux-android"] exited
with code 101

There was another error in the source Github repo related to the following, but I commented it out to focus on the build error.

packages/core/src/reactive_context.rs

            // If there is already an update queued, we don't need to queue another
            // if !tx.is_empty() {
            //     return;
            // }

commands:

  1. cargo mobile init
  2. cargo android build

Interestingly, if I remove the com. from the package names it will compile, but Android studio will complain that the package needs "."

Note that I'm very new to android dev and Rust for that matter.

Environment:

[package]
name = "mobile-demo"
version = "0.1.0"
authors = ["Jonathan Kelley <[email protected]>"]
edition = "2021"

[lib]
crate-type = ["staticlib", "cdylib", "rlib"]

[[bin]]
name = "mobile-demo-desktop"
path = "gen/bin/desktop.rs"

[package.metadata.cargo-android]
app-activity-name = "com.example.mobile_demo.MainActivity"
app-dependencies = [
    "androidx.webkit:webkit:1.6.1",
    "androidx.appcompat:appcompat:1.6.1",
    "com.google.android.material:material:1.8.0",
]
project-dependencies = ["org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"]
app-plugins = ["org.jetbrains.kotlin.android"]
app-permissions = ["android.permission.INTERNET"]
app-theme-parent = "Theme.MaterialComponents.DayNight.DarkActionBar"
vulkan-validation = false

[package.metadata.cargo-android.env-vars]
WRY_ANDROID_PACKAGE = "com.example.mobile_demo"
WRY_ANDROID_LIBRARY = "mobile_demo"
WRY_ANDROID_KOTLIN_FILES_OUT_DIR = "<android-project-dir>/app/src/main/kotlin/com/example/mobile_demo"

[package.metadata.cargo-apple.ios]
frameworks = ["WebKit"]

[dependencies]
anyhow = "1.0.56"
log = "0.4.11"
wry = "0.35.0"
dioxus = { path = "../../packages/dioxus", features = ["mobile"]}


[target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.9.0"
jni = "0.19.0"
paste = "1.0"

[target.'cfg(not(target_os = "android"))'.dependencies]
env_logger = "0.9.0"

[target.'cfg(target_os = "ios")'.dependencies]
core-foundation = "0.9.3"

I'm interested in fixing this myself but don't know where to start

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