termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.22k stars 3.04k forks source link

[Bug]: gradle hangs, unable to use daemon. #21888

Open twaik opened 1 week ago

twaik commented 1 week ago

Problem description

Can not build termux-x11 using gradle package, the command hangs.

What steps will reproduce the bug?

~/termux-x11 $ gradle :assembleDebug
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
^C~/termux-x11 $ gradle :assembleDebug --no-daemon
To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build 
^C~/termux-x11 $ 

What is the expected behavior?

Should run fine?

System information

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=11349
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.1
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main/ stable main
# x11-repo (sources.list.d/x11.list)
deb https://packages-cf.termux.dev/apt/termux-x11/ x11 main
Updatable packages:
All packages up to date
termux-tools version:
1.44.1
Android version:
13
Kernel build information:
Linux localhost 4.19.87-27231340 #1 SMP PREEMPT Wed Aug 28 17:58:45 KST 2024 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-G780F
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.x11 versionCode:15
com.termux.api versionCode:51
robertkirkman commented 3 hours ago

Were you using a specific type of Android SDK, or did you have a way to build the termux-x11 repo without the Android SDK? There are at least 2 distinct open source implementations of Android SDK for Termux but as far as I know they are both unofficial, so if I don't install them I see this.

~/termux-x11 $ gradle assembleDebug

> Configure project :app
WARNING: BuildType 'debug' is both debuggable and has 'isMinifyEnabled' set to true.
All code optimizations and obfuscation are disabled for debuggable builds.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/data/data/com.termux/files/home/termux-x11/local.properties'.

* 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.

BUILD FAILED in 2s

Did you bypass that error to get to the state you see, or do you experience Gradle hanging before you get to the SDK part?

twaik commented 3 hours ago

Probably here lies a problem, I did not install SDK at all. I just picked the first gradle project I recalled and tried to build it. Can you please send me link to another project which does not require SDK so I can test it?

robertkirkman commented 2 hours ago

Yes here are 2 tests that work for me

test 1

mkdir testapp
cd testapp
yes | gradle init
gradle build

result of test 1

> Task :buildEnvironment
Daemon JVM: N/A JDK 17-internal+0-adhoc..src
  | Location:           /data/data/com.termux/files/usr/lib/jvm/java-17-openjdk
  | Language Version:   17
  | Vendor:             N/A
  | Architecture:       aarch64
  | Is JDK:             true

------------------------------------------------------------
Root project 'testapp'
------------------------------------------------------------

classpath
No dependencies

A web-based, searchable dependency report is available by adding the --scan option.

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed

test 2

git clone https://github.com/aditya-sridhar/simple-gradle-java-app.git
cd simple-gradle-java-app
gradle build

result of test 2

> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :jar
> Task :startScripts
> Task :distTar
> Task :distZip
> Task :assemble
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
> Task :check
> Task :build

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 13s
7 actionable tasks: 7 executed

Those are very minimal tests so let me know if it's necessary to find or write larger test gradle projects.