Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AAPT2 compile failed: invalid dimen on Android 3.0 Canary 1 on Windows

I have this problem after upgrade AndroidStudio to 3.0 Canary 1

Error:D:\Project\Freelance\Andoid\sosokan-android\sosokan-android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:911 invalid drawable
Error:java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
  aapt2 compile -o D:\Project\Freelance\Andoid\sosokan-android\sosokan-android\app\build\intermediates\res\merged\debug D:\Project\Freelance\Andoid\sosokan-android\sosokan-android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
  Issues:
   - ERROR: D:\Project\Freelance\Andoid\sosokan-android\sosokan-android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:911 invalid drawable

It look same AAPT2 compile failed: invalid dimen on Android 3.0 Canary 1 but I can not find the way to make it work on Window

Any help or suggestion would be great appreciated.

like image 430
Linh Avatar asked Jun 11 '17 09:06

Linh


2 Answers

did you see this https://www.reddit.com/r/androiddev/comments/4u0gw1/support_library_2411_released/

If you are using support libraries on version 24.x (you or even your dependencies), this is incompatible with AAPT2 and you should :

  • disbale aapt2 in your gradle.properties file :android.enableAapt2=false
  • or upgrade google libraries to version 25 or 26
like image 175
Zoubiock Avatar answered Oct 07 '22 04:10

Zoubiock


@Phan Van Linh, can you please check the line from "values.xml:911" where you are getting the invalid drawable issue & google it exactly?

I had the same issue with one of my project and the problematic line was:

<item name="crop_image_menu_crop" type="drawable"/>


It was from an image library I had used in my project. The issue was that I was using an older version of the library. Once I updated to newer version, the error was gone.

Hopefully, your issue might get fixed like mine.

Happy Hunting!

like image 45
Riddhish Ojha Avatar answered Oct 07 '22 03:10

Riddhish Ojha