I have the following class
import com.android.annotations.NonNullByDefault;
@NonNullByDefault
public final class Log {
...
}
and here
I had similar issues when migrating to androidx. this issue comes due to the Old Butter Knife library dependency.
if you are using butter knife then you should use at least butter knife version 9.0.0-SNAPSHOT or above.
implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
I had similar issues when migrating to androidx.
If by adding the below two lines to gradle.properties did not solve the issue
android.useAndroidX=true
android.enableJetifier=true
Then try
If you still run into issues with migration then manually try to replace the libraries which are causing the issue.
For example
If you have an issue with android.support.annotation.NonNull
change it to androidx.annotation.NonNull
as indicated in the below class mappings table.
Class Mappings
Maven Artifact Mappings
You shouldn't edit any code manually jetify should do this job for you, if you are running/building from cli using react-native
you dont' need to do anything but if you are running/building Andriod studio you need to run jetify as pre-build, here is how can you automate this:
1- From the above menu go to edit configurations:
2- Add the bottom of the screen you will find before launch click on the plus and choose Run External Tool
2- Fill the following information, note that the working directory is your project root directory (not the android directory):
3- Make sure this run before anything else, in the end, your configuration should look something like this:
For Ionic, try this:
ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter
The error comes because this app is not using androidX but these plugins solve errors.
Use implementation androidx.appcompat:appcompat:1.0.2
in gradle and then
change import android.support.annotation.Nullable;
to import androidx.annotation.NonNull;
in the classes imports
In my case I had to use
import androidx.annotation...
instead of
import android.annotation...
I migrated to AndroidX and forgot to change that.