gpt4 book ai didi

java - Android:无效的资源文件

转载 作者:搜寻专家 更新时间:2023-11-01 09:34:50 24 4
gpt4 key购买 nike

我刚刚下载了最新的 Android Studio 3.0 Preview Canary 2。它用最新的 gradle com.android.tools.build:gradle:3.0.0-alpha2 更新了我的项目。现在我有很多编译崩溃,比如:

ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-xhdpi-v4\notification_bg_low_normal.9.png not a valid resource file

ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-xhdpi-v4\notification_bg_low_normal.9.png not a valid resource file

ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\design-25.3.1.aar\ab2edc05ef7bbad4b3861a867a381098\res\drawable-xxxhdpi-v4\design_ic_visibility.png not a valid resource file

ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\design-25.3.1.aar\ab2edc05ef7bbad4b3861a867a381098\res\drawable-xxxhdpi-v4\design_ic_visibility.png not a valid resource file

ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-mdpi-v4\abc_menu_hardkey_panel_mtrl_mult.9.png not a valid resource file

ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-mdpi-v4\abc_menu_hardkey_panel_mtrl_mult.9.png not a valid resource file

ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-xxxhdpi-v4\abc_spinner_mtrl_am_alpha.9.png not a valid resource file

ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-xxxhdpi-v4\abc_spinner_mtrl_am_alpha.9.png not a valid resource file


ERROR: C:\Users\??????\\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\a33e01f0d19405567201ecab1e032796\res\drawable-mdpi-v4\abc_btn_check_to_on_mtrl_000.png not a valid resource file

FAILURE: Build failed with an exception.

* What went wrong: Execution failed for task ':app:mergeDebugResources'.
> Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed: aapt2 compile -o D:\AndroidProjects\GetPet\app\build\intermediates\res\merged\debug C:\Users\user\\.gradle\caches\transforms-1\files-1.1\design-25.3.1.aar\ab2edc05ef7bbad4b3861a867a381098\res\layout\design_navigation_item.xml Issues:
- ERROR: C:\Users\user\\.gradle\caches\transforms-1\files-1.1\design-25.3.1.aar\ab2edc05ef7bbad4b3861a867a381098\res\layout\design_navigation_item.xml not a valid resource file

我尝试清理项目和 gradle 缓存,但没有用。

我的build.gradle

buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'

// 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
}

app\build.gradle

apply plugin: 'com.android.application'

android {
signingConfigs {
config {
keyAlias 'alias'
keyPassword 'pass'
storeFile file('release_keystor.jks')
storePassword 'pass'
}
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.org.app"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.config
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.vk:androidsdk:1.6.5'
}

最佳答案

尝试将服务目录路径更改为没有西里尔符号的内容,例如

中的“C:/gradle”

Settings > Build, Execution, Deployment > Gradle

不要忘记使缓存失效。

关于java - Android:无效的资源文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44218215/

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