【问题标题】:Getting error when I try to put background in my android program当我尝试将背景放入我的 android 程序时出现错误
【发布时间】:2016-05-06 07:08:36
【问题描述】:

我尝试将任何背景放入我的 android 程序中,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/mypic"
    tools:context="com.mm.openreg.MainActivity">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:id="@+id/S1"
        android:layout_height="60dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="15dp"

        android:layout_centerHorizontal="true">

我得到了这个错误:

AAPT 错误(972607565 的外观):D:\MyAndroid_Prog\MyAndroidProgram\OpenReg\app\src\main\res\drawable\savea.png:libpng 警告:iCCP:无法识别已编辑的已知 sRGB 配置文件 AAPT 错误(1945943478 的外观):libpng 错误:不是 PNG 文件
错误:任务“:app:mergeDebugResources”执行失败。 部分文件处理失败,查看日志了解详情

我尝试了所有方法,但运行程序时仍然出现同样的错误。

有人可以帮忙吗?

  • 我也尝试了 png 文件和小文件 - 但相同

这是我的毕业典礼

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.mm.openreg"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

【问题讨论】:

标签: android xml android-studio gradle


【解决方案1】:

您需要更新构建工具来修复有故障的 aapt。

打开 sdk manager 并安装 build-tools 23.0.1 并更改 build.gradle 使其如下所示:

apply plugin: 'com.android.application'
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.1"

【讨论】:

  • 我更新了我的问题。我有这个更新,我需要做什么?
  • 你清理你的项目了吗?
猜你喜欢
  • 2020-09-25
  • 2015-04-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多