Can not get android apps build

Hello,

I am using NetBSD 9.2. I have gradle 6.8.3. I have created a simple application (basic) with groovy, using “gradle init”. Changed the settings.gradle file so that it has “include ‘:app’”. Added gradle.build and app/gradle.build. When I build using “./gradlew build --scan” It complains with “Could not find implementation class ‘com.gradle.enterprise’”.

Then I have changed the settings.gradle file and added “plugin { id ‘com.gradle.enterprise’ }” and run the build. This then complains with: “Could not load compiled classes for settings file …” and has also this string “> settings_c939…8l”

What is required to initialize and compile an android application on the command line.

Additional Note (added later). The same is true for a simple java application. I am creating a java application using “gradle init”. It creates a java class which seems to be a hello world application. When i run “gradle build” it complains about the build file, not finding implementation class for ‘com.gradle.enterprise’ version 3.5. When adding a plugin to the settings.gradle file it stops with message “Could not load compiled classes for settings file ‘/home/…/settings.gradle’ from cache” and the setting file name (in cache I believe) something like “settings_afa…vd22”.

Regards
Riza

Hi!

This seems a lot like Unable to upgrade past gradle 6.4.1 on NetBSD - Could not load compiled classes for build file '.../build.gradle' from cache · Issue #16568 · gradle/gradle · GitHub. Could you try with the latest 7.3 nightly, to see if there is some more information why the build isn’t working? 7.3-20210925230640+0000 would be good.

Cheers,
Stefan

Hello Stefan,

I will test this later today. But to make sure. I can do this with this commad, right : “gradle wrapper --gradle-version 7.3-20210925230640+0000”. Is this correct?

I will get back when i try this with the new version.

Regards
Riza.

Hello,

I have updated the wrapper version to the version you told me to upgrade to. I have done this by changing the gradle/wrapper/gradle-wrapper.properties file. I have changed the “distributionUrl” to “https://services.gradle.org/distributions-snapshots/gradle-7.3-20210925230640+0000-all.zip”. It is the same outcome as I described in my initial message.

Why is gradle looking for a file like “settings_afa…vd22”? When I look at the stacktrace, it says “Detect premature EOF” with a ClassNotFountException for that file.

Regards
Riza

Hmm, I was hoping to get some more insights here :frowning:

Why is gradle looking for a file like “settings_afa…vd22”? When I look at the stacktrace, it says “Detect premature EOF” with a ClassNotFountException for that file.

This file is the class generated from settings.gradle. Gradle chooses a unique name for each settings file. For some reason all of this doesn’t seem to work on NetBSD, and I don’t know why. Maybe running with --debug may give some insights?

Cheers,
Stefan

Another thing which might track down the issue is which JDK you use to run the build.

Hello Stefan,

I am running openjdk 11.

I am not trying to build an android application. I am trying to build a java application that uses groovy, and java as the language. An application that has been created with gradle init, and choosing application, and java as the language.

Here is some more information from the log files. When I look at the ~/.gradle/daemon/6.8.3/daemon-224.out.log file (the file after I ran “gradle” without parameters in the project directory) says this:

2021-09-30T06:25:32.245+0000 [WARN] [org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment] Warning: Unable able to set daemon's environment variables to match the client because: 
  There is no native integration with this operating environment.
  If the daemon was started with a significantly different environment from the client, and your build  
  relies on environment variables, you may experience unexpected behavior.

This line sounds serious. Not being able to “set the environment to match the client”

In this file there is only one line marked with [ERROR] is this. This line is prior the warning line given above.

2021-09-30T06:25:32.232+0000 [ERROR] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] Command execution: started DaemonCommandExecution[command = Build{id=f1b0365a-6b37-4605-9ff3-3e63cc8c277a, currentDir=/home/rdindir/Documents/tests/gradle-java-app/src/main}, connection = DefaultDaemonConnection: socket connection from /127.0.0.1:65353 to /127.0.0.1:65352] after 0.0 minutes of idle

And the line that has the same output as the gradle invocation is this, in the log file.

2021-09-30T06:25:32.289+0000 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=72dbd7e8-0d6b-497a-97ee-176da686c324,javaHome=/usr/pkg/java/openjdk11,daemonRegistryDir=/home/rdindir/.gradle/daemon,pid=224,idleTimeout=10800000,priority=NORMAL,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,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=US-ASCII,-Duser.country=US,-Duser.language=en,-Duser.variant]

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not load compiled classes for build file '/home/rdindir/Documents/tests/gradle-java-app/src/main/app/build.gradle' from cache.

* 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 13s

In this line, the memory settings 256 meg and 512 meg. Is this enough for a build? Or should these settings be more?

I tried with the --debug flag but the output seems the same. But tried also with --scan and -s flags (–debug flag was left out). Here gradle outputs

* What went wrong:
An exception occurred applying plugin request [id: 'com.gradle.enterprise', versio
n: '3.5', artifact: 'com.gradle:gradle-enterprise-gradle-plugin:3.5']
> Could not find implementation class 'com.gradle.enterprise.gradleplugin.GradleEnterprisePlugin' for plugin 'com.gradle.enterprise' specified in jar:file:/home/rdindir/.gradle/caches/jars-8/359a3903d392cf7b7f1750e93aa55cab/gradle-enterprise-gradle-plugin-3.5.jar!/META-INF/gradle-plugins/com.gradle.enterprise.properties.

And the stack output is (the very end) is like this

 at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:132)
  at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.lambda$applyLegacyPlugins$2(DefaultPluginRequestApplicator.java:138)
  at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:176)
  ... 134 more
Caused by: java.lang.ClassNotFoundException: com.gradle.enterprise.gradleplugin.GradleEnterprisePlugin
  at org.gradle.api.internal.plugins.DefaultPluginRegistry$1.load(DefaultPluginRegistry.java:72)
  ... 148 more
Caused by: java.io.EOFException: Detect premature EOF
  at java.base/jdk.internal.loader.Resource.getBytes(Resource.java:131)
  ... 149 more

When I change the settings.gradle file and add “plugin { id ‘com.gradle.enterprise’ }” and the very beginning of the file and run the build, then it will complain with:

* What went wrong:
Could not load compiled classes for settings file '/home/rdindir/Documents/tests/gradle-java-app/src/main/settings.gradle' from cache.
> settings_afal2vv29jpydoto0c8vxvd22

This is what I have so far.

Regards,
Riza

Hi Riza,

what kind of Gradle distribution are you using? Is this Gradle downloaded from services.gradle.org? Do you use a Gradle distribution provided by NetBSD?

Cheers,
Stefan

Hello Stefan,

I have used the gradle binary package from the NetBSD pkgsrc site. I did not download it from the services.gradle.org site.

Is there a way to get more information of the gradle process. Like maybe getting more verbose log messages.

Where are these settings_12…ac like files created? In the ~/.gradle directory, or in the project/.gradle directory?

Regards,
Riza

Hi Riza,

apart from --debug, you can’t really get more logging. The only thing you could do is to look at the daemon log in ~/.gradle/daemon.

Can you try running the build with a distribution downloaded from the official Gradle site? I looked at the pkgsrc, and it also seems to download the distribution though it uses a custom launcher script.

Cheers,
Stefan

Hello Stefan,

| Stefan_Wolf Core Dev
October 12 |

  • | - |

Hi Riza,

apart from --debug, you can’t really get more logging. The only thing you could do is to look at the daemon log in ~/.gradle/daemon.

Can you try running the build with a distribution downloaded from the official Gradle site? I looked at the pkgsrc, and it also seems to download the distribution though it uses a custom launcher script.

Will do it.

Cheers,
Stefan


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

Regards,

Riza