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.
"PNG" in the error is clearly written in caps. So you need to see that the image has .PNG extension (in Capital).
Step 1: Open the image in Paint.
Step 2: Save the image Save as .PNG shown as below Click here to see how to save the image in PNG
Step 3: Refresh your project
Step 4: You should see like this -> See here
Please do reply if the issue is still not resolved
As for me, what was happening is that I cloned the repository on Windows, and those PNG files were symlinks in Linux/Mac, but on Windows they were just invalid files. Once I did proper copies of the files instead of being symlinks, the build worked.
Try this in build.gradle
It might be because of renaming problem of the Image just cut the images and paste any where in the system and open each with the respective editor and save as the same but of
PNG
format and then copy and paste again to drawable folders. It works for meAND PLEASE LOOK AT THE ISSUE WHICH I SUBMITTED TO THE ANDROID STUDIO TEAM
Hope it will help you all .
If you are using Mac OS, follow the steps below to get a png
This will give you a valid png
Mere renaming or changing extension won't work in Mac OS.
Try run command
in your root project directory, it will show you all files that have .png extension, but are not pngs. Then you can resave them as png in some image editor. Before running this command clean project, to speed up the process.