3

I know there are a couple of threads on this but none seem to solve my problem. I just installed Android Studio v0.4.6 on my Mac. Every time I create a new project I get the error:

 Gradle 'Budget' project refresh failed:
        Content is not allowed in prolog.

In more detail I get:

    Error:A problem occurred configuring root project 'Budget'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve org.ow2.asm:asm-analysis:4.0.
     Required by:
         :Budget:unspecified > com.android.tools.build:gradle:0.7.3 > com.android.tools.lint:lint:22.4.2 > com.android.tools.lint:lint-checks:22.4.2
      > Could not parse POM http://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/4.0/asm-analysis-4.0.pom
         > Content is not allowed in prolog.
   > Could not resolve org.ow2.asm:asm-tree:4.0.
     Required by:
         :Budget:unspecified > com.android.tools.build:gradle:0.7.3 > com.android.tools.lint:lint:22.4.2 > com.android.tools.lint:lint-checks:22.4.2 > com.android.tools.lint:lint-api:22.4.2
      > Could not parse POM http://repo1.maven.org/maven2/org/ow2/asm/asm-tree/4.0/asm-tree-4.0.pom
         > Content is not allowed in prolog.

I can't seem to find a solution to this issue. I tried updating Android Studio to v0.5, changing the dependencies:

dependencies {
    classpath 'com.android.tools.build:gradle:0.5.+'
}

and both of those failed. Any help would really be appreciated!

1
  • "Content is not allowed in prolog" is an XML validation error -- it looks like it's trying to download a POM file from Maven Central to resolve a dependency, and the file it's getting is bad. I'm guessing it's some sort of network or proxy problem, and it's returning an error page when it tries to fetch the URL. I tried including a compile 'org.ow2.asm:asm-analysis:4.0' dependency in a test project, and it works fine for me, so it must be something about your setup. Commented Apr 24, 2014 at 16:06

2 Answers 2

2
  1. First of all, you should have installed the newest version of Android Studio which is 0.5.5. Then update your gradle plugin version to the newest one --> 0.9.+

    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
    
  2. You should check you repositories if all modules/libraries have a correct URL, eg.

    repositories {
        mavenCentral()
    }
    
  3. Verify your local.properties and check if a path to Android SDK is correct.

  4. Try to build your project in the Terminal using your local Gradle distribution and Gradle wrapper: Local distribution:

    gradle clean build
    

    Wrapper:

    ./gradlew clean build
    

    If you don't have the local distribution, install the newest version using e.g homebrew (for mac users) (brew install gradle).

  5. Set the path to the local Gradle distribution in the Android Studio (default path for brew and mac is: /usr/local/Cellar/gradle/1.11/libexec/).

  6. After all these steps close your project and import it again (like you import the project for the very first time).
Sign up to request clarification or add additional context in comments.

10 Comments

My dependencies and repositories both match yours now but the error is still there. My SDK directory is: sdk.dir=/Users/Ryan/Documents/Android/sdk which is where the folder for the SDK is, should it be more specific?
No, it's ok. Did you build your project in terminal? Using your local distribution of gradle and gradle wrapper as well? Verify your local gradle version --> gradle --version. You should have the newest version which is 1.11.
When I checked the version it said gradle: command not found. Do I need to install gradle separately or should it come with AS?
If you have a proper gradle wrapper, you don't have to install it. However it could be helpful in a process of finding a solution for your problem. Install homebrew and then install the newest version of gradle. --> brew install gradle
Ok I installed it and I do have version 1.11. Now how would I build my project in the terminal? Right now I'm still getting the error
|
0

try changing your gradle to this:

  dependencies {
    classpath 'com.android.tools.build:gradle:0.7.+'

 }

3 Comments

I did that and it still failed, I added a more detailed error on my question
try using this link: stackoverflow.com/questions/20933935/… it might give you an idea
Current version is classpath 'com.android.tools.build:gradle:0.9.+'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.