tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
85.78k stars 2.6k forks source link

[bug] [2.0] [Android] Unsafe app blocked #10727

Closed ishaan26 closed 3 months ago

ishaan26 commented 3 months ago

Describe the bug

I am getting an error stating that Unsafe app blocked on android as shown in the screenshot below: SC1

When I install the app anyways, i get the following warning: WhatsApp Image 2024-08-22 at 00 28 03

Also for some reason, the css of the <input> element in html in not working.

Following is the terminal output:


  pnpm run tauri android dev

> tauri-app@0.1.0 tauri /Users/ishaangoel/Documents/Github/tests/tauri-app
> tauri "android" "dev"

    Info Detected connected device: SM-S908E with target "aarch64-linux-android"
    Running BeforeDevCommand (`pnpm dev`)

> tauri-app@0.1.0 dev /Users/ishaangoel/Documents/Github/tests/tauri-app
> vite dev

Forced re-optimization of dependencies

  VITE v5.4.2  ready in 839 ms

  ➜  Local:   http://localhost:1420/
    Info detected host target triple "aarch64-apple-darwin"
    Updating crates.io index
     Locking 434 packages to latest compatible versions
      Adding addr2line v0.22.0 (latest: v0.24.1)
      Adding base64 v0.21.7 (latest: v0.22.1)
      Adding bitflags v1.3.2 (latest: v2.6.0)
      Adding cairo-rs v0.18.5 (latest: v0.20.1)
      Adding cairo-sys-rs v0.18.2 (latest: v0.20.0)
      Adding cargo_toml v0.17.2 (latest: v0.20.4)
      Adding cfb v0.7.3 (latest: v0.10.0)
      Adding cfg-expr v0.15.8 (latest: v0.16.0)
      Adding convert_case v0.4.0 (latest: v0.6.0)
      Adding core-foundation v0.9.4 (latest: v0.10.0)
      Adding core-graphics v0.23.2 (latest: v0.24.0)
      Adding core-graphics-types v0.1.3 (latest: v0.2.0)
      Adding cssparser v0.27.2 (latest: v0.34.0)
      Adding derive_more v0.99.18 (latest: v1.0.0)
      Adding fluent-uri v0.1.4 (latest: v0.2.0)
      Adding gdk-pixbuf v0.18.5 (latest: v0.20.1)
      Adding gdk-pixbuf-sys v0.18.0 (latest: v0.20.1)
      Adding generator v0.7.5 (latest: v0.8.2)
      Adding generic-array v0.14.7 (latest: v1.1.0)
      Adding getrandom v0.1.16 (latest: v0.2.15)
      Adding gimli v0.29.0 (latest: v0.31.0)
      Adding gio v0.18.4 (latest: v0.20.1)
      Adding gio-sys v0.18.1 (latest: v0.20.1)
      Adding glib v0.18.5 (latest: v0.20.1)
      Adding glib-macros v0.18.5 (latest: v0.20.1)
      Adding glib-sys v0.18.1 (latest: v0.20.1)
      Adding gobject-sys v0.18.0 (latest: v0.20.1)
      Adding hashbrown v0.12.3 (latest: v0.14.5)
      Adding heck v0.4.1 (latest: v0.5.0)
      Adding hermit-abi v0.3.9 (latest: v0.4.0)
      Adding html5ever v0.26.0 (latest: v0.28.0)
      Adding idna v0.5.0 (latest: v1.0.2)
      Adding indexmap v1.9.3 (latest: v2.4.0)
      Adding infer v0.15.0 (latest: v0.16.0)
      Adding itoa v0.4.8 (latest: v1.0.11)
      Adding jni-sys v0.3.0 (latest: v0.4.0)
      Adding jsonptr v0.4.7 (latest: v0.6.0)
      Adding libloading v0.7.4 (latest: v0.8.5)
      Adding loom v0.5.6 (latest: v0.7.2)
      Adding malloc_buf v0.0.6 (latest: v1.0.0)
      Adding markup5ever v0.11.0 (latest: v0.13.0)
      Adding matchers v0.1.0 (latest: v0.2.0)
      Adding miniz_oxide v0.7.4 (latest: v0.8.0)
      Adding nu-ansi-term v0.46.0 (latest: v0.50.1)
      Adding pango v0.18.3 (latest: v0.20.1)
      Adding pango-sys v0.18.0 (latest: v0.20.1)
      Adding phf v0.8.0 (latest: v0.11.2)
      Adding phf v0.10.1 (latest: v0.11.2)
      Adding phf_codegen v0.8.0 (latest: v0.11.2)
      Adding phf_codegen v0.10.0 (latest: v0.11.2)
      Adding phf_generator v0.8.0 (latest: v0.11.2)
      Adding phf_generator v0.10.0 (latest: v0.11.2)
      Adding phf_macros v0.8.0 (latest: v0.11.2)
      Adding phf_shared v0.8.0 (latest: v0.11.2)
      Adding phf_shared v0.10.0 (latest: v0.11.2)
      Adding proc-macro-crate v1.3.1 (latest: v3.1.0)
      Adding proc-macro-crate v2.0.2 (latest: v3.1.0)
      Adding quick-xml v0.32.0 (latest: v0.36.1)
      Adding rand v0.7.3 (latest: v0.8.5)
      Adding rand_chacha v0.2.2 (latest: v0.3.1)
      Adding rand_core v0.5.1 (latest: v0.6.4)
      Adding rand_hc v0.2.0 (latest: v0.3.2)
      Adding rand_pcg v0.2.1 (latest: v0.3.1)
      Adding regex-automata v0.1.10 (latest: v0.4.7)
      Adding regex-syntax v0.6.29 (latest: v0.8.4)
      Adding selectors v0.22.0 (latest: v0.25.0)
      Adding serialize-to-javascript v0.1.1 (latest: v0.1.2)
      Adding serialize-to-javascript-impl v0.1.1 (latest: v0.1.2)
      Adding servo_arc v0.1.1 (latest: v0.3.0)
      Adding siphasher v0.3.11 (latest: v1.0.1)
      Adding soup3 v0.5.0 (latest: v0.7.0)
      Adding soup3-sys v0.5.0 (latest: v0.7.0)
      Adding syn v1.0.109 (latest: v2.0.75)
      Adding system-deps v6.2.2 (latest: v7.0.2)
      Adding toml v0.7.8 (latest: v0.8.19)
      Adding toml v0.8.2 (latest: v0.8.19)
      Adding toml_datetime v0.6.3 (latest: v0.6.8)
      Adding toml_edit v0.19.15 (latest: v0.22.20)
      Adding toml_edit v0.20.2 (latest: v0.22.20)
      Adding tower v0.4.13 (latest: v0.5.0)
      Adding urlpattern v0.2.0 (latest: v0.3.0)
      Adding wasi v0.9.0+wasi-snapshot-preview1 (latest: v0.13.2+wasi-0.2.1)
      Adding wasi v0.11.0+wasi-snapshot-preview1 (latest: v0.13.2+wasi-0.2.1)
      Adding windows v0.48.0 (latest: v0.58.0)
      Adding windows-core v0.52.0 (latest: v0.58.0)
      Adding windows-sys v0.45.0 (latest: v0.59.0)
      Adding windows-sys v0.48.0 (latest: v0.59.0)
      Adding windows-sys v0.52.0 (latest: v0.59.0)
      Adding windows-targets v0.42.2 (latest: v0.52.6)
      Adding windows-targets v0.48.5 (latest: v0.52.6)
      Adding windows_aarch64_gnullvm v0.42.2 (latest: v0.52.6)
      Adding windows_aarch64_gnullvm v0.48.5 (latest: v0.52.6)
      Adding windows_aarch64_msvc v0.42.2 (latest: v0.52.6)
      Adding windows_aarch64_msvc v0.48.5 (latest: v0.52.6)
      Adding windows_i686_gnu v0.42.2 (latest: v0.52.6)
      Adding windows_i686_gnu v0.48.5 (latest: v0.52.6)
      Adding windows_i686_msvc v0.42.2 (latest: v0.52.6)
      Adding windows_i686_msvc v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_gnu v0.42.2 (latest: v0.52.6)
      Adding windows_x86_64_gnu v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_gnullvm v0.42.2 (latest: v0.52.6)
      Adding windows_x86_64_gnullvm v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_msvc v0.42.2 (latest: v0.52.6)
      Adding windows_x86_64_msvc v0.48.5 (latest: v0.52.6)
      Adding winnow v0.5.40 (latest: v0.6.18)
   Compiling serde v1.0.208
   Compiling libc v0.2.158
   Compiling memchr v2.7.4
   Compiling cfg-if v1.0.0
   Compiling itoa v1.0.11
   Compiling siphasher v0.3.11
   Compiling once_cell v1.19.0
   Compiling smallvec v1.13.2
   Compiling log v0.4.22
   Compiling fnv v1.0.7
   Compiling parking_lot_core v0.9.10
   Compiling lock_api v0.4.12
   Compiling new_debug_unreachable v1.0.6
   Compiling scopeguard v1.2.0
   Compiling tinyvec_macros v0.1.1
   Compiling ryu v1.0.18
   Compiling tinyvec v1.8.0
   Compiling serde_json v1.0.125
   Compiling phf_shared v0.10.0
   Compiling thiserror v1.0.63
   Compiling mac v0.1.1
   Compiling pin-project-lite v0.2.14
   Compiling precomputed-hash v0.1.1
   Compiling byteorder v1.5.0
   Compiling futures-core v0.3.30
   Compiling percent-encoding v2.3.1
   Compiling futf v0.1.5
   Compiling form_urlencoded v1.2.1
   Compiling phf_shared v0.8.0
   Compiling typenum v1.17.0
   Compiling unicode-normalization v0.1.23
   Compiling parking_lot v0.12.3
   Compiling utf-8 v0.7.6
   Compiling dtoa v1.0.9
   Compiling unicode-bidi v0.3.15
   Compiling dtoa-short v0.3.5
   Compiling tendril v0.4.3
   Compiling slab v0.4.9
   Compiling phf v0.8.0
   Compiling phf v0.10.1
   Compiling generic-array v0.14.7
   Compiling idna v0.5.0
   Compiling markup5ever v0.11.0
   Compiling cssparser v0.27.2
   Compiling itoa v0.4.8
   Compiling jni-sys v0.3.0
   Compiling stable_deref_trait v1.2.0
   Compiling matches v0.1.10
   Compiling nodrop v0.1.14
   Compiling indexmap v1.9.3
   Compiling servo_arc v0.1.1
   Compiling fxhash v0.2.1
   Compiling mio v1.0.2
   Compiling socket2 v0.5.7
   Compiling aho-corasick v1.1.3
   Compiling selectors v0.22.0
   Compiling bytes v1.7.1
   Compiling string_cache v0.8.7
   Compiling url v2.5.2
   Compiling html5ever v0.26.0
   Compiling typeid v1.0.2
   Compiling http v1.1.0
   Compiling equivalent v1.0.1
   Compiling hashbrown v0.14.5
   Compiling hashbrown v0.12.3
   Compiling unic-common v0.9.0
   Compiling unic-char-range v0.9.0
   Compiling alloc-no-stdlib v2.0.4
   Compiling pin-utils v0.1.0
   Compiling thin-slice v0.1.1
   Compiling bitflags v1.3.2
   Compiling futures-task v0.3.30
   Compiling regex-syntax v0.8.4
   Compiling crossbeam-utils v0.8.20
   Compiling indexmap v2.4.0
   Compiling futures-util v0.3.30
   Compiling alloc-stdlib v0.2.2
   Compiling unic-char-property v0.9.0
   Compiling unic-ucd-version v0.9.0
   Compiling combine v4.6.7
   Compiling tokio v1.39.3
   Compiling toml_datetime v0.6.3
   Compiling serde_spanned v0.6.7
   Compiling winnow v0.5.40
   Compiling cesu8 v1.1.0
   Compiling uuid v1.10.0
   Compiling raw-window-handle v0.6.2
   Compiling semver v1.0.23
   Compiling httparse v1.9.4
   Compiling cfb v0.7.3
   Compiling kuchikiki v0.8.2
   Compiling num_enum v0.7.3
   Compiling regex-automata v0.4.7
   Compiling erased-serde v0.4.5
   Compiling unic-ucd-ident v0.9.0
   Compiling brotli-decompressor v4.0.1
   Compiling toml_edit v0.20.2
   Compiling http-body v1.0.1
   Compiling jsonptr v0.4.7
   Compiling dpi v0.1.1
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling ndk-sys v0.6.0+11769913
   Compiling phf_shared v0.11.2
   Compiling try-lock v0.2.5
   Compiling same-file v1.0.6
   Compiling bitflags v2.6.0
   Compiling want v0.3.1
   Compiling walkdir v2.5.0
   Compiling pin-project v1.1.5
   Compiling phf v0.11.2
   Compiling regex v1.10.6
   Compiling digest v0.10.7
   Compiling brotli v6.0.0
   Compiling urlpattern v0.2.0
   Compiling ndk v0.9.0
   Compiling toml v0.8.2
   Compiling jni v0.21.1
   Compiling json-patch v2.0.0
   Compiling crossbeam-channel v0.5.13
   Compiling serde-untagged v0.1.6
   Compiling infer v0.15.0
   Compiling serde_with v3.9.0
   Compiling cpufeatures v0.2.13
   Compiling futures-channel v0.3.30
   Compiling tracing-core v0.1.32
   Compiling dunce v1.0.5
   Compiling tower-service v0.3.3
   Compiling tower-layer v0.3.3
   Compiling base64 v0.22.1
   Compiling glob v0.3.1
   Compiling tower v0.4.13
   Compiling tracing v0.1.40
   Compiling tauri-runtime v2.0.0-rc.5
   Compiling wry v0.42.0
   Compiling hyper v1.4.1
   Compiling sha2 v0.10.8
   Compiling tauri v2.0.0-rc.5
   Compiling instant v0.1.13
   Compiling futures-sink v0.3.30
   Compiling ndk-context v0.1.1
   Compiling lazy_static v1.5.0
   Compiling option-ext v0.2.0
   Compiling tao v0.29.1
   Compiling tauri-runtime-wry v2.0.0-rc.5
   Compiling tauri-utils v2.0.0-rc.5
   Compiling dirs-sys v0.4.1
   Compiling tokio-util v0.7.11
   Compiling http-body-util v0.1.2
   Compiling hyper-util v0.1.7
   Compiling serde_urlencoded v0.7.1
   Compiling sync_wrapper v1.0.1
   Compiling anyhow v1.0.86
   Compiling is-docker v0.2.0
   Compiling mime v0.3.17
   Compiling ipnet v2.9.0
   Compiling schemars v0.8.21
   Compiling serialize-to-javascript v0.1.1
   Compiling reqwest v0.12.7
   Compiling is-wsl v0.4.0
   Compiling tauri-plugin-shell v2.0.0-rc.2
   Compiling dirs v5.0.1
   Compiling getrandom v0.2.15
   Compiling heck v0.5.0
   Compiling dyn-clone v1.0.17
   Compiling pathdiff v0.2.1
   Compiling state v0.6.0
   Compiling open v5.3.0
   Compiling tauri-app v0.1.0 (/Users/ishaangoel/Documents/Github/tests/tauri-app/src-tauri)
   Compiling shared_child v1.0.1
   Compiling os_pipe v1.2.1
   Compiling encoding_rs v0.8.34
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 46.78s
    Info symlinking lib "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" in jniLibs dir "/Users/ishaangoel/Documents/Github/tests/tauri-app/src-tauri/gen/android/app/src/main/jniLibs/arm64-v8a"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "libandroid.so"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "libdl.so"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "liblog.so"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "libm.so"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "libc.so"
    Info symlink at "/Users/ishaangoel/Documents/Github/tests/tauri-app/src-tauri/gen/android/app/src/main/jniLibs/arm64-v8a/libtauri_app_lib.so" points to "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so"

> tauri-app@0.1.0 tauri /Users/ishaangoel/Documents/Github/tests/tauri-app
> tauri "android" "android-studio-script" "--target" "aarch64"

<========-----> 62% EXECUTING [9s]
w: file:///Users/ishaangoel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-rc.5/mobile/android/src/main/java/app/tauri/plugin/PluginMethodData.kt:11:23 Parameter 'methodDecorator' is never used
    Info Forwarding port 1420 with adb
adb: error: listener 'tcp:1420' not found
1420
   Compiling ring v0.17.8TING [13s]
   Compiling rustls-pki-types v1.8.0
   Compiling untrusted v0.9.0
   Compiling spin v0.9.8uge_addr=127.0.0.1:60280 conn_id=0
   Compiling subtle v2.6.1
   Compiling zeroize v1.8.1
   Compiling wry v0.42.0
   Compiling tauri v2.0.0-rc.5
   Compiling webpki-roots v0.26.3s]
   Compiling rustls-pemfile v2.1.3
   Compiling tauri-plugin-shell v2.0.0-rc.2
   Compiling tauri-runtime-wry v2.0.0-rc.5
   Compiling tauri-app v0.1.0 (/Users/ishaangoel/Documents/Github/tests/tauri-app/src-tauri)
   Compiling rustls v0.23.12G [15s]
   Compiling rustls-webpki v0.102.6
   Compiling tokio-rustls v0.26.0s]
   Compiling hyper-rustls v0.27.2s]
   Compiling reqwest v0.12.7G [18s]
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 16.43s
    Info symlinking lib "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" in jniLibs dir "/Users/ishaangoel/Documents/Github/tests/tauri-app/src-tauri/gen/android/app/src/main/jniLibs/arm64-v8a"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "libandroid.so"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "libdl.so"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "liblog.so"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "libm.so"
    Info "/Users/ishaangoel/.cargo/target_dump/aarch64-linux-android/debug/libtauri_app_lib.so" requires shared lib "libc.so"
Performing Streamed Install
Success
Starting: Intent { cmp=com.tauri.app/.MainActivity }

Reproduction

cargo create-tauri-app --rc
 cd tauri-app
 pnpm install
 pnpm tauri android init
 pnpm tauri ios init
pnpm run tauri android dev

Expected behavior

There should be no such warning in the app. css for input tag should work.

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.6.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
    ✔ cargo: 1.80.1 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.16.0
    - pnpm: 9.7.1
    - yarn: 1.22.22
    - npm: 10.8.2
    - bun: 1.1.25

[-] Packages
    - tauri [RUST]: 2.0.0-rc.5
    - tauri-build [RUST]: 2.0.0-rc.5
    - wry [RUST]: 0.42.0
    - tao [RUST]: 0.29.1
    - tauri-cli [RUST]: 2.0.0-rc.6
    - @tauri-apps/api [NPM]: 2.0.0-rc.2
    - @tauri-apps/cli [NPM]: 2.0.0-rc.6

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

[-] iOS
    - Developer Teams: Ishaan Goel (ID: XXXXXXXX)

Stack trace

No response

Additional context

Simlar warnings do not appear for macOS or ios.

Tested on unmodified template provided by cargo create-tauri-app --rc. I have tested this using React, Svelte, Yew and Vue templates on Samsung Galaxy S22 ultra and Oneplus nord with lineage os. I have gotten this error every single time. It believe this error stated when tauri got updated to rc.4. It was working perfectly on and before rc.3. My Android SDK platform and other tools as suggested in tauri documentation. Using MacOS 14 on M2 macbook air.

ishaan26 commented 3 months ago

Similar to #10712. But then my css is not working :/

oddpxl commented 3 months ago

I also have this problem - both with old and new projects.

ishaan26 commented 3 months ago

Adding targetSdk = 34 to src-tauri/gen/android/app/build.gradle.kts -> android { defaultConfig { ... } } fixes the issue (including css) as mentioned in https://github.com/tauri-apps/tauri/issues/10712. Thanks @louis993546!

Closing this thread as #10712 is already open.