libpng error: Not a PNG file Error Showing In Andr

2020-01-24 12:41发布

I just Imported a project from Eclipe to Android Studio. Just a plain and simple project. But the project folder is showing one error .

May I know what is the correct way to achieve my objective? I am new in Android-studio .Does any guys meet this issue?Any help would be greatly appreciated.

Here is Logcat :

Execution failed for task ':app:mergeDebugResources'.
> Error: Failed to run command:
    /home/amiya/android-studio/sdk/build-tools/android-4.4.2/aapt s -i /home/amiya/vola/app/src/main/res/drawable-mdpi/call.png -o /home/amiya/vola/app/build/res/all/debug/drawable-mdpi/call.png
  Error Code:
    42
  Output:
    libpng error: Not a PNG file

Here is my build.gradle

 apply plugin: 'android'

android {


    compileSdkVersion 19
    buildToolsVersion "19.0.3"



    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 19
    }


    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }



}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:support-v4:+'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/google-play-services.jar')
    compile files('libs/livesdk.jar')
}

I am not using this file anywhere in my project with that name !! There are many other png files in my project though.

8条回答
够拽才男人
2楼-- · 2020-01-24 13:10

You should follow below steps.

  1. Cut-paste the image on my desktop.

  2. Opened it in an editor saved it as png. without renaming the file name.

  3. Copy-pasted the .png image into the drawable folder.

You can use cruncherEnabled.

Returns true if the PNGs should be crunched, false otherwise.

android 
{ 
   aaptOptions
   {
   cruncherEnabled = false
   } 
}

Hope this helps you.

查看更多
We Are One
3楼-- · 2020-01-24 13:13

Try to use another png files. It seems something wrong with png's metadata. I had the same issue. Then I used some other png files and it fixed my issue.

查看更多
登录 后发表回答