2

I've just switched over to Android Studio, from Eclipse, and I see this error :

Error:FAILURE: Build failed with an exception.

  • What went wrong: Task 'compileDebugSources' not found in project ':myproject'.

  • 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.

How/where in the Android Studio UI do I specify "--info" ?

Someone Somewhere
  • 23,475
  • 11
  • 118
  • 166
  • You would specify it when running the **`gradle`** command from the command line. – CommonsWare Dec 15 '14 at 20:08
  • I press the "Make Project" button in Android Studio - it doesn't seem like the command line is required... unless I am wrong – Someone Somewhere Dec 15 '14 at 20:45
  • did you do any updating to the project to have it work in Android Studio? What did you do to "switch"? – browep Dec 15 '14 at 20:47
  • I simply imported the project. The one thing I did change were the minimum and target API levels. So now I want to debug what the problem is... where to put this "--info" parameter that the build failure message is describing ? Should be easy, I would think. – Someone Somewhere Dec 15 '14 at 20:49

3 Answers3

1

The answer to this question was to simply not go down this rabbit hole. What I did instead...

1) install Android Studio on my second Mac

2) check-out the project from git and open it

3) this time Android Studio actually stepped me through the issues at hand... which were :

a) build.gradle for a library project may not contain applicationId

b) replace runProguard with minifyEnabled

c) in your SDK manager, make sure you specifically have Android SDK Build-tools ver 20 installed. (I only had the latest)

Root cause ? No idea...

Someone Somewhere
  • 23,475
  • 11
  • 118
  • 166
0

Android Studio is an IDE. It uses Gradle as a build engine. Gradle is not an IDE. It is a command-line tool with a tooling API that IDEs like Android Studio use.

The error messages emitted by Gradle will be focused on the command-line interface (CLI). After all, that is the only human-accessible means of interacting with Gradle that is native to Gradle itself. Like most modules with an API, Gradle does not have detailed knowledge of the apps that use the API, and therefore Gradle cannot provide Android Studio-specific error information.

In Android Studio, you most likely received your error message in the Gradle Console or the "Messages Gradle Sync" windows. Both pertain to the Gradle build process, and the messages that you see in those windows come from Gradle, even though they are displayed by Android Studio.

With that in mind, let's look at the second bullet:

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.

Here, "gradle tasks" refers to gradle tasks, where gradle is the Gradle CLI and tasks is a command telling the CLI to list the available tasks. --info and --debug are command-line switches for the CLI, providing additional configuration for the command being run.

You can learn more about Gradle and its CLI at the Gradle site.

A normal newly-created Android Studio project has a compileDebugSources task, and so something is a bit broken with your project, perhaps tied to its Gradle build files. You are welcome to follow the error message's suggestion and use --info or --debug with the gradle tasks command. I just ran those on a working project, and you may find their output to be difficult to decipher.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • With all respect, I didn't write the gradle scripts... the import process did it - because frankly I have no clue about it. But, I checked out some functional scripts at https://github.com/Goddchen/Android-Gradle-Examples and I've gotten further, I think. I now get a totally useless `Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'default' not found.` To be honest, I'm not liking this initial Android Studio experience. Hopefully it's not an indicator of times to come. – Someone Somewhere Dec 17 '14 at 22:46
  • @SomeoneSomewhere: "With all respect, I didn't write the gradle scripts... the import process did it - because frankly I have no clue about it" -- that's fine, but nobody can help you with those scripts, as you did not include them in your question. Perhaps you should consider opening another Stack Overflow question, one where you provide the Gradle build files, plus the output from the Gradle console in Android Studio, in hopes that somebody can help you clear up your error. – CommonsWare Dec 17 '14 at 22:54
  • This is my 2nd day of 0 productivity, hence my frustration :-( However, it looks like I am tackling the wrong error message first. I think I should be tackling "Gradle project sync failed" http://stackoverflow.com/questions/24847693/android-studio-0-8-2-gradle-project-sync-failed – Someone Somewhere Dec 17 '14 at 23:38
0

Change minifyEnabled to true

buildTypes {
    release {
        minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
buczek
  • 2,011
  • 7
  • 29
  • 40
ErickPaul
  • 119
  • 9