AS常見錯誤兩則

Execution failed for task ‘:mergeDebugResources’

錯誤2:Execution failed for task ‘:mergeDebugResources’.

Error: Failed to run command:
D:\soft_dev\android-sdk-windows\android-sdk-windows\build-tools\19.1.0\a
apt.exe s -i E:\Aworkspace\NewWorkspace\VipOneToOneGradleTest\res\drawable-xhdpi
\white.png -o E:\Aworkspace\NewWorkspace\VipOneToOneGradleTest\build\intermediat
es\res\debug\drawable-xhdpi-v4\white.png
Error Code:
42
Output:
libpng error: Not a PNG file

解決:這時候是不是感覺很迷茫,出錯了對吧,下面就告訴你是怎麼回事,怎麼出錯的。
錯誤很簡單卻也很難發覺,原因就是在這張圖片上,爲什麼是圖片上呢,剛開始的時候你的圖片是不是.jpg格式的,然而你把後綴名改成了.png的以爲就可以了是吧,其實不是這樣,你只是把格式改成了.png,其實它還是.jpg格式的。要將圖片真正轉換成.png格式的纔行。隨便找個圖片轉換工具就可以解決。

注意:在存放圖片時千萬不要將格式爲.jpg的圖片改成.png格式,千萬不要偷懶,一定要將格式轉換成PNG格式的圖片,否則編譯將不通過。切記!!!!

  Missing one of the key attributes 'action#name,category#name' on element
 intent-filter at AndroidManifest.xml:342:13
Output:
        res\drawable-xhdpi-v4\white.png:0: error: Resource entry white is alread
y defined.
        res\drawable-xhdpi-v4\white.jpg:0: Originally defined here.

ce\NewWorkspace\Vi
 非法字符: \65279

解決:
由於java文件是已utf-8-bom的形式保存的,至於爲何導致了這種情況,無需考究,通過editplus打開文件就可以看到。然後另存爲utf-8形式就可以了。再將修改了編碼的文件替換項目中報錯的文件,錯誤就解決了

FAILURE: Build failed with an exception.
* What went wrong:Execution failed for task ':lint'.

Lint found errors in the project; aborting build.

Fix the issues identified by lint, or add the following to your build script to proceed with errors:

android {
    lintOptions {

      abortOnError false

    }

}

解決:這種錯誤根據英文提示直接解決就可以了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章