failed parsing overlays - Aapt2 - Android Studio

13,504

Solution 1

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'

Solution 2

Huh, actually I just solved this problem in another way. When I imported the project of tzutalin ( : github.com/tzutalin/dlib-android-app), I changed the name of the package, which is why my program couldn't find where the library where stored !

I re-named the package package com.tzutalin.dlib; for the dlib library and everything is fine now.

Share:
13,504
Cyril
Author by

Cyril

Updated on July 23, 2022

Comments

  • Cyril
    Cyril almost 2 years

    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

  • Soon Santos
    Soon Santos almost 6 years
    I deleted the raw mp4 file that was causing me a problem, as this file was not necessary for the app.
  • Izabela Orlowska
    Izabela Orlowska almost 6 years
    @SoonSantos you can still keep the file if you update to gradle plugin 3.2.0-alpha11 or newer (there's a beta out right now, it's pretty stable and has some very nice fixes in it).
  • Soon Santos
    Soon Santos almost 6 years
    Updating gradle plugin or gradle version does not give me any problem? Actually, when clonning android opensource apps from github I am getting this error "cannot locate JAR for module 'grade-dependency-management'", I think it is because these apps have very old plugin versions as 2.2.2. I think upgrading the version will fix this issue, but I am not sure to which version I can update. Maybe upgrading to a newer version will cause me more problems with these apps.