Week of September 8th ## Android SDK I have never done Android development before, but I had a free Samsung Tablet lying around that I got for free from Verizon. It's running a 4 year old version of Android 11 and doesn't seem to be upgradeable. I was concerned at first that I couldn't use a modern version of Android Studio to build against it, but luckily things more or less "just worked". It's also really nice to be able to set SDK versions via Gradle repositories, rather than the magical SDK experience in XCode that you cannot debug or otherwise dig up, just download these 20GB of binaries and never build for something old. I wanted to do what I consider the simplest possible thing: scrape the Github API for some info on a repo, and display that in a text box on the screen. I was able to get it to work, but ran into some very annoying issues accessing the network. First off, you need to modify your `AndroidManifest.xml` file to allow network access: I was also running into this dreaded `NetworkOnMainThreadException` ![[Pasted image 20250910121708.png]] Apparently, this is a well-documented situation where to prevent bad code from freezing up the main thread, Android will just kill your app if you attempt to do blocking work on the UI thread. This is commendable, but none of the classic documented fixes seemed to work for me. I made a new `ViewModel` subclass, then did my OkHttp request inside of a `viewModelScope.launch { ... }` block, but alas it was still telling me that somehow the async work was happening on main. In the end, I just did the dumbest thing and instead wrapped it inside of a `Thread({ ...}).start()` block, and that did the trick, though I'd really like to figure out how to do this "correctly", perhaps I need to use a library that works directly with Kotlin's coroutine runtime, something I don't know much about. But hey, I got something showing up on the screen!