简体   繁体   中英

Android Studio Error - Unable to open PNG file

错误图片

I am getting the error that is pictured above when I try to build my project in Android Studio.

The file that is mentioned in the error does not exist in that folder. I tried to delete the entire folder hoping it would re-download the needed file. It did re-download the folder but again it did not have that file.

I am not using this file anywhere in my project and as far as I know.

Any help would be greatly appreciated.

Thanks.

Maybe the path of file is too long that it is unable to process it. In my case, it was:

C:\Users\ber$erk-kAjU\Downloads\Compressed\android-xmpp-asmack-sample-master\android-xmpp-asmack-sample-master\XMPPAsmackSample\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\drawable-ldrtl-xxhdp

As you can see, it is huge! I just moved my project to another path, and reduced it to:

D:\AndroidStudioWorkspace\XMPPAsmackSample\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\drawable-ldrtl-xxhdp

Maybe this can help!

Use

Build > Clean Project

To clean the build directory.

I think you are using AppCompat library in your build.gradle file

dependencies {
    compile 'com.android.support:appcompat-v7:+'
}

In order to use any support library in dependency make sure you have downloaded Android Support Repository from SDK manager

支持存储库

After downloading the repository, do sync the project with gradle using tiny gradle button available in toolbar.

After sync completion you will be able to see mentioned png file in directory as shown :

在此输入图像描述

Inside the directory.

EDIT :

If still doesn't solve check the whether your sdk pointing to right sdk from File > Project Structure > Android SDK

Also check this Import Google Play Services library in Android Studio for AppCompat Library

If there is some issue make it correct ans sync project with gradle.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM