Today, I opened a very old project for a quick update. After upgrading the support libraries, gradle plugins and other tools, I saw this strange issue for the first time. The app was building and running successfully, but when I opened any code file, I was getting huge list of compile errors mostly about Unresolved Reference etc. Initially, I cleaned project, rebuild it, restarted Android studio few times, but couldn’t fix it.

Continue reading

When debugging apps, we sometimes start putting logging statements all over the code to figure out what’s going on. class MainActivity : AppCompatActivity() { lateinit var retrofit: Retrofit override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) setupToolbar() Log.d("MyApp", "Toolbar Set") initRetrofit() Log.d("MyApp", "Retrofit Initialized") var myButton = findViewById<Button>(R.id.search_close_btn) myButton.setOnClickListener { Log.d("MyApp", "My Button Clicked") } Log.d("MyApp", "Activity Creation Done!") } } That works, but it happens that we forget to remove the logs before committing, and they either get flagged in the code review, or they’re still there when we release.

Continue reading

Code completion can improve your productivity by reducing how much you have to type, but there are situations when a more powerful tool is needed. Thanks to Android Studio and IntelliJ, live templates make it much easier to focus on just the things you care about. You guessed it right. I am talking about Live Templates. For example, to show a simple Toast in android apps, we use something like this:

Continue reading

Author's picture

Wajahat Karim

Android Developer. Open Source Contributor. Writer. Speaker

Senior Android Developer

Karachi, Pakistan