Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/214.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android:无效的资源文件_Java_Android_Android Studio - Fatal编程技术网

Java Android:无效的资源文件

Java Android:无效的资源文件,java,android,android-studio,Java,Android,Android Studio,我刚刚下载了最新的安卓Studio 3.0预览版金丝雀2。它用最新的gradlecom.android.tools更新了我的项目。构建: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\notifi

我刚刚下载了最新的安卓Studio 3.0预览版金丝雀2。它用最新的gradle
com.android.tools更新了我的项目。构建: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
我试图清理project和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
}
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'
}
app\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
}
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”

设置>生成、执行、部署>渐变


不要忘记使缓存失效。

如果是这样,欢迎您删除
C:\Users\user\.gradle\caches
problem@cricket_007,正如我以前写的,我以前试过。结果是相同的,“新的Android插件需要Gradle版本4.0-milestone-1或更高版本。”@cricket_007,Android Studio自动应用了它。我唯一的想法是,您使用的是预览版本,我相信它主要用于Android O或Java 8开发,但是您使用的是
25.3.1
和SDK 25,那么您为什么要升级?西里尔字母符号在哪里?而不是路径C:\Users\?????\.gradle中的问号。我也有同样的问题,我的Windows用户名是俄语的МааСаМ。我认为作者也有俄罗斯用户名,因为他使用的是VK SDK。问号只是为了隐藏此人的姓名。我不认为这是文字错误,但我在gradle构建消息中遇到了与问号完全相同的错误,路径更改对我很有帮助。嗯,问题的底部是确实有
错误:C:\Users\user\\\.gradle