tauri-apps/cargo-mobile2

Variable "android-app-dependencies-platform" not found in strict mode

konceptosociala opened this issue · 4 comments

Describe the bug
When I run cargo mobile init I get following error:

error: Android template processing failed
    Failed to render template at "/home/ks/.cargo/.tauri-mobile/templates/platforms/android-studio/app/build.gradle.kts.hbs": Failed to render template: Error rendering
    "Unnamed template" line 53, col 5: Variable "android-app-dependencies-platform" not found in strict mode.

And then using cargo android run and cargo android open I see following errors respectively:

error: Failed to assemble APK
    No such file or directory (os error 2)
    
    ...
    
    error: Failed to open project in Android Studio
    Launch failed: No such file or directory (os error 2)

Steps To Reproduce

  1. Install Android Studio Giraffe in /opt/android-studio
  2. Follow this tutorial for Linux (Ubuntu): https://github.com/tauri-apps/wry/blob/dev/MOBILE.md

Expected behavior
Application is initialized correctly

Screenshots
image

Platform and Versions (please complete the following information):
Host OS: Ubuntu 22.04
Target OS: Android 10.0
Rustc: 1.70.0
cargo mobile doctor:
(if you build with specific commit, please list it as well)

Getting the same error after following instructions here: https://github.com/tauri-apps/wry/blob/dev/MOBILE.md

Host OS: EndeavorOS (basically Arch), kernel version: 6.4.9-arch1-1. On an AMD system.
Target OS: Android 10
Rustc: 1.70.0 (90c541806 2023-05-31)

This or something similar also happens when building for iOS.
error: Xcode template processing failed

  Failed to render template at
   "/Users/jb/.cargo/.tauri-mobile/templates/platforms/xcode/projec
   t.yml.hbs": Failed to render template: Error rendering "Unnamed template"
   line 39, col 7: Variable "ios-additional-targets" not found in strict mode.

OS: macOS 13.4 arm64
Rust: rustc 1.71.0

is this broken now ?

is this broken now ?

Everything works!
Except there is a bug with indents in build.gradle.kts, line 23:

packaging {                
                                                                jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
                                                                                                                            jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
                                                            jniLibs.keepDebugSymbols.add("*/x86/*.so")
                                                                                                                                jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
            }

Instead of

packaging {                
    jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
    jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
    jniLibs.keepDebugSymbols.add("*/x86/*.so")
    jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
}

It is easy to fix manually, but it just refuses to compile. Thank you!