1

用 android-maven-plugin 编译我的项目给了我以下 png 错误。带有 android-m2e 的 Eclipse 可以毫无问题地编译并部署到我的平板电脑上。这是 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').
4

1 回答 1

0

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

参考:Canvas & Drawables

于 2015-10-19T10:40:08.103 回答