gpt4 book ai didi

Android Studio,Gradle 错误。 Prolog 中不允许的内容

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:23:25 25 4
gpt4 key购买 nike

我一直在将 Android Studio 与 Ubuntu 13.10 结合使用,没问题。我决定更新到 14.04,现在我无法让 Android Studio 工作。 Gradle 无法构建并一直提示错误:Prolog 中不允许内容。我所做的只是从头开始创建一个新项目。

  1. Ubuntu 14.04 是从新删除的分区安装的
  2. 使用 Android Studio v5.7,虽然我也尝试过 v4.6
  3. 我安装了 Oracle JDK 并相应地设置了 $JAVA_HOME 路径
  4. 我已经安装了 gradle
  5. 我已确保 build.gradle 具有:

    依赖关系{ 类路径 'com.android.tools.build:gradle:0.9.+'

  6. 我已经尝试过 gradle build clean。它也出错了。

  7. 我尝试过在 Android Studio 中清理/重建项目。出错了。

错误报告:

[Fatal Error] oss-parent-7.pom:2:1: Content is not allowed in prolog.
[Fatal Error] proguard-base-4.10.pom:2:1: Content is not allowed in prolog.
[Fatal Error] commons-compress-1.0.pom:2:1: Content is not allowed in prolog.
[Fatal Error] oss-parent-7.pom:2:1: Content is not allowed in prolog.
[Fatal Error] httpcore-4.1.pom:2:1: Content is not allowed in prolog.
[Fatal Error] commons-logging-1.1.1.pom:2:1: Content is not allowed in prolog.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'ArrayAdapterEx'.
> Could not resolve all dependencies for configuration ':classpath'.

Could not resolve com.squareup:javawriter:2.2.1. Required by: :ArrayAdapterEx:unspecified > com.android.tools.build:gradle:0.9.2 > com.android.tools.build:builder:0.9.2 Could not parse POM http://repo1.maven.org/maven2/com/squareup/javawriter/2.2.1/javawriter-2.2.1.pom Could not resolve org.sonatype.oss:oss-parent:7. Could not parse POM http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom Content is not allowed in prolog. Could not resolve net.sf.proguard:proguard-base:4.10. Required by: :ArrayAdapterEx:unspecified > com.android.tools.build:gradle:0.9.2 > net.sf.proguard:proguard-gradle:4.10 Could not parse POM http://repo1.maven.org/maven2/net/sf/proguard/proguard-base/4.10/proguard-base-4.10.pom Content is not allowed in prolog. Could not resolve org.apache.commons:commons-compress:1.0. Required by: :ArrayAdapterEx:unspecified > com.android.tools.build:gradle:0.9.2 > com.android.tools.build:builder:0.9.2 > com.android.tools:sdklib:22.7.2 Could not parse POM http://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.0/commons-compress-1.0.pom Content is not allowed in prolog. Could not resolve com.google.guava:guava:15.0. Required by: :ArrayAdapterEx:unspecified > com.android.tools.build:gradle:0.9.2 > com.android.tools.build:builder:0.9.2 > com.android.tools:common:22.7.2 :ArrayAdapterEx:unspecified > com.android.tools.build:gradle:0.9.2 > com.android.tools.lint:lint:22.7.2 > com.android.tools.lint:lint-checks:22.7.2 > com.android.tools.lint:lint-api:22.7.2 > com.android.tools.external.lombok:lombok-ast:0.2.2 Could not parse POM http://repo1.maven.org/maven2/com/google/guava/guava/15.0/guava-15.0.pom Could not resolve com.google.guava:guava-parent:15.0. Could not parse POM http://repo1.maven.org/maven2/com/google/guava/guava-parent/15.0/guava-parent-15.0.pom Could not resolve org.sonatype.oss:oss-parent:7. Could not parse POM http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom Content is not allowed in prolog. Could not resolve org.apache.httpcomponents:httpcore:4.1. Required by: :ArrayAdapterEx:unspecified > com.android.tools.build:gradle:0.9.2 > com.android.tools.build:builder:0.9.2 > com.android.tools:sdklib:22.7.2 > org.apache.httpcomponents:httpclient:4.1.1 :ArrayAdapterEx:unspecified > com.android.tools.build:gradle:0.9.2 > com.android.tools.build:builder:0.9.2 > com.android.tools:sdklib:22.7.2 > org.apache.httpcomponents:httpmime:4.1 Could not parse POM http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.pom Content is not allowed in prolog. Could not resolve commons-logging:commons-logging:1.1.1. Required by: :ArrayAdapterEx:unspecified > com.android.tools.build:gradle:0.9.2 > com.android.tools.build:builder:0.9.2 > com.android.tools:sdklib:22.7.2 > org.apache.httpcomponents:httpclient:4.1.1 :ArrayAdapterEx:unspecified > com.android.tools.build:gradle:0.9.2 > com.android.tools.build:builder:0.9.2 > com.android.tools:sdklib:22.7.2 > org.apache.httpcomponents:httpmime:4.1 Could not parse POM http://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom Content is not allowed in prolog.

应用构建.gradle:

apply plugin: 'android'

android {
compileSdkVersion 19
buildToolsVersion "19.0.3"

defaultConfig {
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
}

全局构建等级:

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

allprojects {
repositories {
mavenCentral()
}
}

最佳答案

您可以尝试清除您的 gradle 缓存:gradle clean --refresh-dependencies 并删除 ~/.gradle/caches 的内容。应该有帮助。

有关详细信息,请参阅 https://stackoverflow.com/a/22670684/1243753

关于Android Studio,Gradle 错误。 Prolog 中不允许的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23438375/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com