[build] Port build system to Gradle
Check current SDK version instead of target SDK verion.

Fixes crash on 2.3 devices.