android - 导入的项目在 android studio 1.2.1.1 中出错

标签 android android-studio

我使用 android studio 1.2.1.1,它不会给我新项目的任何错误。 但是对于导入的项目,它会给我一个关于不匹配编码的警告(this issue)。我将项目和 IDE 编码更改为 UTF-8,此警告不再出现。
但是,在那之后,它给了我这个错误。

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

在这些项目中,我的主模块中没有 R 类。
我读了很多问题,比如finished with non zero exit value但没有用

更新:
清理项目后,它给我很多关于我的资源的错误,如下所示:

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

最佳答案

我有同样的问题,我通过添加来解决它 xmlns:tools="http://schemas.android.com/tools"到 mainfest 文件的顶部,并将 tools:replace="android:icon"添加到应用程序标签。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"  // add tools line here 
    package="yourpackage">


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:icon"> //add this line 

.....

</application>

</manifest>

关于android - 导入的项目在 android studio 1.2.1.1 中出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30393726/

相关文章:

java - 关于Android布局文件

php - 具有POST方法和httpurlconnection的Android到Php服务器

android - 我怎样才能强制Android垃圾收集旧的套接字信息?

android-studio - Android Studio 3.1.3 没有 Items 预览?

java - 无法在 Android Studio 中解析符号 "R",但编译没有问题

java - 从 AsyncTask 返回数据到 MainActivity 的最佳方式

android - 我的 Android ListView 项目布局看起来很糟糕

android - 无法从 admob 加载奖励视频

android - 在 Android Studio 3.3 中分析失败

java - Android Studio : How do I get a button in main activity to do something in a fragment when they aren't directly connected?