Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 575
maysi Avatar asked Jul 28 '13 11:07

maysi


People also ask

What is Gradle error in Android Studio?

In some cases when your Gradle files are deleted or corrupted you will not be able to download new Gradle files in android studio. In this case, we have to delete the Gradle files which are present already and then again sync your project to download our Gradle files again.

How do I resolve Gradle project Sync failed?

Then open Android Studio and go to File > Settings > Build, Execution and Deployment > Gradle > Use Gradle from > Set the path of the downloaded Gradle. Step 4. Now try syncing the Gradle again and check if the error still persists.

How do I reset Gradle sync?

Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.


3 Answers

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 !! :)

like image 170
Prachi Avatar answered Oct 06 '22 01:10

Prachi


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.

like image 37
speedynomads Avatar answered Oct 06 '22 01:10

speedynomads


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')
like image 21
Sofi Software LLC Avatar answered Oct 05 '22 23:10

Sofi Software LLC