Wednesday, October 9, 2019

Android Studio incorrectly reformats Kotlin buildscripts

In the assignment they're currently working on, I saw some students create an activity in Android Studio and then receive script compilation errors in the project. The starter code we gave them contains a Kotlin DSL Gradle script which was altered by Android Studio when the activity was added. Strangely, the exclamation mark in !in was moved before the preceding space, making it invalid Kotlin. Reverting that change and doing a Gradle sync fixed the problem.

Thursday, October 3, 2019

"Unknown fragments" errors in the Android UI designer are normal

A student was poking around Android Studio today and asked about an "unknown fragments" error in the UI designer. This seems to be normal when including a fragment which has no layout to use as a preview, like the Google Maps SDK map fragment. Such fragments will appear as a dark gray box in the UI designer, but can work perfectly fine at runtime.