androidx annotation Easy to import! : Android Problems

Posted under problems & solutions On By mohammed.mutawe

Androidx annotation

After migrate your project to android x , many problems occur when invoking libraries as Android Studio does not help you to automatically replace import files .

 

Solution

We prefer to do all updates on your project after migrating to android x which include:

  • Upgrade compileSdkVersion to last version  which is found in Gradle script.
android {
    compileSdkVersion 30
    buildToolsVersion '29.0.3'
  • Upgrade Gradle version which is found here.
 dependencies {
        classpath 'com.android.tools.build:gradle:4.2.2'
}
  • Sync project.

 

 

Replace Annotation importing

In every activity has importing of annotations you must replace:

import android.support.annotation.NonNull;

With

import androidx.annotation.NonNull;