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

[bug] The generated Android debug program is running normally. There is an error in the publishing mode. #8569

Open
gyoyo opened this issue Jan 8, 2024 · 3 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@gyoyo
Copy link

gyoyo commented Jan 8, 2024

Describe the bug

FATAL EXCEPTION: main
Process: com.gyoyo.okapp, PID: 12614
java.lang.NoSuchMethodError: no non-static method "Lcom/gyoyo/okapp/RustWebView;.evalScript(ILjava/lang/String;)V"
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 120.0.2210.121
    ✔ MSVC: Visual Studio ���ɹ��� 2022
    ✔ rustc: 1.75.0 (82e1608df 2023-12-21)
    ✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.20
    - tauri-build [RUST]: 2.0.0-alpha.13
    - wry [RUST]: 0.35.2
    - tao [RUST]: 0.24.0
    - tauri-cli [RUST]: 2.0.0-alpha.20
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.20

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

Stack trace

No response

Additional context

No response

@gyoyo gyoyo added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jan 8, 2024
@vinceTheProgrammer
Copy link

vinceTheProgrammer commented Jan 13, 2024

I got an identical error when using Tauri 2.0 Alpha. Just like gyoyo, it works when built in debug mode, but throws that error when in release mode.

The only thing I can think of that is noticeably different from a boilerplate Tauri 2 project is that I used the Store feature in my frontend code.

My codebase is small and I don't mind sharing it, so I'll do that along with tauri info and tauri build --verbose tomorrow.

Edit: I don't think I need to post my info after all, but let me know and I can post it anyway.

@vinceTheProgrammer
Copy link

Not necessarily sure if this is the right fix, but I found a workaround:

add the following to src-tauri\gen\android\app\proguard-rules.pro

-keep class <app identifier>.RustWebView {
    public void evalScript(int, java.lang.String);
} 

replace <app identifier> with your app's identifier.

Example:

-keep class com.vincetheprogrammer.myapp.RustWebView {
    public void evalScript(int, java.lang.String);
} 

mentioning @gyoyo in case it might help.

@vinceTheProgrammer
Copy link

I found this workaround by reading this PR from the Wry repo: tauri-apps/wry#927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants