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] Android application build failure: Failed to assemble APK #11310

Closed
Amirth24 opened this issue Oct 10, 2024 · 0 comments · Fixed by #11314
Closed

[bug] Android application build failure: Failed to assemble APK #11310

Amirth24 opened this issue Oct 10, 2024 · 0 comments · Fixed by #11314
Labels
platform: Android status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@Amirth24
Copy link

Describe the bug

I just created a tauri project to play with it. I wanted to make an android application. I had no issues in developing the application the problem arises when it comes to building the apk. The issue here is this error arises at the end of the apk build process. Please help

Execution failed for task ':app:minifyUniversalReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete, position: offset: 199, line: 7, column: 13, origin: /home/redloaded/Work/hello-tauri/src-tauri/gen/android/app/src/main/java/in/amirth24/tauriapp/generated/proguard-wry.pro

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 4s
125 actionable tasks: 7 executed, 118 up-to-date
Failed to assemble APK: command ["/home/redloaded/Work/hello-tauri/src-tauri/gen/android/gradlew", "--project-dir", "/home/redloaded/Work/hello-tauri/src-tauri/gen/android"] exited with code 1: command ["/home/redloaded/Work/hello-tauri/src-tauri/gen/android/gradlew", "--project-dir", "/home/redloaded/Work/hello-tauri/src-tauri/gen/android"] exited with code 1
    Error [tauri_cli_node] Failed to assemble APK: command ["/home/redloaded/Work/hello-tauri/src-tauri/gen/android/gradlew", "--project-dir", "/home/redloaded/Work/hello-tauri/src-tauri/gen/android"] exited with code 1: command ["/home/redloaded/Work/hello-tauri/src-tauri/gen/android/gradlew", "--project-dir", "/home/redloaded/Work/hello-tauri/src-tauri/gen/android"] exited with code 1
 ELIFECYCLE  Command failed with exit code 1.


With verbose flag enabled, I was able to spot this


Caching disabled for task ':app:minifyUniversalReleaseWithR8' because:
  Build cache is disabled
Task ':app:minifyUniversalReleaseWithR8' is not up-to-date because:
  Task has failed previously.
R8 is a new Android code shrinker. If you experience any issues, please file a bug at
https://issuetracker.google.com, using 'Shrinker (R8)' as component name.
Current version is: 8.5.27 (build 9a5bef1f7f3530a8944fd7505683ce6b7c3a7a1f from go/r8bot (luci-r8-custom-ci-archive-0-5spf)).

file or directory '/home/redloaded/Work/hello-tauri/src-tauri/gen/android/app/build/intermediates/generated_proguard_file/universalRelease/mergeUniversalReleaseGeneratedProguardFiles/proguard.txt', not found
ERROR: /home/redloaded/Work/hello-tauri/src-tauri/gen/android/app/proguard-tauri.pro:3:13: R8: Class name expected at /home/redloaded/Work/hello-tauri/src-tauri/gen/android/app/proguard-tauri.pro:3:13
-keep class `in`.amirth24.tauriapp.TauriActivity {
            ^
ERROR: /home/redloaded/Work/hello-tauri/src-tauri/gen/android/app/src/main/java/in/amirth24/tauriapp/generated/proguard-wry.pro:7:13: R8: Class name expected at /home/redloaded/Work/hello-tauri/src-tauri/gen/android/app/src/main/java/in/amirth24/tauriapp/generated/proguard-wry.pro:7:13
-keep class `in`.amirth24.tauriapp.* {
            ^
Could not execute [report metric STATISTICS_COLLECT_METRICS_OVERHEAD]
Could not execute [report metric STATISTICS_COLLECT_METRICS_OVERHEAD]

Reproduction

  1. Create a new tauri project with any ways I guess, I tried only with cargo and once again with pnpm.

    • pnpm create tauri-app
    • cd hello-tauri
    • pnpm install
  2. Initialize the android support.

    • NDK_HOME=~/Android/Sdk/ndk/28.0.12433566 pnpm tauri android init
    • NDK_HOME=~/Android/Sdk/ndk/28.0.12433566 pnpm tauri android build

Expected behavior

No response

Full tauri info output

> hello-tauri@0.1.0 tauri /home/redloaded/Work/hello-tauri
> tauri "info"


[✔] Environment
    - OS: Pop!_OS 22.4.0 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.44.3
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.18.0
    - pnpm: 9.12.1
    - npm: 10.8.2
    - bun: 1.1.10

[-] Packages
    - tauri 🦀: 2.0.2
    - tauri-build 🦀: 2.0.1
    - wry 🦀: 0.44.1
    - tao 🦀: 0.30.3
    - @tauri-apps/api : 2.0.2
    - @tauri-apps/cli : 2.0.2

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.1
    - @tauri-apps/plugin-shell : 2.0.0

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

Stack trace

No response

Additional context

No response

@Amirth24 Amirth24 added status: needs triage This issue needs to triage, applied to new issues type: bug labels Oct 10, 2024
lucasfernog added a commit that referenced this issue Oct 11, 2024
* fix(cli & core): use unescaped package id in proguard file

closes #11310

* add monkey patch for wry proguard

* fix tests

* typo

* remove wry fix

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Android status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants