cake_wallet icon indicating copy to clipboard operation
cake_wallet copied to clipboard

Android Build errors

Open agamsingh9 opened this issue 1 year ago • 4 comments

I started a fresh Ubuntu 20.04 VM and followed howto-build-android to the tee but get this fail at the last step

agam@ubuntu-vm:/opt/android/cake_wallet$ flutter build apk --release

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/to/flutter-gradle-plugin-apply

The message received from the daemon indicates that the daemon has disappeared.
Build request sent: Build{id=8d56a881-80ba-4269-9732-c51c9839c677, currentDir=/opt/android/cake_wallet/android}
Attempting to read last messages from the daemon log...
Daemon pid: 313695
  log file: /home/agam/.gradle/daemon/8.10.2/daemon-313695.out.log
----- Last 20 lines from daemon log file - daemon-313695.out.log -----
2025-01-12T15:59:46.931-0600 [INFO] [org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler] Received command: Build{id=8d56a881-80ba-4269-9732-c51c9839c677, currentDir=/opt/android/cake_wallet/android}.
2025-01-12T15:59:46.931-0600 [DEBUG] [org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler] Starting executing command: Build{id=8d56a881-80ba-4269-9732-c51c9839c677, currentDir=/opt/android/cake_wallet/android} with connection: socket connection from /127.0.0.1:44267 to /127.0.0.1:58554.
2025-01-12T15:59:46.933-0600 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] Command execution: started DaemonCommandExecution[command = Build{id=8d56a881-80ba-4269-9732-c51c9839c677, currentDir=/opt/android/cake_wallet/android}, connection = DefaultDaemonConnection: socket connection from /127.0.0.1:44267 to /127.0.0.1:58554] after 0.0022166666666666667 minutes of idle
2025-01-12T15:59:46.934-0600 [INFO] [org.gradle.launcher.daemon.server.DaemonRegistryUpdater] Marking the daemon as busy, address: [704b6251-2767-45a9-afbe-a4dd1caed9f4 port:44267, addresses:[localhost/127.0.0.1]]
2025-01-12T15:59:46.934-0600 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Marking busy by address: [704b6251-2767-45a9-afbe-a4dd1caed9f4 port:44267, addresses:[localhost/127.0.0.1]]
2025-01-12T15:59:46.934-0600 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
2025-01-12T15:59:46.934-0600 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2025-01-12T15:59:46.935-0600 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2025-01-12T15:59:46.939-0600 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] resetting idle timer
2025-01-12T15:59:46.939-0600 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] daemon is running. Sleeping until state changes.
2025-01-12T15:59:46.940-0600 [INFO] [org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy] Daemon is about to start building Build{id=8d56a881-80ba-4269-9732-c51c9839c677, currentDir=/opt/android/cake_wallet/android}. Dispatching build started information...
2025-01-12T15:59:46.941-0600 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 22: dispatching org.gradle.launcher.daemon.protocol.BuildStarted@7e30d9f0
2025-01-12T15:59:46.943-0600 [DEBUG] [org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment] Configuring env variables: [PATH, XDG_DATA_DIRS, LC_TERMINAL, JAVA_HOME, FLUTTER_ROOT, TERM, MOTD_SHOWN, LANG, DBUS_SESSION_BUS_ADDRESS, XDG_SESSION_ID, XDG_SESSION_TYPE, LOGNAME, PWD, XDG_SESSION_CLASS, SHELL, LC_TERMINAL_VERSION, SSH_CLIENT, SSH_TTY, OLDPWD, USER, SSH_CONNECTION, FLUTTER_ALREADY_LOCKED, XDG_RUNTIME_DIR, SHLVL, HOME]
2025-01-12T15:59:46.947-0600 [DEBUG] [org.gradle.launcher.daemon.server.exec.LogToClient] About to start relaying all logs to the client via the connection.
2025-01-12T15:59:46.947-0600 [INFO] [org.gradle.launcher.daemon.server.exec.LogToClient] The client will now receive all logging from the daemon (pid: 313695). The daemon log file: /home/agam/.gradle/daemon/8.10.2/daemon-313695.out.log
2025-01-12T15:59:46.949-0600 [INFO] [org.gradle.launcher.daemon.server.exec.LogAndCheckHealth] Starting build in new daemon [memory: 3.8 GiB]
2025-01-12T15:59:46.950-0600 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has started executing the build.
2025-01-12T15:59:46.950-0600 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=a3dae604-3977-432e-967a-33572d8241d4,javaHome=/opt/android-studio/jbr,javaVersion=21,javaVendor=JetBrains s.r.o.,daemonRegistryDir=/home/agam/.gradle/daemon,pid=313695,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,nativeServicesMode=ENABLED,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED,--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx4096M,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/to/flutter-gradle-plugin-apply
----- End of the daemon log -----


FAILURE: Build failed with an exception.

* What went wrong:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Running Gradle task 'assembleRelease'...                          295.8s
Gradle task assembleRelease failed with exit code 1
agam@ubuntu-vm:/opt/android/cake_wallet$ flutter doctor -v
[✓] Flutter (Channel stable, 3.24.4, on Ubuntu 20.04.6 LTS 5.15.0-130-generic, locale en_US.UTF-8)
    • Flutter version 3.24.4 on channel stable at /home/agam/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (3 months ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /home/agam/Android/Sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /opt/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✗] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
    • pkg-config version 0.29.1
    ✗ GTK 3.0 development libraries are required for Linux development.
      They are likely available from your distribution (e.g.: apt install libgtk-3-dev)

[✓] Android Studio (version 2024.2)
    • Android Studio at /opt/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.6 LTS 5.15.0-130-generic

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.
agam@ubuntu-vm:/opt/android/cake_wallet$

agamsingh9 avatar Jan 12 '25 22:01 agamsingh9

If you have docker on your Ubuntu you can try this docker file

https://github.com/cake-tech/cake_wallet/issues/337#issuecomment-2455564970

Go to the dockerfile link for a more updated one, instructions on the readme as well

Justxd22 avatar Jan 12 '25 23:01 Justxd22

@agamkohli9 mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties

MrCyjaneK avatar Jan 13 '25 07:01 MrCyjaneK

also, there is an soon-to-be official docker image for building, you may want to take a look at it. https://github.com/cake-tech/cake_wallet/blob/dac3731c8907a0085bce4962f34f3759bb30c2a3/scripts/linux/Dockerfile.linux

MrCyjaneK avatar Jan 13 '25 08:01 MrCyjaneK