Android资源编译失败

时间:2018-12-27 05:28:40

标签: android compilation

我有如下编译错误

here`Android resource compilation failed
Output:  D:\RukhiVivah5\app\src\main\res\mipmap- 
xxxhdpi\ic_launcher_round.png: error: failed to read PNG signature: file 
does not start with PNG signature.

Command: C:\Users\MAHESH\.gradle\caches\transforms-1\files-1.1\aapt2- 
3.2.1-4818971-windows.jar\01d7b921fe2508ed1a0270e1a2e350cc\aapt2-3.2.1- 
4818971-windows\aapt2.exe compile --legacy \
    -o \
D:\RukhiVivah5\app\build\intermediates\res\merged\release \
D:\RukhiVivah5\app\src\main\res\mipmap-xxxhdpi\ic_launcher_round.png
Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #1

我正在尝试从AndroidManifest.xml和我的AndroidManifest.xml更改图标,如下所示。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mahesh.rukhivivah"
android:versionCode="1"
android:versionName="1.0">

<application
android:allowBackup="true"
android:icon="@mipmap/rlvg"
android:label="@string/app_name"
android:roundIcon="@mipmap/rlvg"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name=".MainActivity">
<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

</activity>
<activity android:name=".Location"/>
<activity android:name=".MumbaiMale" />
<activity android:name=".MumbaiFemale" />
<activity android:name=".GujaratMale" />
<activity android:name=".GujaratFemale"/>
</application>

</manifest>

尝试更改AndroidManifest.xml中的Icon时是否有人遇到相同的问题。

1 个答案:

答案 0 :(得分:0)

此问题有多种原因

  1. 您已更改了图像扩展名,例如image为jpeg,并且已将其更改为png。
  2. 您已经使用在线工具转换了图片,并且仅更改了其扩展名,而不是正确的格式。
  3. 尝试添加
      

    aaptOptions {cruncherEnabled = false}

删除缓存文件夹和文件,并重建您的项目,希望它能正常工作。

相关问题