【问题标题】:Gradle build Error or Bug in Android StudioAndroid Studio 中的 Gradle 构建错误或错误
【发布时间】:2016-02-12 13:45:43
【问题描述】:

我关注this SO answer 来修复,当 Android Studio 给我错误 Gradle plugin is old ,现在有一个小问题现在我收到错误 SAXParseException 这里是错误信息。

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'.

这是我的build.gradle(Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.jutt.fyp.isec"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

build.gradle(项目:测试)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-beta4'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我尝试关注SO answer fix,但没有成功,我认为有问题或再次更新?

【问题讨论】:

  • 尝试 buildToolsVersion '23.0.2' 而不是 buildToolsVersion "23.0.2"
  • 无效,同样的错误

标签: android android-gradle-plugin build.gradle


【解决方案1】:

删除这个

$ANDROID_HOME/build-tools/and remove the 23.0.0-preview directory fixed the errors.

示例:在窗口中

C:\Users\Sharma\Desktop\xxx\Android\sdk\build-tools

希望对你有帮助

【讨论】:

  • 没有 23.0.0-rc3 ,有 23.0.0-preview23.0.2 文件夹.
  • 我应该删除其中的任何一个吗?上面提到的?
  • 只删除 23.0.0-preview 并告诉我这个
  • 删除23.0.0-preview 目录解决了我的问题,谢谢
【解决方案2】:

删除 23.0.0-preview/(正如 gvsharma 指出的那样)和 23.0.0_rc1/ 解决了我的问题。

例如

[root@cobalt Sdk]# ls
add-ons  build-tools  docs  extras  licenses  lldb  ndk-bundle  platforms  platform-tools  samples  SDK Readme.txt  sources  system-images  temp  tools
[root@cobalt Sdk]# cd build-tools/
[root@cobalt build-tools]# ls
17.0.0  18.0.1  18.1.0  18.1.1  19.0.1  19.0.2  19.0.3  19.1.0  20.0.0  21.0.0  21.0.1  21.0.2  21.1.2  22.0.1  23.0.0-preview  23.0.0_rc1  23.0.1  23.0.2  android-4.4  android-4.4W
[root@cobalt build-tools]# rm -rf 23.0.0-preview/
[root@cobalt build-tools]# rm -rf 23.0.0_rc1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-13
    • 2015-02-06
    • 2016-08-05
    • 2017-03-25
    • 2016-01-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多