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

Tauri dialog box not opening in Android 15 #2423

Open
xksteven opened this issue Feb 14, 2025 · 5 comments
Open

Tauri dialog box not opening in Android 15 #2423

xksteven opened this issue Feb 14, 2025 · 5 comments
Labels
bug Something isn't working platform: android Android specific issues plugin: dialog

Comments

@xksteven
Copy link

I was trying to test this out on a phyisical Android 15 device. Logs read by running adb logcat. I can test on other virtual devices if desired.

Main error is here:
No Activity found to handle Intent { act=android.intent.action.PICK typ=application/*...

Which seems to indicate that the plugin needs to optionally use a different intent such as new Intent(Intent.ACTION_OPEN_DOCUMENT);

I'm not that familiar with the tauri plugin codebase otherwise I'd make the change myself.

Longer logs to give more context.

02-13 17:39:13.966  5761  5761 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1568 onStartInput(EditorInfo{EditorInfo{packageName=com.read_anywhere.app, inputType=0, inputTypeString=NULL, enableLearning=false, autoCorrection=false, autoComplete=false, imeOptions=12000000, privateImeOptions=null, actionName=UNSPECIFIED, actionLabel=null, initialSelStart=-1, initialSelEnd=-1, initialCapsMode=0, label=null, fieldId=0, fieldName=null, extras=null, hintText=null, hintLocales=[]}}, false)
02-13 17:39:13.966  5761  5761 I Module  : DeviceLockedStatusModuleProvider$Module.updateDeviceLockedStatus():100 repeatCheckTimes = 1, locked = false
02-13 17:39:13.967  1722  1759 W PackageConfigPersister: App-specific configuration not found for packageName: com.read_anywhere.app and userId: 0
02-13 17:39:13.967  5761  5761 I AndroidIME: InputBundleManager.loadActiveInputBundleId():407 loadActiveInputBundleId: und-Latn-x-password, password
02-13 17:39:13.969 15059 15059 V Tauri/Plugin: Tauri plugin: pluginId: dialog, command: showFilePicker
02-13 17:39:13.972 15059 15071 I ad_anywhere.app: Background concurrent mark compact GC freed 10019KB AllocSpace bytes, 26(2248KB) LOS objects, 84% free, 4567KB/28MB, paused 189us,1.650ms total 113.834ms
02-13 17:39:13.981 15059 15073 W ad_anywhere.app: ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~02vgaGieu_dJGP8ldaa57A==/com.google.android.webview--2CRQaFaUX48UJZyESyd0w==/base.apk' with 2 weak references
02-13 17:39:14.024  1722  1759 I ActivityTaskManager: START u0 {act=android.intent.action.PICK typ=application/* (has extras)} with LAUNCH_MULTIPLE from uid 10050 result code=-91
02-13 17:39:14.024 15059 15059 E Tauri   : No Activity found to handle Intent { act=android.intent.action.PICK typ=application/* (has extras) }
@FabianLars
Copy link
Member

i tested it less than a week ago for #2410 and didn't see any issues 🤔 Can you share your code and the output of tauri info? And if you wouldn't mind, testing another (virtual) device would indeed be appreciated :)

@FabianLars FabianLars added bug Something isn't working platform: android Android specific issues plugin: dialog labels Feb 14, 2025
@xksteven
Copy link
Author

xksteven commented Feb 14, 2025

I'll see if I can get a minimal version of the code. The codebase has gotten semi big but can trim it to be MVP to reproduce the bug.

npm run tauri info

> read_anywhere@0.1.0 tauri
> tauri info


[✔] Environment
    - OS: Ubuntu 24.4.0 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.46.5
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.84.0 (9fc6b4312 2025-01-07)
    ✔ cargo: 1.84.0 (66221abde 2024-11-19)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 18.19.1
    - npm: 9.2.0

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.2
    - tao 🦀: 0.30.8
    - @tauri-apps/api : 2.1.1 (outdated, latest: 2.2.0)
    - @tauri-apps/cli : 2.1.0 (outdated, latest: 2.2.7)

[-] Plugins
    - tauri-plugin-dialog 🦀: 2.2.0
    - @tauri-apps/plugin-dialog : 2.2.0
    - tauri-plugin-fs 🦀: 2.2.0
    - @tauri-apps/plugin-fs : 2.2.0

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

@xksteven
Copy link
Author

@FabianLars Here's a "minimal" example where I can successfully open a file on linux or mac but not on Android and experiences the bug above. The minimal example reproduces the error for me. I still haven't tried on a debugger. I don't recall how to test that with tauri atm.

https://github.com/xksteven/tauri_android_bug/tree/main

I stripped down the app so it doesn't really do anything other than try to open a file.

Relevant file location where I open a dialog box

Let me know if there's anything else I need to provide to help out.

@aiueo13
Copy link

aiueo13 commented Feb 17, 2025

No Activity found to handle Intent means that there is no app that can be called. So may not be viable for some devices.

This appears to be due to the following code

fun showFilePicker(invoke: Invoke)

var intent = if (parsedTypes.isNotEmpty()) {
    val intent = Intent(Intent.ACTION_PICK)
        setIntentMimeTypes(intent, parsedTypes)
        intent
    } else {
        val intent = Intent(Intent.ACTION_GET_CONTENT)
        intent.addCategory(Intent.CATEGORY_OPENABLE)
        intent.type = "*/*"
        intent
    }
}

We need to use Intent.ACTION_OPEN_DOCUMENT, which opens the system's file picker app, instead of Intent.ACTION_PICK.
Or add a process for when the intent is not available as follows

// If the intent is not available, use system's file picker app instead
if (intent.resolveActivity(activity.packageManager) == null) {
    val i = Intent(Intent.ACTION_OPEN_DOCUMENT)
    i.addCategory(Intent.CATEGORY_OPENABLE)
    setIntentMimeTypes(i, parsedTypes) 

    intent = i
}

@chrox
Copy link

chrox commented Mar 5, 2025

Same here in Android 8 (real device) and Android 12 (emulator).
adb logcat shows:

03-05 20:31:49.805 27436 27436 I Timeline: Timeline: Activity_launch_request time:187536342 intent:Intent { act=android.intent.action.PICK typ=application/* (has extras) }
03-05 20:31:49.808  1203  2919 W ActivityManager: aInfo is null
03-05 20:31:49.808  1203  2919 W com.android.server.am.ExtraActivityManagerService: Intent or aInfo is null!
03-05 20:31:49.809  1203  2919 I ActivityManager: START u0 {act=android.intent.action.PICK typ=application/* (has extras)} from uid 10445

tauri info:

[✔] Environment
    - OS: Mac OS 15.3.0 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.83.0 (90b35a623 2024-11-26)
    ✔ cargo: 1.83.0 (5ffbef321 2024-10-29)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 22.9.0
    - pnpm: 10.4.1
    - yarn: 1.22.22
    - npm: 10.9.1

[-] Packages
    - tauri 🦀: 2.2.5
    - tauri-build 🦀: 2.0.5
    - wry 🦀: 0.48.1
    - tao 🦀: 0.31.1
    - @tauri-apps/api : 2.2.0
    - @tauri-apps/cli : 2.2.7 (outdated, latest: 2.3.1)

[-] Plugins
    - tauri-plugin-deep-link 🦀: 2.2.0
    - @tauri-apps/plugin-deep-link : 2.2.0
    - tauri-plugin-process 🦀: 2.2.0
    - @tauri-apps/plugin-process : 2.2.0
    - tauri-plugin-shell 🦀: 2.2.0
    - @tauri-apps/plugin-shell : 2.2.0
    - tauri-plugin-dialog 🦀: 2.2.0
    - @tauri-apps/plugin-dialog : 2.2.0
    - tauri-plugin-log 🦀: 2.2.1
    - @tauri-apps/plugin-log : 2.2.1 (outdated, latest: 2.2.3)
    - tauri-plugin-haptics 🦀: 2.2.3
    - @tauri-apps/plugin-haptics : 2.2.3
    - tauri-plugin-updater 🦀: 2.4.0
    - @tauri-apps/plugin-updater : 2.4.0 (outdated, latest: 2.5.1)
    - tauri-plugin-window-state 🦀: 2.2.1
    - @tauri-apps/plugin-window-state : not installed!
    - tauri-plugin-os 🦀: 2.2.0
    - @tauri-apps/plugin-os : 2.2.0
    - tauri-plugin-cli 🦀: 2.2.0
    - @tauri-apps/plugin-cli : 2.2.0
    - tauri-plugin-single-instance 🦀: 2.2.1
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-http 🦀: 2.3.0
    - @tauri-apps/plugin-http : 2.3.0
    - tauri-plugin-opener 🦀: 2.2.5
    - @tauri-apps/plugin-opener : 2.2.5 (outdated, latest: 2.2.6)
    - tauri-plugin-fs 🦀: 2.2.0
    - @tauri-apps/plugin-fs : 2.2.0

[-] App
    - build-type: bundle
    - CSP: default-src 'self' 'unsafe-inline' blob: data: customprotocol: asset: http://asset.localhost ipc: http://ipc.localhost; connect-src 'self' blob: data: asset: http://asset.localhost ipc: http://ipc.localhost https://*.sentry.io https://*.posthog.com https://*.deepl.com https://*.wikipedia.org https://*.wiktionary.org https://*.supabase.co https://*.readest.com wss://speech.platform.bing.com https://*.cloudflarestorage.com; font-src 'self' blob: data: asset: http://asset.localhost tauri: https://fonts.gstatic.com https://db.onlinewebfonts.com https://cdn.jsdelivr.net; frame-src 'self' blob: asset: http://asset.localhost; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: asset: http://asset.localhost https://*.sentry.io https://*.posthog.com; img-src 'self' blob: data: asset: http://asset.localhost https://*; style-src 'self' 'unsafe-inline' blob: asset: http://asset.localhost https://cdn.jsdelivr.net https://fonts.googleapis.com
    - frontendDist: ../out
    - devUrl: http://localhost:3000/
    - framework: React (Next.js)
    - bundler: Webpack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: android Android specific issues plugin: dialog
Projects
None yet
Development

No branches or pull requests

4 participants