【问题标题】:when i add imageview why show error libpng error: Not a PNG file?当我添加 imageview 为什么显示错误 libpng 错误:不是 PNG 文件?
【发布时间】:2016-08-28 06:13:00
【问题描述】:

当我在布局中添加 imageview 时为什么会显示错误 AAPT err(Facade for 817338050): libpng error: Not a PNG file

失败

FAILURE:构建失败并出现异常。

  • 出了什么问题: 任务 ':app:mergeDebugResources' 执行失败。

    部分文件处理失败,详情请查看日志

我已经尝试过this,但仍然对我不起作用..我的文件名 splashscreen.png

日志猫

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:library:preBuild UP-TO-DATE
:library:preReleaseBuild UP-TO-DATE
:library:compileReleaseNdk UP-TO-DATE
:library:compileLint
:library:copyReleaseLint UP-TO-DATE
:library:checkReleaseManifest
:library:prepareReleaseDependencies
:library:compileReleaseAidl UP-TO-DATE
:library:compileReleaseRenderscript UP-TO-DATE
:library:generateReleaseBuildConfig UP-TO-DATE
:library:generateReleaseAssets UP-TO-DATE
:library:mergeReleaseAssets UP-TO-DATE
:library:generateReleaseResValues UP-TO-DATE
:library:generateReleaseResources UP-TO-DATE
:library:packageReleaseResources UP-TO-DATE
:library:processReleaseManifest UP-TO-DATE
:library:processReleaseResources UP-TO-DATE
:library:generateReleaseSources UP-TO-DATE
:library:compileReleaseJavaWithJavac UP-TO-DATE
:library:extractReleaseAnnotations UP-TO-DATE
:library:mergeReleaseProguardFiles UP-TO-DATE
:library:packageReleaseRenderscript UP-TO-DATE
:library:processReleaseJavaRes UP-TO-DATE
:library:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:library:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:library:mergeReleaseJniLibFolders UP-TO-DATE
:library:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:library:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:library:bundleRelease UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2400Alpha2Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72400Alpha2Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2400Alpha2Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72400Alpha2Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42400Alpha2Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2400Alpha2Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE
:app:prepareComGoogleMapsAndroidAndroidMapsUtils043Library UP-TO-DATE
:app:prepareDeHdodenhofCircleimageview130Library UP-TO-DATE
:app:prepareEPlaceCopy2CopyLibraryUnspecifiedLibrary UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
AAPT err(Facade for 817338050): libpng error: Not a PNG file
Error:Execution failed for task ':app:mergeDebugResources'.
> Some file crunching failed, see logs for details
Information:BUILD FAILED
Information:Total time: 16.704 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

这是我的splashscreen.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#0099cb"
    android:orientation="vertical" >



    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/splashscreen"/>

</RelativeLayout>

【问题讨论】:

标签: android png logcat


【解决方案1】:

你可能犯了一个错误。你是直接改扩展名的吗? 您必须使用诸如paint或photoshop之类的东西来更改扩展名,而不是重命名它。

【讨论】:

  • 我试过了,但仍然不适合我。原始文件名为 E-Place.png,我使用 Photoshop 打开它并以名称 splashscreen.png 保存到可绘制文件夹
  • 你一开始的图片是什么格式的?
  • png.我使用 Photoshop 创建了启动画面
  • 所以你将它保存为 png 或之后你重命名了扩展
  • 首先我尝试在没有工具的情况下更改扩展名,但在错误之后我打开原始图像(更改前)为 splashscreen.png
猜你喜欢
  • 2014-06-15
  • 2016-02-24
  • 2014-11-15
  • 2014-03-30
  • 2012-05-13
  • 2016-08-15
  • 2016-03-17
  • 1970-01-01
相关资源
最近更新 更多