Null Safety Tutorial in Kotlin: Best Practices | raywenderlich.com

In this tutorial, you’ll look at Kotlin’s nullability best practices. You’ll learn about null safety in Kotlin and how to avoid NPEs.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/436090-null-safety-tutorial-in-kotlin-best-practices

I couldn’t get the project to build. ERROR: Unable to resolve dependency for ‘:app@debug/compileClasspath’: Could not resolve org.jetbrains.anko:anko-common:0.10.8.

Tried to clean and rebuild but still no help. I’m running Android Studio 3.3.2 on a MacBook running Mojave 10.14.3

@nsdestr0yer Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @namlu ! This usually happens to me when I was working without an internet connection at some point and Android Studio switched me to offline mode. To make sure it’s not that, in your demo project choose Android Studio ▸ Preferences. On the left side choose Build, Execution, Deployment ▸ Build Tools ▸ Gradle. Uncheck the Offline work checkbox and then choose Apply or OK.

Other options are to try File ▸ Invalidate Caches / Restart …. If that still doesn’t work, try to clean up the .gradle and .idea directory under the project root directory. Let me know if that works.

Thank you @nsdestr0yer. I found those solutions via StackOverflow but still didn’t work for me. I gave up for a while and recently solved it by deleting my gradle.properties using $ rm ~/.gradle/gradle.properties

@namlu I’m glad you got it working! :]

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!