Revert "Revert "Fix build with various libs on android""

This reverts commit 9c505815da3be386dd15e83c12e7081de67dff12.