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

Gradle build error for Android: Aborting build initialization due to existing files in the project directory: .../build/android #1008

Open
haritkapadia opened this issue Jan 2, 2025 · 0 comments

Comments

@haritkapadia
Copy link

haritkapadia commented Jan 2, 2025

What OS are you using (uname -a, or Windows version)?

$ uname -a
Linux hostess 6.12.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 27 Dec 2024 14:24:37 +0000 x86_64 GNU/Linux

What version Socket Runtime are you using?

$ bun run ssc -v
0.6.0-rc.8 (7419e97a)
Installation path: /home/narilth/HPK/projects/simple-record/node_modules/@socketsupply/socket-linux-x64/

What programming language are you using (C/C++/Go/Rust)?

I don't think I'm using any of these compilers...
For my actual project I'm using Javascript (Vite, Typescript, SolidJS)

gcc (GCC) 14.2.1 20240910
clang version 18.1.8
go version go1.23.4 linux/amd64
rustc 1.68.0 (2c8cc3432 2023-03-06)
node -v: v23.4.0

What did you expect to see and what you saw instead?

I have an existing (very simple) application that targets Linux. Now, I want to also target Android.

I'm following the Android build guide on https://socketsupply.co/guides/#mobile-guides_android.

  1. I ran ssc setup --platform=android.
  2. I verified that my .ssc.env contains the right paths. Below is the output of bun run ssc env.
ANDROID_HOME=/home/narilth/Android/Sdk
CXX=/sbin/clang++
GRADLE_HOME=/usr/share/java/gradle
HOME=/home/narilth
JAVA_HOME=/usr/lib/jvm/default
LANG=en_US.UTF-8
PREFIX=/home/narilth/HPK/projects/simple-record/node_modules/@socketsupply/socket-linux-x64
PWD=/home/narilth/HPK/projects/simple-record/ui
SHELL=/usr/bin/zsh
SOCKET_HOME=/home/narilth/HPK/projects/simple-record/node_modules/@socketsupply/socket-linux-x64/
SOCKET_HOME_API=/home/narilth/HPK/projects/simple-record/node_modules/@socketsupply/socket
USER=narilth
  1. I plugged in my Android device and went through the USB Debugging steps. ssc list-devices --platform=android returns a serial number, as expected.
  2. I ran bun run ssc build -r --platform=android (I also tried -r -o --platform=android, --platform=android, --platform=android-emulator). I get the following error.
$ (export VERBOSE=1; bun run ssc build -o --platform=android)
• cd /home/narilth/HPK/projects/simple-record/ui/build/android +10ms
• sdkmanager --version 2>&1 >/dev/null +0ms
• echo 1 |/usr/share/java/gradle/bin/gradle --no-configuration-cache --no-build-cache --no-scan --offline --quiet init +1682ms

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':init'.
> Aborting build initialization due to existing files in the project directory: '/home/narilth/HPK/projects/simple-record/ui/build/android'.

* Try:
> Remove any existing files in the project directory and run the init task again.
> Enable the --overwrite option to allow existing files to be overwritten.
> 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.

BUILD FAILED in 798ms
• ERROR: failed to invoke `gradle init` command +964ms
• Check licenses and run again:
export JAVA_HOME="/usr/lib/jvm/default" && '/sbin/yes' | '/home/narilth/Android/Sdk/cmdline-tools/latest/bin/sdkmanager' --licenses
 +0ms
error: "ssc" exited with code 1
  1. I tried checking my licenses. Below is the output. There are some warnings. After checking licenses, I still get the same error on build.
$ (export JAVA_HOME="/usr/lib/jvm/default" && '/sbin/yes' | '/home/narilth/Android/Sdk/cmdline-tools/latest/bin/sdkmanager' --licenses)

Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
[=======================================] 100% Computing updates...
All SDK package licenses accepted.
  1. I tried rerunning the setup. Below is the output. After rerunning setup, I still get the same error on build.
$ bun run ssc setup --platform=android

• Running setup for platform 'android' in SOCKET_HOME (/home/narilth/HPK/projects/simple-record/node_modules/@socketsupply/socket-linux-x64/) +0ms
grep: warning: stray \ before =
grep: warning: stray \ before =
Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
[=======================================] 100% Computing updates...

Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
[=======================================] 100% Computing updates...
All SDK package licenses accepted.

Edit: Happy new year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant