Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imported projects give error in android studio 1.2.1.1

i use android studio 1.2.1.1 and it doesn't give me any error for new projects. but for imported projects it gives me an warning about mismatched Encoding (this issue). i changed project and IDE encoding to UTF-8 and this warning doesn't appear any more.
but , after that , it gives me this error.

F:\Work\workspace\NITask\app\build\intermediates\res\debug\drawable-hdpi-v4\ic_launcher.png: error: Duplicate file.
F:\Work\workspace\NITask\app\build\intermediates\res\debug\drawable-hdpi\ic_launcher.png: Original is here. The version qualifier may be implied.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1

and in these projects , there isn't R class in my main module.
i read many questions like finished with non zero exit value but wasn't useful

update:
after clean project , it gives me many error about my resources like this:

AAPT err(1779619686): F:\Work\workspace\NITask\app\src\main\res\drawable-xhdpi\shadow.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
like image 267
Alex Mercer Avatar asked May 22 '15 09:05

Alex Mercer


1 Answers

FIRST :

libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

iCCP are just warnings. they are not errors and they dont failed your app build so ignore it.

SECOND :

The actual error is

F:\Work\workspace\NITask\app\build\intermediates\res\debug\drawable-hdpi-v4\ic_launcher.png: error: Duplicate file.
F:\Work\workspace\NITask\app\build\intermediates\res\debug\drawable-hdpi\ic_launcher.png: Original is here. The version qualifier may be implied.

This error may occur because of 3rd party libraries uses ic_launcher in thr library. You can solve this by :

1) clean your project and rebuild it.

2) create a folder "mipmap-mdpi","mipmap-hdpi","mipmap-xhdpi","mipmap-xxhdpi" and copy the ic_launcher icons and place it in the respective folder based on the sizes.

res/
mipmap-mdpi/ic_launcher.png (48x48 pixels)
mipmap-hdpi/ic_launcher.png (72x72)
mipmap-xhdpi/ic_launcher.png (96x96)
mipmap-xxhdpi/ic_launcher.png (144x144)
mipmap-xxxhdpi/ic_launcher.png (192x192)

give reference to the icon in your xml file as

android:icon="@mipmap/ic_launcher"

The reason for the mipmap folder (According to Google) :

It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density.

3) If above solution doesn't solve, then rename the drawable-* folder as drawable-*-v4 (where * is mdpi, hdpi, xhdpi or xxhdpi) and place all your drawables in them.

res/ 
drawable-mdpi-v4/
drawable-hdpi-v4/
drawable-xhdpi-v4/
drawable-xxhdpi-v4/

after this do the 1) point and try

like image 76
Rafique Mohammed Avatar answered Sep 23 '22 16:09

Rafique Mohammed