This error occurred today after I updated Android Studio from 2.2 to 2.3 and launched the application on my phone. Last Friday, everything was in order. This Monday gift ruined me all day.
Gradle option "Use local gradle distribution", version 3.3.
the log information is as below because it is too long and they are all alike, I just copied some segments:
Error: Some file crunching failed, see logs for details :app:mergeDebugResources FAILED AAPT: \\?\C:\Users\任\.android\build-cache\41cfce3bb6e2ca4b269727fe91725c24a067ec68\output\res\drawable-mdpi-v4\abc_btn_switch_to_on_mtrl_00012.9.png ERROR: Unable to open PNG file AAPT: \\?\C:\Users\任\.android\build-cache\41cfce3bb6e2ca4b269727fe91725c24a067ec68\output\res\drawable-xxhdpi-v4\abc_ic_star_half_black_48dp.png ERROR: Unable to open PNG file AAPT: \\?\C:\Users\任\.android\build-cache\41cfce3bb6e2ca4b269727fe91725c24a067ec68\output\res\drawable-hdpi-v4\abc_ic_menu_share_mtrl_alpha.png ERROR: Unable to open PNG file AAPT: \\?\C:\Users\任\.android\build-cache\41cfce3bb6e2ca4b269727fe91725c24a067ec68\output\res\drawable-xxhdpi-v4\abc_text_select_handle_middle_mtrl_light.png ERROR: Unable to open PNG file AAPT err(Facade for 925134644) : No Delegate set : lost message:\\?\C:\Users\任\.android\build-cache\41cfce3bb6e2ca4b269727fe91725c24a067ec68\output\res\drawable-hdpi-v4\abc_ic_star_half_black_48dp.png ERROR: Unable to open PNG file AAPT err(Facade for 925134644) : No Delegate set : lost message:\\?\C:\Users\任\.android\build-cache\41cfce3bb6e2ca4b269727fe91725c24a067ec68\output\res\drawable-mdpi-v4\abc_switch_track_mtrl_alpha.9.png ERROR: Unable to open PNG file
build.gradle as shown below:
apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion '25.0.2' aaptOptions { cruncherEnabled = false } defaultConfig { minSdkVersion 18 targetSdkVersion 18 } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } } useLibrary 'org.apache.http.legacy' dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:25.2.0' compile 'com.android.support:support-v4:25.2.0' compile 'com.jakewharton:butterknife:7.0.1' compile 'org.jetbrains:annotations-java5:15.0' } }
According to the advice of other questions, although some answers are too outdated, I still tried the following methods, unfortunately, none of them saved me:
1. Remove all .9.png files from my project.
2. check that all png files are real PNG.
3. Paste the following settings for build.gradle:
aaptOptions { cruncherEnabled = false }
4. Check the path to the project file, not up to 255 characters (Windows 10).
5. Clear gradle caches.
6. Invalid caches and restarts.
7. clean design.
I think the log information leads me to files automatically created by Android Studio. Trying to search for .png error files, none of them exist in my project.
Any advice is appreciated.