Could not get unknown property <pluginName> for project ':app' of type org.gradle.api.Project on macOS. Works on linux


(Svetlana Omelkova) #1

I am struggling trying to execute my custom gradle groovy plugin on mac os, on linux everything works as expected.

Example project under question: https://github.com/NevercodeHQ/android-tests/tree/gradle-plugin

I have a custom gradle plugin reside in buildSrc folder. I want to use this plugin in app project.

linux environment:

/android-tests $ ./gradlew --version

------------------------------------------------------------
Gradle 4.6
------------------------------------------------------------

Build time:   2018-02-28 13:36:36 UTC
Revision:     8fa6ce7945b640e6168488e4417f9bb96e4ab46c

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Linux 4.4.0-104-generic amd64

After executing nevercodePlugin task on linux machine everything works as expected:

/android-tests $ ./gradlew -b app/build.gradle nevercodePlugin
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :app:nevercodePlugin 
Hello from nevercodePlugin

BUILD SUCCESSFUL in 9s
1 actionable task: 1 executed

mac OS environment:

android-tests $ ./gradlew --version

------------------------------------------------------------
Gradle 4.6
------------------------------------------------------------

Build time:   2018-02-28 13:36:36 UTC
Revision:     8fa6ce7945b640e6168488e4417f9bb96e4ab46c

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Mac OS X 10.13.5 x86_64

After executing same plugin with same command I am getting the following error:

android-tests $ ./gradlew -b app/build.gradle nevercodePlugin
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/greenhouse/android-tests/app/build.gradle' line: 58

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'NevercodePlugin' for project ':app' of type org.gradle.api.Project.

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

Tried multiple times on different mac machines from clean clone, deleted .gradle folder - build always fail. On linux it works even inside the docker isolated environment from the clean clone.
Any hints would be very much appreciated.

Thank you.


(Peter Tran) #2

It looks like I’m missing some other setup. I’m on a Mac and trying to reproduce your issue. Can you provide the other setup steps?


(Peter Tran) #3

:+1: Great detail on your post just missing a few steps to reproduce.


(Svetlana Omelkova) #4

Looks like you don’t have Android Sdk installed on your machine. Does command echo $ANDROID_HOME produce some results?

Steps to reproduce the issue:

# make sure you have android sdk installed
git clone -b gradle-plugin https://github.com/NevercodeHQ/android-tests.git
cd android-tests
./gradlew -b app/build.gradle nevercodePlugin