"Task 'compile' is ambiguous in root project" - Android Studio - android

Every time I try to run my project, clean it or build it I get a gradle error:
Error:FAILURE: Build failed with an exception.
* What went wrong:
Task 'compile' is ambiguous in root project 'FifiFun2'. 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.
I have tried running gradle tasks with the options above (stacktrace,info,debug) but nothing helpful came up.
gradle:
// 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.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
main gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.user_pc.myapplication"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
}
settings.gradle file:
include ':app'
Screenshot of the problem:

The problem is, your gradlew file is in the root of your project and you are trying to run an ambiguous task compile from the root of the project, in which the compiler does not know the actual task to run, this will lead to TaskSelectionException. You can run a single task, this stackoverflow question will help you

Check the following :
Can you build and run another project? (New one for instance).
Try defining a debug buildType and resync gradle then build.
Check if you have a good proyect structure or set it in gradle.build if you don't.
If non of thoses work am out of ideas, sorry.

Remove the code
task clean(type: Delete) {
delete rootProject.buildDir
}
from your gradle file, then clean and rebuild your project.

None of the above worked for me. The solution I found was
Install latest version of Cordova.
Install latest version of gradle. You can do this Manually. Remember to updated GRADLE_HOME and PATH in System variables
Remove and reinstall android in your project. Remember to back up items such as Icons etc
Run cordova build android --prod --release. This will generate an App bundle instead of an APK file. This command will also hopefully download the latest version of gradle for your project.
Hope that helps some poor soul somewhere who is at their wits end.

You need to clean the project(Top level menu Build --> Clean Project) first and then run the command again.

Related

How to fix dependency issues in AndroidStudio?

I just clones an android project from my local repo and I have trouble to 'build' it. Maybe it missed some external library, but I do not know.
Upon starting a grade build I get the following message:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> Configuration with name 'default' not found.
I tried to check the 'Manifest' file, but I can't find it. I am completely lost...
I am pretty sure this is a configuration error, therefore all the config files I can find here:
build.gradle (project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.impyiablue.myapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.firebase:firebase-ads:9.0.0'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile project(path: ':LibraryModule')
}
apply plugin: 'com.google.gms.google-services'
cradle-wrapper.properties
#Wed Sep 07 20:03:05 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
settings.gradle:
include ':app'
include ':libraries:volley'
include ':LibraryModule'
project(':LibraryModule').projectDir = new File('/Users/adietz/AndroidStudioProjects/LIBS')
local.properties:
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Oct 15 11:07:25 CEST 2017
sdk.dir=/Users/adietz/Library/Android/sdk
The output of ./gradlew build (from inside the project folder) is the following:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/Users/adietz/.gradle/wrapper/dists/gradle-2.14.1-all/4cj8p00t3e5ni9e8iofg8ghvk7/gradle-2.14.1/lib/gradle-base-services-2.14.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 7.217 secs
Part of the solution seems to be a change in the file build.gradle (for Module:app). If you replace this line
compile project(path: ':LibraryModule')
with this line:
compile project(':libraries:volley')
and do 'Clean Project again', different things might happen:
AndroidStudio start to download stuff
Other gradle files appear mysteriously in your Gradle Scripts folder
Other errors appear (which you can google and actually find some helpful answers)
But it might fix the actual problem...

Gradle exists with non-zero value

I'm working on an Adnroid app that was imported. The imported app used an old version of Gradle so I'm trying to sync it to the new ones (it used Gradle 19 I think). I'm unable to use Gradle 24 b/c there are symbol class finders that can't be found, so I'm just trying to get this working with 21, but it still won't work. Can anyone help?
Here is my outer .build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
repositories {
mavenCentral()
// maven { url 'http://clinker.47deg.com/nexus/content/groups/public' }
// maven { url 'http://repo1.maven.org/maven2' }
}
}
Here is my inner .build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.0.0"
defaultConfig {
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
// compile "com.android.support:support-core-utils:21.0.0"
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'se.emilsjolander:stickylistheaders:2.5.2'
compile 'com.github.chrisbanes.photoview:library:1.2.2'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.google.android.gms:play-services:6.1.71'
}
When I run this on an physical android I get this error:
Executing tasks: [:leafsnap:clean, :leafsnap:generateDebugSources, :leafsnap:generateDebugAndroidTestSources, :leafsnap:mockableAndroidJar, :leafsnap:prepareDebugUnitTestDependencies, :leafsnap:assembleDebug]
Configuration on demand is an incubating feature.
Observed package id 'add-ons;addon-google_apis-google-24' in inconsistent location 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24-1' (Expected 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24')
Already observed package id 'add-ons;addon-google_apis-google-24' in 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24'. Skipping duplicate at 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24-1'
Incremental java compilation is an incubating feature.
:leafsnap:clean
:leafsnap:preBuild UP-TO-DATE
:leafsnap:preDebugBuild UP-TO-DATE
:leafsnap:checkDebugManifest
:leafsnap:preReleaseBuild UP-TO-DATE
:leafsnap:prepareComAndroidSupportAppcompatV72100Library
:leafsnap:prepareComAndroidSupportSupportV42100Library
:leafsnap:prepareComGoogleAndroidGmsPlayServices6171Library
:leafsnap:prepareSeEmilsjolanderStickylistheaders252Library
:leafsnap:prepareDebugDependencies
:leafsnap:compileDebugAidl
:leafsnap:compileDebugRenderscript
:leafsnap:generateDebugBuildConfig
:leafsnap:mergeDebugShaders
:leafsnap:compileDebugShaders
:leafsnap:generateDebugAssets
:leafsnap:mergeDebugAssets
:leafsnap:generateDebugResValues UP-TO-DATE
:leafsnap:generateDebugResources
:leafsnap:mergeDebugResources
:leafsnap:processDebugManifest
:leafsnap:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':leafsnap:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\build-tools\21.0.0\aapt.exe'' finished with non-zero exit value -1073741819
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
I can't figure out what's wrong with it. Can anyone help?
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
You're using gradle plugin 2.1.3 which according to documentation needs the following as must have dependencies.
Android Plugin for Gradle, Revision 2.1.3 (August 2016)
Dependencies:
Gradle 2.14.1 or higher.
Build Tools 23.0.2 or higher.
This update adds compatibility with Gradle 2.14.1, which includes performance improvements, new features, and an important security fix.
For more details, see the Gradle release notes.
whereas your build tool version currently set as buildToolsVersion "21.0.0".
Change the build tool version to 23.0.2, update the support and appcompat dependencies accordingly and sync again.

Android studio with experimental gradle 0.2.0

I am trying to setup a basic ndk build with the latest version of android studio at this moment. Trying to follow this tutorial
This is my gradle-wrapper.properties
#Thu Sep 17 14:22:34 CST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
This is the project build.gradle
// 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-experimental:0.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is my module's build.gradle
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.1"
defaultConfig.with {
applicationId = "me.blubee.testnative_exp"
minSdkVersion = 10
targetSdkVersion = 23
versionCode = 1
versionName = "1.0"
}
buildConfigFields.with {
create() {
type = "int"
name = "VALUE"
value = "1"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
}
android.productFlavors {
create("flavor1") {
applicationId = 'com.app'
}
}
android.sources {
main {
java {
source {
srcDir 'src'
}
}
}
}
}
}
my project structure looks like this:
APP
Java/
Java/android.support
Java/com.test.test_experimental
Java/com.test.test_experimental/R
Java/com.test.test_experimental
Java/com.test.test_experimentalBuildConfig
Java/com.test.test_experimental
Java/com.test.test_experimental/MainActivity
tests/
tests/com.test.test_experimental
tests/com.test.test_experimental/ApplicationTest.java
tests/com.test.test_experimental
tests/com.test.test_experimental/BuildConfig.java
resources/
test-resources
gradle/scripts/
I am getting these errors:
2:51:31 PM Gradle sync started
2:51:34 PM Gradle sync failed: Unable to load class 'com.android.build.gradle.managed.ProductFlavor_Impl'.
Consult IDE log for more details (Help | Show Log)
Error:Unable to load class 'com.android.build.gradle.managed.ProductFlavor_Impl'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)</li><li>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)</li><li>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.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Brother:TestNative_exp blubee$ ./gradlew clean --stacktrack
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/bb/TestNative_exp/app/build.gradle' line: 10
* What went wrong:
A problem occurred configuring project ':app'.
> Exception thrown while executing model rule: model.android
> Cannot set readonly property: minSdkVersion for class: com.android.build.gradle.managed.ProductFlavor_Impl
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.619 secs
line #10 is: minSdkVersion = 10
You can see the whole file in the build.gradle that i put above.
edit
As #unbekant pointed out in his comment and the link to this post
The min and target sdk values should be set like this:
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
I tried that as well, I get this error:
* What went wrong:
A problem occurred configuring project ':app'.
> Exception thrown while executing model rule: model.android
> No such property: buildConfigFields for class: com.android.build.gradle.managed.AndroidConfig
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
What am I doing wrong?
You have to put these blocks outside the android block.
android.buildTypes
android.sources
android.productFlavors
Also the buildConfigFields.with should be inside the defaultConfig or inside the buildTypes or productFlavors:
Something like:
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
//----
minSdkVersion.apiLevel = 10
targetSdkVersion.apiLevel = 23
buildConfigFields.with {
create() {
//....
}
}
}
}
android.buildTypes {
release {
//
}
}
android.productFlavors {
//
}
// Configures source set directory.
android.sources {
//
}
}
Also, the last version is 0.2.1.
classpath 'com.android.tools.build:gradle-experimental:0.2.1'
There's a tutorial? Oh, that. Where are the links?
The current version is 0.2.0.
or dates?
I googled every one of the missing files individually (maybe 3 dozen!) after adding:
classpath 'com.android.tools.build:gradle-experimental:0.2.1'
I tried the alpha version too but I failed finding some of its dependencies altogether.
First I get a couple of dependencies I can be bothered chasing down:
> Error:Could not find com.android.tools.build:gradle-experimental:0.2.1.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle-experimental/0.2.1/gradle-experimental-0.2.1.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle-experimental/0.2.1/gradle-experimental-0.2.1.jar
Once each of these was added to the given path seven more would sprout up in its place. If someone could post how to automatically update these (they still aren't in the latest 1.4RC1 Android Studio) it would be very useful. I got most of the stuff from maven, eg http://mvnrepository.com/artifact/com.android.tools.lint/lint-checks/24.3.1
I got all the files to shut up Gradle's whining and you know what it said?
Error:(34, 1) A problem occurred evaluating project ':app'.
> Error: NDK integration is deprecated in the current plugin. Consider trying the new experimental plugin. For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental. Set "android.useDeprecatedNdk=true" in gradle.properties to continue using the current NDK integration.
Which was exactly the error that led me to migrate to experimental and no better than the stock 1.3.0 that ships with AS (though it was defaulting to 1.2.3).
Why did I bother? I want to debug NDK and couldn't see what else I wasn't doing apart from not using an experimental build.
This goose chase was just a big waste of time. I'm back to using
android.useDeprecatedNdk=true
No doubt I can fix it somewhere else but just a warning to others chasing experimental dependencies; they are unicorns.
#jonagon
Some examples are in this repo:
https://github.com/googlesamples/android-ndk
probably could try:
Use the latest plugin version. Find it at:https://jcenter.bintray.com/com/android/tools/build/gradle-experimental
check https://github.com/googlesamples/android-ndk/blob/master/hello-jni/app/build.gradle for product flavors
jni folder issue:
it is default for gradle experimental plugin, also for older c++ support NOT using gradle-experimental plugin ( android plugin )
if you have that folder and not using experimental plugin, Gradle thinks that app is using the older android studio c++ support. It gives your that warning "NDK integration is deprecated in the current plugin" and recommend you to experimental plugin. it could be silenced with:
sourceSets.main.jni.srcDirs = []
or just rename that jni folder to something else: it will cause more trouble if you want to android-studio cmake/ndk-build in the future, rename is better.

Android Project Dependency Needs Different Version of Android Gradle Plugin

The gradle build of my Android project is failing because a dependency of my project needs an older version of the android gradle plugin:
Download https://repo1.maven.org/maven2/org/springframework/android/spring-android-core/1.0.1.RELEASE/spring-android-core-1.0.1.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/spring-asm/3.0.7.RELEASE/spring-asm-3.0.7.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/spring-core/3.0.7.RELEASE/spring-core-3.0.7.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/security/spring-security-crypto/3.1.3.RELEASE/spring-security-crypto-3.1.3.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/social/spring-social-core/1.0.2.RELEASE/spring-social-core-1.0.2.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/android/spring-android-auth/1.0.1.RELEASE/spring-android-auth-1.0.1.RELEASE.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.1.1/jackson-annotations-2.1.1.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.1.1/jackson-core-2.1.1.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.1.2/jackson-databind-2.1.2.jar
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':myapp'.
> Could not resolve all dependencies for configuration ':myapp:classpath'.
> Could not find any version that matches com.android.tools.build:gradle:0.7.+.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
https://maven.fabric.io/public/com/android/tools/build/gradle/maven-metadata.xml
https://maven.fabric.io/public/com/android/tools/build/gradle/
Required by:
phase1:myapp:unspecified > com.jakewharton.hugo:hugo-plugin:1.1.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 20.894 secs
My project uses com.android.tools.build:gradle:1.0.0, but the dependency, com.jakewharton.hugo, is looking for gradle:0.7.+.
Here are my gradle build files.
Top-level build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Subproject build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'hugo'
android {
compileSdkVersion 20
buildToolsVersion '21.1.2'
defaultConfig {
minSdkVersion 13
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
..
..
..
Looking up Hugo on Github, I verified that release 1.1.0 does ask for the version 0.7.+, but the latest code (unreleased) use the new version (1.1.0)
Is there a way to allow Hugo to build with the old version, while building the rest of my project with the new one?
OR
I copied the top level Hugo source directory from Github into my project. How do I tell gradle to find the hugo plugin there?
We experienced the same issue. If you change your repository to mavenCentral() from jcenter(), it should resolve the issue. Its also possible to have both repositories.

Trouble with integrating Play Game Services (can't find a specific version of android support library)

I am trying to integrate the Google Play Game Services with my project. I have added the play services as a dependency to my build.gradle, but when I try to rebuild the project I get this error:
* What went wrong:
A problem occurred configuring project ':android'.
> Could not resolve all dependencies for configuration ':android:_debugCompile'.
> Could not find com.android.support:support-v4:19.0.1.
Required by:
Taxi Trouble:android:1.0 > com.google.android.gms:play-services:4.3.23
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
According to the SDK manager I have version 19.1, instead of the required 19.0.1. Can I install this older version of the support library?
Please share your build.gradle file. The following example, taken from an update to the Play-Google Play Games Services GitHub pages, shows a working build.gradle file with the latest support library.
First, note that there are multiple build.gradle files and settings.gradle files in a particular project/workspace. Let's focus on the two most likely candidates for breaking your build.
root (build.gradle) (e.g. root/build.gradle)
Android module for your app (e.g. root/module/build.gradle)
Root project build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
build.gradle from within a project module:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:4.3.23'
//compile project(':libraries:BaseGameUtils')
}
buildscript {
repositories {
mavenCentral()
}
}
repositories {
}
}
It's a little confusing at first but your gradle build library version must match your ADT version which must match your GMS version. As Android Studio stabilizes, required updates to match configurations across tools and Android libraries will hopefully become less common.

Categories

Resources