Android, Codes and Tips

Just in

11/24/2019

how to fix importing NotNull or Nullable problem in android studio

Android to androidx problems solution



After working and searching for hours and you can't get the solution you are looking for. You are welcome to the home of Android Developer. If you have being using Android Studio for writing Java apps, Java codes is everything sensitive raging from capital letters, punctuation errors, misspelled of words and plugin updates.

Android Studio comes up with new updates always which depreciated the older once. A code you write today, use it and develop an app may be outdated and depreciated tomorrow. If you copy somebody's code or forked a code from github, there are chances that the code which worked earlier won't work again unless you do serious editing.


For instance android:support is no longer in use.
Support v7 and support v4 are all outdated.
You may not notice all these unless you want to integrate admob in your Android Studio app.

at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6543)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)

here we are going to show you how to fix 

import android.support.annotation.Nullable;

import android.support.annotation.NonNull;

after Migrating from Android to Androidx


apply plugin: 'com.android.application'



1. check your build.gradle

android {

compileSdkVersion 28

defaultConfig {

applicationId "com.techmax.fashionlast"

minSdkVersion 21

targetSdkVersion 28

versionCode 1

versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

}

}

}




dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.1.0'

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

testImplementation 'junit:junit:4.12'

androidTestImplementation 'androidx.test:runner:1.2.0'

androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

}



2. Fix your XML files for androidx

androidx.constraintlayout.widget.ConstraintLayout

No comments:

Post a Comment