B
B
BonBon Slick2020-07-30 20:18:40
gradle
BonBon Slick, 2020-07-30 20:18:40

Unable to find method 'org.gradle.api.file.ProjectLayout.directoryProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/DirectoryProperty;?

If anything, this is a build of the Nuxt + Cordova project. Then I opened the platform in AS IDE and gives this error in the build tab.

Unable to find method 'org.gradle.api.file.ProjectLayout.directoryProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/DirectoryProperty;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)

The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)

Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.


[email protected]:~/Bash$ gradle -v

------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------

Build time:   2020-03-24 19:52:07 UTC
Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60

Kotlin:       1.3.70
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_252 (Oracle Corporation 25.252-b09)
OS:           Linux 4.9.0-8-amd64 amd64


Installed for cordova build android 8.1 SDK via Android S IDE configs
[email protected]:/var/www/test/cordova$ cordova platform ls
Installed platforms:
  android 8.1.0


[email protected]:~/Bash$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~deb9u1-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

[email protected]:~/Bash$ ls -l ~/.gradle/
total 20
drwxr-xr-x 7 bonbon bonbon 4096 Jul 30 20:10 caches
drwxr-xr-x 3 bonbon bonbon 4096 Jul 30 20:10 daemon
drwxr-xr-x 5 bonbon bonbon 4096 Jul 30 20:10 native
drwxr-xr-x 3 bonbon bonbon 4096 Jun 15 10:43 notifications
drwxr-xr-x 3 bonbon bonbon 4096 Jul 30 20:10 wrapper

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BonBon Slick, 2020-07-30
@BonBonSlick

This is very strange, but in order to fix the gradle, you had to specify the paths in /etc/environment

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java"
ANDROID_HOME=$HOME/Android/Sdk
ANDROID_SDK_ROOT=$HOME/Android/Sdk

then
source /etc/environment
accept the licenses programmatically
./sdkmanager --licenses
open AS IDE, ---|> Help tab ---|> Licenses -|> Accept
Also, before tearing off AS IDE, it was necessary to rebuild gradle
npm platform remove android
npm platform add android
npm build android

result
Task :app:assembleDebug
> Task :app:cdvBuildDebug

BUILD SUCCESSFUL in 18s
42 actionable tasks: 42 executed
Built the following apk(s): 
        /var/www/test/cordova/platforms/android/app/build/outputs/apk/debug/app-debug.apk
[email protected]:/var/www/test/cordova$

Perhaps some provider was not loaded due to licenses or the hail assembly was broken.
Also make sure that the SDK of the required version is installed.
May give out that Android target: not installed' this is here
DOCS
Stack

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question