failed parsing overlays - Aapt2 - Android Studio

Cyril picture Cyril · Apr 20, 2018 · Viewed 12.9k times · Source

I'm trying to use dlib in Android Studio for my university's project. I did import all the .so files that I needed, but I can't import the shape_predictor_68_face_landmarks.dat... (I want to import it as a raw file)

I get AAPT2 error: check logs for details and the Java compiler says failed parsing overlays. Do you know what can I do to fix this ? I've never seen a topic about failed parsing overlays.

I already tried to put android.enableAapt2=false in the gradle.properties and the testOptions in the gradle.build without success...

You can find the build log here : Build log

And the project here : https://github.com/ghysc/Stage

If you need any more information, please let me know.

Thanks for reading.

Cyril G

Answer

Izabela Orlowska picture Izabela Orlowska · Apr 24, 2018

Using your GitHub project I found out it was a problem with one of the resource files you had - it was too big for AAPT2 to process:

./app/src/main/res/raw/shape_predictor_68_face_landmarks.dat

This was a bug in AAPT2 but it has been fixed recently.
So if you update your android gradle plugin version in your build.gradle file to 3.2.0-alpha11 or newer it all compiles fine:

classpath 'com.android.tools.build:gradle:3.2.0-alpha11'