Found unexpected optical bounds (red pixel) on top border at x=14

眉间皱痕 提交于 2019-12-10 10:09:22

问题


Recently, I'm updating to Android Studio 3.3 and Gradle 3.3, in this version the gradle.property 'android.enableAapt2=false' has no effect because AAPT2 is now always used. The real problem comes when I delete this line, because can't compile, the next error that throws is:

Android resource compilation failed

error: found unexpected optical bounds (red pixel) on top border at x=14.

In the previous versions we can solve this problem as in this post. Now I can't compile my app cause exists this error.


Update from: 2019-01-24

Finally I found the real problem with the new log error in Android Studio 3.2:

Android resource compilation failed Output: error: .

Command: /Users/myProject/.gradle/caches/transforms-1/files-1.1/aapt2- 3.2.1-4818971-osx.jar/0a24b213ff9fab058ea2520938e2e6e3/aapt2-3.2.1->4818971-osx/aapt2 compile --legacy \ -o \ /Users/myProject/android->app/myProject/app/build/intermediates/res/merged/debug \ /Users/myProject/android-app/myProject/app/src/main/res/drawable->hdpi/balloon_incoming_normal.9.png

Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #1

The file produce this problem is:

URL to download

Any idea? Thanks in advance!


回答1:


I solved this issue following this steps:

  1. Copy the resource, duplicating the file.
  2. Rename the file to original name

Example: balloon_outgoing_normal.9 - copy.png to balloon_outgoing_normal.png

  1. Remove the file 9-patched that doesnt works.

Example:: balloon_outgoing_normal.9.png

  1. Open the file in Android Studio
  2. Right-click on each file (mdpi, hdpi, etc..)
  3. Select Create-9-Patch File... and save each file on your respective folder (mdpi, hdpi, etc..)

After this steps, I had success on compilation.



来源:https://stackoverflow.com/questions/54323764/found-unexpected-optical-bounds-red-pixel-on-top-border-at-x-14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!