maysi
maysi

Reputation: 5517

Gradle error on Android Studio startup

Every time I start Android Studio I get the following error:

Gradle 'VertretungsplanProject' project refresh failed: Could not fetch model of type 'IdeaProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'. A problem occurred configuring project ':Vertretungsplan'. A problem occurred configuring project ':Vertretungsplan'. Failed to notify project evaluation listener. A problem occurred configuring project ':libraries:actionbarsherlock'. Failed to notify project evaluation listener. Could not normalize path for file 'P:\Projekte\VertretungsplanProject\libraries\actionbarsherlock:Vertretungsplan\libs\android-support-v4.jar'. The syntax for the filename, directoryname or the volume label is wrong

My project looks like this:

enter image description here

Gradle settings:

enter image description here

build.gradle of :Vertretungsplan:

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

dependencies {
    compile files('libs/commons-io-2.4.jar')
    compile project(':libraries:actionbarsherlock')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 16
    }
}

build.gradle of :VertretungsplanProject is empty.

build.gradle of :actionbarsherlock:

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

dependencies {
    compile files(':Vertretungsplan/libs/android-support-v4.jar')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

When I want to compile now this error appears:

Deprecated make implementation
Old implementation of "Make" feature is enabled for this project. It has been deprecated and will be removed soon. Please enable newer 'external build' feature in Settings | Compiler.

After changing this setting to Use external build everything is working fine. But this appears every time I start Android Studio and this is really annoying.

UPDATE

I deleted the android-support-v4.jar from the libs folder and simply wrote compile 'com.android.support:support-v4:18.0.0' to the build.gradle of ActionbarSherlock. Then the android-support-v4.jar is used from the installed SDK.

Upvotes: 12

Views: 36495

Answers (3)

Prachi
Prachi

Reputation: 3672

EDIT

  1. Go to File > Settings > "Build,Execution,Deployment"> Compiler

Click compiler directly.

  1. Check the option: Use external build > Apply > OK.

It worked for me !! :)

Upvotes: 7

speedynomads
speedynomads

Reputation: 2682

You seem to have more than one issue. Problems loading gradle on startup and problems resolving the dependency path name in your environment.

I recently found a fix for the "Failed to import Gradle project" issue, which could be linked to your dependency issue.

At least if you fix one, you know your issue could specifically be the dependency path resolution rather than a gradle/android studio issue...

Check out the troubleshooting section here: http://developer.android.com/sdk/installing/studio.html#Troubleshooting

The basic steps are: 1. Close android studio 2. Open the SDK manager (run android binary/executable which should be in /tools) 3. Scroll down the list and expand extras 4. Tick the "Android Support Repository" 5. Click Install Packages.. etc etc...

You need to download this as Android Studio 0.2.x needs a new maven repository used by the new build system for the support library, instead of using support library jar's.

Let us know if anything changes after trying this fix.

Upvotes: 2

Sofi Software LLC
Sofi Software LLC

Reputation: 3939

In the error message, the path appears: 'P:\Projekte\VertretungsplanProject\libraries\actionbarsherlock\:Vertretungsplan\libs\android-support-v4.jar'

It looks like you're on Windows. The semicolon before Vertretungsplan is not a legal filesystem character. This appears in your script as

compile files(':Vertretungsplan/libs/android-support-v4.jar')

Try changing this to

compile files('Vertretungsplan/libs/android-support-v4.jar')

Upvotes: 1

Related Questions