Android libpng 错误:处理 PNG 图像失败 - maven-plugin



使用 android-maven-plugin 编译我的项目给了我以下 png 错误。 Eclipse with android-m2e 可以毫无问题地编译和部署到我的平板电脑上。 这是 aapt 命令和 libpng 的问题吗?

[INFO] /Users/foo/android-sdk-macosx/platform-tools/aapt [package, -f, -M, 
/Users/foo/source/app/abc-android/AndroidManifest.xml, -S, /Users/foo/source/app/abc-
android/res, -S, /Users/foo/source/app/abc-
android/target/unpack/apklibs/com.abc.aws.android_aws_apklib_1.0/res, --auto-add-overlay, 
-A, /Users/foo/source/app/abc-android/target/generated-sources/combined-assets/assets, -I, 
/Users/foo/android-sdk-macosx/platforms/android-15/android.jar, -F, 
/Users/foo/source/app/abc-android/target/abc-android-0.1-SNAPSHOT.ap_, --debug-mode]
[INFO] libpng error: Not a PNG file
[INFO] ERROR: Failure processing PNG image /Users/foo/source/app/abc-android/res/drawable-hdpi/login_full_screen.png
[INFO] /Users/foo/source/app/abc-android/res/layout/achievement_grid_item.xml:7: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/achievement_3_in_arow').
[INFO] /Users/foo/source/app/abc-android/res/layout/achievement_grid_item_post_class.xml:6: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/achievement_3_in_arow').
[INFO] /Users/foo/source/app/abc-android/res/layout/ant_fragment.xml:8: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/distance_bg').
[INFO] /Users/foo/source/app/abc-android/res/layout/ant_fragment.xml:89: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/cadence_bg').
[INFO] /Users/foo/source/app/abc-android/res/layout/ant_fragment.xml:168: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/heat_arrow_narrow_full_both').
[INFO] /Users/foo/source/app/abc-android/res/layout/ant_fragment.xml:198: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/avg_max_separator').
[INFO] /Users/foo/source/app/abc-android/res/layout/ant_fragment.xml:231: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/power_bg').
[INFO] /Users/foo/source/app/abc-android/res/layout/ant_fragment.xml:318: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/total_effort_bg').
[INFO] /Users/foo/source/app/abc-android/res/layout/ant_fragment.xml:350: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/heat_arrow_wide_full_both').
[INFO] /Users/foo/source/app/abc-android/res/layout/ant_fragment.xml:380: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/avg_max_separator').
[INFO] /Users/foo/source/app/abc-android/res/layout/ant_fragment.xml:415: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/resistance_bg').

在 MS Paint 中打开 png 文件并将其重新另存为 png 文件。它会将 png 转换为 32 位格式。由于Android同时支持24位和32位png,这让我认为Adobe Photoshop生成的png有一些Android不喜欢的东西。

参考:画布和可绘制对象

最新更新