4

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

Cyril
  • 51
  • 1
  • 1
  • 6
  • It means there's something wrong with your resources (or resources coming from your dependencies). Either post a link to your project on github/bitbucket or post the whole build log here. – Izabela Orlowska Apr 20 '18 at 14:31
  • Hello Izabela, thanks for taking time to help me ! I just updated my post so you can see the build log and my project on GitHub. I tried to import dlib from another project on GitHub ( : https://github.com/tzutalin/dlib-android-app) so what you said is possible ! I don't really know how dependencies work... – Cyril Apr 22 '18 at 17:29

2 Answers2

7

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'
Izabela Orlowska
  • 6,846
  • 2
  • 17
  • 32
  • I deleted the raw mp4 file that was causing me a problem, as this file was not necessary for the app. – Soon Santos Jul 10 '18 at 17:16
  • @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). – Izabela Orlowska Jul 11 '18 at 10:30
  • 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. – Soon Santos Jul 11 '18 at 13:49
1

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.

Cyril
  • 51
  • 1
  • 1
  • 6