我收到此错误。我能做什么。请帮助我是 android studio 的新手。 我已尽力解决此问题,但无法解决此问题,请帮助。 我收到这个错误。 错误:任务“:libraryMaskLayout:processDebugResources”执行失败。
无法解析XML资源文件'D:\Android\FastChargerAdmob\libraryMaskLayout uild\intermediates undles\debug es alues alues.xml'
编辑:我更新了帖子并发布了我的项目中的所有 gradle 文件。 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:3.0.0'
classpath 'com.google.gms:google-services:3.0.0'
// 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
}
Build.gradle(模块:应用程序)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.TuAndroidPR.fast.Chargin"
minSdkVersion 15
targetSdkVersion 25
versionCode 2
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
testCompile 'junit:junit:4.12'
compile project(':libraryMaskLayout')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'cn.fanrunqi:waveprogress:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
//noinspection GradleCompatible
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
Build.gradle(模块:libraryMaskLayout)
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile files('libs/annotations-12.0.jar')
}
我在升级我的
buildToolsVersion
时遇到了这个问题。如果其他人遇到这个问题,这就是我所做的解决方法:
我打开了gradle的
--stacktrace
,发现在上面的“无法解析XML资源文件”之后,发现它吐出以下错误:
Error:java.lang.IllegalArgumentException:
Error: ' ' is not a valid resource name character
在
debug/res/values/values.xml
中,我发现了这个:
<enum name="DARKEN " value="2"/>
根据 Android XML 规则,“元素名称”不能有空格 (
"DARKEN "
)。
搜索
"DARKEN "
,它会在我的一个 XML 文件中找到一个 <enum>
名称,并将 "DARKEN "
设置为 XML 元素名称。我删除了尾随空格,并编译了代码。
lib 构建.gradle
依赖项{ ... 编译 'com.android.support:support-annotations:27.0.1' }
我已经通过从 strings.xml 中手动删除多余的引号解决了这个问题...
详细内容:如何解决AndroidStudio中的ArrayIndexOutOfBoundsException: Index 2048 out ofbounds for length 2048