android - Gradle 构建错误 : SAXParseException

标签 android android-gradle-plugin saxparser android-build

在构建应用程序时,出现以下错误:

Error:org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0; 
cvc-pattern-valid: Value 'build-tools;23.0.0 rc3' 
is not facet-valid with respect to pattern '[a-zA-Z0-9_\-;.]+' for type 'segmentListType'.

模块级gradle的build.gradle:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "ms.demo.map"
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-maps:8.4.0'
}

即使在清理应用程序后错误仍然存​​在。包的结构与 gradle 文件中描述的 applicationId 不匹配。我使用的是最新版本的 Android Studio(2.0 预览版 9)。

最佳答案

我在更新 android studio 2.0 beta 2 和 gradle 后遇到了同样的问题。如需解决方案,请按照以下步骤操作

  1. 导航到 SDK 路径。
  2. 打开构建工具目录。
  3. 从构建工具目录中删除 23.0.0-preview
  4. build-tools-21.1.2 重命名为 21.1.2

AndroidSdk  Build-tools directory

完成。

关于android - Gradle 构建错误 : SAXParseException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35115114/

相关文章:

android - 程序类型已经存在 : com. google.android.gms.common.api.zzf

JAVA:如何使用具有相同目标命名空间的多个模式的 xerces SAXParser

java - 使用 javax.xml.parsers.DocumentBuilder 解析网页时出现 fatal error

Android:为什么要使用 XMLReader?

安卓平均内存限制

android - Activity.requestPermissions 与 ActivityCompat.requestPermissions

android - Mediaplayer不会退出

android - 以非零退出值完成

android - 检索项目 : No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored' 的父项时出错

android - 如何永久更改应用程序标记的行为?