Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't compile new project with upgraded android studio due to gradle dependencies

I had no trouble using android studio 0.2.2, but then I upgraded to 0.3.6 then the issues started.

I tried searching other questions and found many common gradle issues, but haven't managed to find a solution that would fix this instance.

Error Output

Gradle: A problem occurred configuring project ':ComputerVision'.
   > Failed to notify project evaluation listener.
       > Could not resolve all dependencies for configuration      ':ComputerVision:_DebugCompile'.
           > Could not find any version that matches com.android.support:appcompat-v6:+.
               Required by:
                 ComputerVisionProject:ComputerVision:unspecified

Gradle Code

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
    }
    buildTypes {
        release {
            runProguard true
            proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
        }
    }
    productFlavors {
        defaultFlavor {
            proguardFile 'proguard-rules.txt'
        }
    }
}

dependencies {
     compile 'com.android.support:appcompat-v7:+'
}

Installed Packages

Let me know if you want to see the rest of it

enter image description hereenter image description here

like image 843
Iancovici Avatar asked Nov 29 '13 02:11

Iancovici


People also ask

Where do I put gradle dependencies?

Gradle declares dependencies on JAR files inside your project's module_name /libs/ directory (because Gradle reads paths relative to the build.gradle file). This declares a dependency on version 12.3 of the "app-magic" library, inside the "com.example.android" namespace group.


2 Answers

Look in the local.properties file for your project and make sure it's pointed at the same Android SDK you installed the support repository for, and if it's not, install the support repository there. Android Studio installs its own local SDK, which can be confusing for existing Android developers who already have an SDK set up; we're working on improving life for those folks.

If that doesn't work, then you could try uninstalling and reinstalling the support repository, and poking around and making sure the files are there and you have read permissions to them. The directory structure of mine looks like this:

ls -lR ~/sdk/extras/android/m2repository/com/android/support/appcompat-v7/
total 24
drwxr-x---@ 8 sbarta  admin   272B Oct 30 17:04 18.0.0
-rw-r-----@ 1 sbarta  admin    40B Oct 30 17:05 maven-metadata.xml.sha1
-rw-r-----@ 1 sbarta  admin    32B Oct 30 17:05 maven-metadata.xml.md5
-rw-r-----@ 1 sbarta  admin   343B Oct 30 17:05 maven-metadata.xml
drwxr-x---@ 8 sbarta  admin   272B Oct 30 17:05 19.0.0

/Users/sbarta/sdk/extras/android/m2repository/com/android/support/appcompat-v7//18.0.0:
total 1104
-rw-r-----@ 1 sbarta  admin    40B Oct 30 17:04 appcompat-v7-18.0.0.pom.sha1
-rw-r-----@ 1 sbarta  admin    32B Oct 30 17:04 appcompat-v7-18.0.0.pom.md5
-rw-r-----@ 1 sbarta  admin   652B Oct 30 17:04 appcompat-v7-18.0.0.pom
-rw-r-----@ 1 sbarta  admin    40B Oct 30 17:04 appcompat-v7-18.0.0.aar.sha1
-rw-r-----@ 1 sbarta  admin    32B Oct 30 17:04 appcompat-v7-18.0.0.aar.md5
-rw-r-----@ 1 sbarta  admin   530K Oct 30 17:04 appcompat-v7-18.0.0.aar

/Users/sbarta/sdk/extras/android/m2repository/com/android/support/appcompat-v7//19.0.0:
total 1208
-rw-r-----@ 1 sbarta  admin    40B Oct 30 17:05 appcompat-v7-19.0.0.pom.sha1
-rw-r-----@ 1 sbarta  admin    32B Oct 30 17:05 appcompat-v7-19.0.0.pom.md5
-rw-r-----@ 1 sbarta  admin   652B Oct 30 17:05 appcompat-v7-19.0.0.pom
-rw-r-----@ 1 sbarta  admin    40B Oct 30 17:05 appcompat-v7-19.0.0.aar.sha1
-rw-r-----@ 1 sbarta  admin    32B Oct 30 17:05 appcompat-v7-19.0.0.aar.md5
-rw-r-----@ 1 sbarta  admin   582K Oct 30 17:05 appcompat-v7-19.0.0.aar
like image 134
Scott Barta Avatar answered Sep 21 '22 16:09

Scott Barta


You need to upgrade your build tools...

You need to upgrade your build tools in the android SDK Manager (under Tools->Android->SDK Manager).

Next, you need to edit the build.gradle file in your src directory, and change the buildToolsVersion to the version you upgraded to.

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
    }
}
like image 45
Jason Temple Avatar answered Sep 22 '22 16:09

Jason Temple