tauri-apps / tauri

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

[bug] Android 9 Pie App Not Working After Build #8208

Closed smrza closed 8 months ago

smrza commented 8 months ago

Describe the bug

Using default alpha app create tauri-app@latest -- --alpha the resulting .apk fails to install on Android 9 Pie with API level 28. Running dev tauri android dev also fails in emulated device Android 9 Pie API level 28 (app shows white screen only). See error log below.

For reference tauri android dev works for emulated devices:

But does not work for emulated device:

/src-tauri/gen/android/app/build.gradle.kts set to: compileSdk = 33 minSdk = 24 targetSdk = 28

Reproduction

  1. yarn create tauri-app@latest -- --alpha
  2. prompt settings: TypeScript, yarn, React
  3. cd tauri-app
  4. yarn install
  5. yarn tauri android init
  6. in /src-tauri/gen/android/app/build.gradle.kts change targetSdk to 28
  7. create a device _API 28 x8664 in Virtual Device Manager of Android Studio
  8. yarn tauri android dev

Expected behavior

Platform and versions

[✔] Environment
    - OS: Ubuntu 22.04 X64
    ✔ webkit2gtk-4.1: 2.42.1
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.73.0 (cc66ad468 2023-10-03)
    ✔ cargo: 1.73.0 (9c4383fb5 2023-08-26)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 18.14.0
    - pnpm: 8.10.2
    - yarn: 1.22.19
    - npm: 9.3.1

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.17
    - tauri-build [RUST]: 2.0.0-alpha.11
    - wry [RUST]: 0.34.2
    - tao [RUST]: 0.23.0
    - tauri-cli [RUST]: 2.0.0-alpha.17
    - @tauri-apps/api [NPM]: 2.0.0-alpha.11
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.17

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

--------- beginning of main
11-10 13:03:08.752 13002 13002 I tauri.tauri_ap: Late-enabling -Xcheck:jni
11-10 13:03:08.823 13002 13002 W tauri.tauri_ap: Unexpected CPU variant for X86 using defaults: x86_64
11-10 13:03:09.512 13002 13002 W tauri.tauri_ap: Accessing hidden field Landroid/os/Trace;->TRACE_TAG_APP:J (light greylist, reflection)
11-10 13:03:09.512 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (light greylist, reflection)
11-10 13:03:09.739 13002 13002 W tauri.tauri_ap: Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
11-10 13:03:09.739 13002 13002 W tauri.tauri_ap: Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
11-10 13:03:09.739 13002 13002 W tauri.tauri_ap: Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
11-10 13:03:09.739 13002 13002 W tauri.tauri_ap: Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
11-10 13:03:09.817 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
11-10 13:03:09.818 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
11-10 13:03:09.909 13002 13062 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
11-10 13:03:09.909 13002 13062 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
11-10 13:03:09.909 13002 13062 I OpenGLRenderer: Initialized EGL, version 1.4
11-10 13:03:09.910 13002 13062 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
11-10 13:03:09.913 13002 13062 E eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
11-10 13:03:09.914 13002 13062 E eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
11-10 13:03:09.933 13002 13062 E eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1
11-10 13:03:09.954 13002 13002 I WebViewFactory: Loading com.android.chrome version 69.0.3497.100 (code 349710067)
11-10 13:03:09.966 13002 13002 I tauri.tauri_ap: The ClassLoaderContext is a special shared library.
11-10 13:03:10.100 13002 13002 I cr_LibraryLoader: Time to load native libraries: 2 ms (timestamps 687-689)
11-10 13:03:10.127 13002 13079 E cr_VariationsUtils: Failed reading seed file "/data/user/0/com.tauri.tauri_app/app_webview/variations_seed": /data/user/0/com.tauri.tauri_app/app_webview/variations_seed (No such file or directory)
11-10 13:03:10.525 13002 13002 I chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
11-10 13:03:10.525 13002 13054 I RustStdoutStderr: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
11-10 13:03:10.525 13002 13002 I cr_LibraryLoader: Expected native library version number "69.0.3497.100", actual native library version number "69.0.3497.100"
11-10 13:03:10.551 13002 13081 W cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
11-10 13:03:10.559 13002 13002 I cr_BrowserStartup: Initializing chromium process, singleProcess=false
11-10 13:03:10.727 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;-><init>(Landroid/content/Context;I)V (light greylist, reflection)
11-10 13:03:10.727 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->logEvent(Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;)V (light greylist, reflection)
11-10 13:03:10.727 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionStarted(I)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
11-10 13:03:10.727 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(II)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
11-10 13:03:10.727 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
11-10 13:03:10.727 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextSelection;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
11-10 13:03:10.727 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(III)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
11-10 13:03:10.727 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(IIILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
11-10 13:03:10.749 13002 13002 I Choreographer: Skipped 51 frames!  The application may be doing too much work on its main thread.
11-10 13:03:10.768 13002 13002 E eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
11-10 13:03:10.768 13002 13002 E eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
11-10 13:03:10.802 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (light greylist, reflection)
11-10 13:03:10.802 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (light greylist, reflection)
11-10 13:03:10.802 13002 13002 W tauri.tauri_ap: Accessing hidden method Landroid/os/Trace;->traceCounter(JLjava/lang/String;I)V (light greylist, reflection)
11-10 13:03:10.831 13002 13121 W cr_media: Requires BLUETOOTH permission
11-10 13:03:10.857 13002 13145 W cr_CrashFileManager: /data/user/0/com.tauri.tauri_app/cache/WebView/Crash Reports does not exist or is not a directory
11-10 13:03:10.871 13002 13138 W VideoCapabilities: Unrecognized profile 4 for video/hevc
11-10 13:03:10.878 13002 13138 I VideoCapabilities: Unsupported profile 4 for video/mp4v-es
11-10 13:03:10.880 13002 13138 W cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
11-10 13:03:11.315 13002 13002 E Tauri/Console: File: http://tauri.localhost/ - Line 85 - Msg: Uncaught SyntaxError: Unexpected token .
11-10 13:03:11.479 13002 13002 E Tauri/Console: File: http://tauri.localhost/@vite/client - Line 151 - Msg: Uncaught ReferenceError: globalThis is not defined
11-10 13:03:11.479 13002 13002 E Tauri/Console: File: http://tauri.localhost/@vite/client - Line 151 - Msg: Uncaught ReferenceError: globalThis is not defined
11-10 13:03:11.512 13002 13002 I Tauri/Console: File: http://tauri.localhost/node_modules/.vite/deps/react-dom_client.js?v=c6ea82de - Line 21536 - Msg: %cDownload the React DevTools for a better development experience: https://reactjs.org/link/react-devtools
11-10 13:03:11.512 13002 13002 E Tauri/Console: File: http://tauri.localhost/@vite/client - Line 151 - Msg: Uncaught ReferenceError: globalThis is not defined

Additional context

No response

FabianLars commented 8 months ago

Hmm, this sounds like the webview version the simulator ships with by default is too old 🤔

I'm not sure if it's possible to update that in the simulator (or is it as simple as opening the play store and searching for updates?) Any chance you can try it on a real device?

smrza commented 8 months ago

Hmm, this sounds like the webview version the simulator ships with by default is too old 🤔

I'm not sure if it's possible to update that in the simulator (or is it as simple as opening the play store and searching for updates?) Any chance you can try it on a real device?

Thanks for the tip!

Managed to make it working on the emulator by disabling Chrome and updating WebView to the latest version. Still shows some errors in the console - but the app launches. Let me try installing on my physical device and it if it works, I will close this issue.

smrza commented 8 months ago

Thanks @FabianLars the WebKit resolved the issue and I'm able to run the app on my physical device in dev mode. Still unable to install it after a build with the .apk but that might be a different issue. Closing this.