引进项目给予错误在Android Studio中1.2.1.1 [英] imported projects give error in android studio 1.2.1.1

查看:924
本文介绍了引进项目给予错误在Android Studio中1.2.1.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Android工作室1.2.1.1,它并没有给我任何错误的新项目。
但对于引进项目它给了我关于不匹配的编码的警告(这个问题)。我改变了项目,IDE编码设置为UTF-8,此警告不会出现了。结果
不过,在那之后,它给了我这个错误。

<$p$p><$c$c>F:\\Work\\workspace\\NITask\\app\\build\\intermediates\\res\\debug\\drawable-hdpi-v4\\ic_launcher.png:错误:重复的文件。
F:\\工作\\工作区\\ NITask \\程序\\建立\\中间体\\水库\\调试\\绘,华电国际\\ ic_launcher.png:原来是在这里。该版本预选赛可能暗示。
错误:执行失败的任务:应用程序:processDebugResources。
&GT; com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程'命令'D:\\ SDK \\构建工具\\ 22.0.1 \\ aapt.exe'非零出口成品值1

和在这些项目中,有不属于R类我主要的模块中。结果
我读像非零退出值完成许多问题,但不实用

更新:结果
清洁工程后,它给了我关于我的很多资源的错误是这样的:

  AAPT ERR(1779619686):F:\\工作\\工作区\\ NITask \\程序\\ SRC \\主\\水库\\绘制-xhdpi \\ shadow.png:警告的libpng:ICCP:不承认已编辑的已知sRGB模式


第一:

 的libpng警告:ICCP:不承认已被编辑已知sRGB模式

ICCP只是警告。他们是不是错误,他们没有失败,你的应用程序建立这么忽略它。

第二:

实际误差

<$p$p><$c$c>F:\\Work\\workspace\\NITask\\app\\build\\intermediates\\res\\debug\\drawable-hdpi-v4\\ic_launcher.png:错误:重复的文件。
F:\\工作\\工作区\\ NITask \\程序\\建立\\中间体\\水库\\调试\\绘,华电国际\\ ic_launcher.png:原来是在这里。该版本预选赛可能暗示。

由于第三方库的使用ic_launcher在THR库可能会出现此错误。
你可以解决这个问题:

1)清理项目,并重建它。

2)创建一个文件夹\"mipmap-mdpi\",\"mipmap-hdpi\",\"mipmap-xhdpi\",\"mipmap-xxhdpi\"并复制 ic_launcher 图标并将其放置在基于尺寸的相应文件夹中。

  RES /
MIP贴图MDPI / ic_launcher.png(48×48像素)
MIP贴图华电国际/ ic_launcher.png(72x72不等#)
MIP贴图xhdpi / ic_launcher.png(96×96)
MIP贴图xxhdpi / ic_launcher.png(144x144)
MIP贴图xxxhdpi / ic_launcher.png(192x192)

给参考你的XML文件中的图标,

 安卓图标=@的mipmap / ic_launcher

的原因的mipmap文件夹(据的谷歌):


  

这是把你的应用程序图标的文件夹mipmap-最佳实践(而不是
  drawable-文件夹),因为它们是在从不同的分辨率用于
  该器件的电流密度。


3)如果上述解决方案无法解决,然后重命名绘制 - * 文件夹中的绘制 - * - V4 其中* MDPI,华电国际,xhdpi或xxhdpi 的),并把所有的可绘制在其中。

  RES /
绘制-MDPI-V4 /
绘制-HDPI-V4 /
绘制-xhdpi-V4 /
绘制-xxhdpi-V4 /

在此之后做的 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

解决方案

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

这篇关于引进项目给予错误在Android Studio中1.2.1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆