Fix for onRestoreInstanceState crash and update for Gradle plugin.