Fix “Error loading build artifacts” error (Android Studio after upgrade)

Problem: After upgrading Android Studio from “Ladybug” to “Otter” I started getting the following error message when I run my app on my emulated test device: First, I ran the AGP Upgrade Assistant, which updated 2 files: And then, applied a “Run Configuration” Fix: Additional things to try if above suggestions weren’t sufficient to fix […]

Read More

Android emulator shell list fails: Permission Denied in app directory

Today I learned I should include the app package name after shell in my ADB command, if for example I want to list files under the “subdirectory/media” directory of an app, like so: adb -s emulator-5556 shell run-as com.domain.my.app ls -al /data/user/0/com.domain.my.app/subdirectory/media First try’s command below failed with a Permission Denied error message: adb -s […]

Read More

How to start using view binding //Android Kotlin Dev Diary

First, open your app/build.gradle file Inside the android{} block of app/build.gradle, add the following: buildFeatures { viewBinding = true } Sync project with gradle files. In your activity or fragment, define the following class-wide property:

Replace the FragmentorActivityNameBinding above with the appropriate binding class name. Tip: The binding class name is based on the […]

Read More

Fix coroutine error: Cannot access database on the main thread // Android Dev Diary

As I was running a test for a ViewModel function, I encountered the following error: […] Main Thread @coroutine java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time. I think it may be caused by the viewModelScope from viewModelScope.launch {} being used by […]

Read More