[Android] Backport fixes to generate_xwalk_core_library_aar.py.

This is required for XWALK-1930: backport the two commits in master that make `generate_xwalk_core_library_aar.py` work as originally intended.