Gradle Build Failure

Hi all,

I had a perfectly working app that compiled and executed just fine when emulating. After trying to install a 3rd party SDK for chat functionality, everything went completely tango uniform. I’ve tried using various gradle builds, deleting the SDKs that caused the problem, using default gradle wrapper, and altering various versions of buildTools. I’ve also deleted and reinstalled APIs. I’m at a complete loss here. Nothing I can find online is fixing my problem. Can anyone please help? Normally I would just sit and crunch through it but this app is proprietary for my company and I’ve got a deadline staring me down.

app build.gradle is here:

sdk build.gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
** repositories {**
** jcenter()**
** }**
** dependencies {**
** classpath ‘com.android.tools.build:gradle:1.5.0’**

** // NOTE: Do not place your application dependencies here; they belong**
** // in the individual module build.gradle files**
** }**
}

allprojects {
** repositories {**
** jcenter()**
** }**
}

Here is my event log:

4:04:50 PM Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :sdk:generateDebugSources, :sdk:generateDebugAndroidTestSources, :sdk:compileDebugSources, :sdk:compileDebugAndroidTestSources]
4:04:53 PM Gradle build finished with 1 error(s) in 2s 516ms

Here is my Gradle Build output:

Error:FAILURE: Build failed with an exception.

*** What went wrong:**
Task ‘compile’ is ambiguous in root project ‘CBDashboard’. Candidates are: ‘compileDebugAidl’, ‘compileDebugAndroidTestAidl’, ‘compileDebugAndroidTestJavaWithJavac’, ‘compileDebugAndroidTestNdk’, ‘compileDebugAndroidTestRenderscript’, ‘compileDebugAndroidTestSources’, ‘compileDebugJavaWithJavac’, ‘compileDebugNdk’, ‘compileDebugRenderscript’, ‘compileDebugSources’, ‘compileDebugUnitTestJavaWithJavac’, ‘compileDebugUnitTestSources’, ‘compileLint’, ‘compileReleaseAidl’, ‘compileReleaseJavaWithJavac’, ‘compileReleaseNdk’, ‘compileReleaseRenderscript’, ‘compileReleaseSources’, ‘compileReleaseUnitTestJavaWithJavac’, ‘compileReleaseUnitTestSources’.

*** Try:**
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

1 Like

I’m not that good at gradle (and I have to run to work) but maybe this will help you some.

Seems like it’s saying the ‘compile’ task doesn’t exist in gradle, maybe compare against the last time it built to make sure it didn’t get deleted/renamed.

Possible try double quotes instead of single quotes.

Also found https://stackoverflow.com/questions/29540773/project-built-failed-task-compiledebug-is-ambiguous-in-root-project which seems to point to number 1, failing that maybe just try calling one of the listed tasks directly?

I know you said it’s private, would it be possible to share your circle.yml file?

1 Like

I tried the double quotes…nothing.

gradlew clean is successful in the project folder

gradlew build gives me the following error:

1 Like

Ok, looks like your compileDebugJavaWithJavac task can’t find tools.jar. Maybe see what it shows for path?

I reinstalled JDK8. Everything cleans and builds fine when using the Gradle gui. When I run the compileDebugJavaWithJavac, I get build successful. Yet, whenever I try to build and run the app via Android Studio, I’m met with the same arbitrary error:

Executing command: "app:compileDebugJavaWithJavac"
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE

BUILD SUCCESSFUL

Total time: 9.686 secs

Completed Successfully

I’m gonna say that Android Studio is trying to run task compile then, that doesn’t exist. May want to double-check your project settings in that program, I’ve never used it.

Thanks for your help. I’ve reached the end of my wits. Android Studio is just too unstable and I’ve decided to completely start over (i saved my code) and am going to try learning IntelliJ.

1 Like

Have not done any programming with android, but I absolutely LOVE IntelliJ. Good luck! :smile: