Android/gradle build failure

android
gradle

#1

Hey, I’m getting a build failure related to gradle. I’m sure for some reason an old version of gradle is trying to compile my project, but I’m not sure why because I have new versions specified in my gradle.build files.

Here is the error.

FAILURE: Build failed with an exception.

* Where:
Build file '/home/ubuntu/Android/app/build.gradle' line: 16

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not create plugin of type 'AppPlugin'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED


export TERM="dumb"
if [ -e ./gradlew ]; then ./gradlew dependencies;else gradle dependencies;fi
 returned exit code 1

Total time: 4.654 secs Action failed: gradle dependencies

It’s not liking this line, as Google has deprected the ‘android’ plugin name

apply plugin: 'com.android.application'

I have the following gradle dependency in my projects build.gradle

    classpath 'com.android.tools.build:gradle:1.3.0'

I’m looking for other solutions, but is gradle baked into my container and needs to be upgraded or something else obvious?


#2

1, I had circle.yml in the wrong spot. But i still get the same error. Looks like gradle 1.10 is installed. I need 2.4.


#3

I fixed this with following in circle.yml :

pre:
- sudo add-apt-repository ppa:cwchien/gradle -y
- sudo apt-get update
- sudo apt-get install gradle-2.6


#4

Nice, do you know if I have to install gradle every time the test runs or how I can make it always use the specific gradle version without having to install it again?


#5

I think you need to install every time. I switched from apt-get to simple wget, it’s faster

pre:


#6

Did that in pre, but the build is still trying to use gradle 2.4

Gradle version 2.10 is required. Current version is 2.4.


#7

Very late reply, but to record it for others having the same problem later, in circle.yml set you path to point to the directory with your unzipped gradle binary :

machine:            
   environment:                        
      PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-2.14.1/bin:$PATH"

#8