问题
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:
- Copy the resource, duplicating the file.
- Rename the file to original name
Example: balloon_outgoing_normal.9 - copy.png to balloon_outgoing_normal.png
- Remove the file 9-patched that doesnt works.
Example:: balloon_outgoing_normal.9.png
- Open the file in Android Studio
- Right-click on each file (mdpi, hdpi, etc..)
- 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