Thursday, December 17, 2015

Google Identity Toolkit for Android - weird compilation error

I’m hacking tiny Android app, one of the libraries I use is Google Identity Toolkit (it’s super easy to integrate). A documentation states that a Play Services should be added as dependency:
compile ''
For any non trivial application it’s going to be a problem resulting in below error (or similar):
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 2
Search on Internet points to StackOverflow question: Apparently the bugs are related. The exit return code 2 is meaningless unless one has any clues. Anyway, the problem can be solved by replacing the dependency by:
compile ''
compile ''
I’ve opened an issue on Google Identity Toolkit - Android sample project asking for more documentation.
The error is related to a constraint of Android Dalvik runtime of to 65K Reference Limit. There are two solutions for the problem: decreasing the references (usually by chosing smaller dependencies, in our case subpackages instead of the full Play Services) and using so called multidex (some 3rd party blog).

No comments:

Post a Comment