tauri-apps / cargo-mobile2

Rust on mobile made easy!
Apache License 2.0
1.57k stars 73 forks source link

bug android template #360

Closed Liberations closed 2 weeks ago

Liberations commented 3 weeks ago

Describe the bug cargo mobile init missing too many file

Steps To Reproduce cargo mobile init

fund only a MainActivity.kt file in my app folder

Screenshots QQ_1723805152390 QQ_1723805213167

cargo android run
 (V2243A) with target "aarch64-linux-android"
   Compiling zerocopy-derive v0.7.35
   Compiling serde_derive v1.0.208
   Compiling cssparser v0.27.2
   Compiling thiserror-impl v1.0.63
   Compiling cssparser-macros v0.6.1
   Compiling html5ever v0.26.0
   Compiling derive_more v0.99.18
   Compiling regex v1.10.6
   Compiling tao-macros v0.1.2
   Compiling anyhow v1.0.86
   Compiling paste v1.0.15
   Compiling http v0.2.12
   Compiling sha2 v0.10.8TING [4s]
   Compiling url v2.5.2CUTING [4s]
   Compiling env_logger v0.10.25s]
   Compiling wry v0.37.0UTING [6s]
error: failed to run custom build command for `wry v0.37.0`

Caused by:
  process didn't exit successfully: `D:\tauri\a\target\debug\build\wry-a64b02ec26971436\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=WRY_ANDROID_PACKAGE
  cargo:rerun-if-env-changed=WRY_ANDROID_LIBRARY
  cargo:rerun-if-env-changed=WRY_ANDROID_KOTLIN_FILES_OUT_DIR

  --- stderr
  thread 'main' panicked at C:\Users\Administrator\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wry-0.37.0\build.rs:37:11:
  Failed to canonicalize `WRY_ANDROID_KOTLIN_FILES_OUT_DIR` path D:\tauri\a\gen\android/app/src/main/kotlin/com/example
  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",
    "a", "--manifest-path", "D:\\tauri\\a\\Cargo.toml", "--target",
    "aarch64-linux-android"] exited with code 101

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:rustBuildArm64Debug'.
> Process 'command 'cargo'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 15s
error: Failed to assemble APK
    command ["D:\\tauri\\a\\gen\\android\\gradlew.bat", "--project-dir", "D:\\tauri\\a\\gen\\android"] exited with code
 cargo mobile doctor

[✔] cargo-mobile v0.13.2
    • Contains commits up to "feat: Add a Dioxus template (#357)\n"
    • Installed at "C:\\Users\\Administrator\\.cargo\\.cargo-mobile2"
    • Windows 11 v10.0
    • rustc v1.80.1 (3f5fd8dd4 2024-8-6)

[✔] Android developer tools
    • SDK v26.1.1 installed at "D:\\Android\\sdk"
    • NDK v25.0.8775105 installed at "D:\\Android\\sdk\\ndk\\25.0.8775105"

[✔] Connected devices
 (V2243A)ia 5230

help~

gregpalaci commented 3 weeks ago
 % cargo mobile init
error: Config error
    Failed to load config: Failed to parse config file at /Users/carflow/Sites/
    taurimobile/mobile.toml: TOML parse error at line 1, column 1
      |
    1 | [app]
      | ^^^^^
    missing field `identifier`