I installed Jetifier to resolve an issue with react-native-gesture-handler but now I'm getting this error:
> Task :expo-constants:compileDebugJavaWithJavac FAILED
C:\ioweu\node_modules\expo-constants\android\src\main\java\expo\modules\constants\ConstantsService.java:6: error: cannot find symbol
import androidx.annotation.Nullable;
^
symbol: class Nullable
location: package androidx.annotation
C:\ioweu\node_modules\expo-constants\android\src\main\java\expo\modules\constants\ConstantsService.java:51: error: cannot find symbol
@Nullable
^
symbol: class Nullable
location: class ConstantsService
2 errors
FAILURE: Build failed with an exception.
I'm working with React Native and Android Studio. I'm still new to all of this so any help is appreciated.
Here are my dependencies:
dependencies {
implementation project(':react-native-gesture-handler')
implementation project(':react-native-image-picker')
implementation project(':react-native-splash-screen')
implementation project(':react-native-screens')
implementation project(':react-native-reanimated')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
addUnimodulesDependencies()
}
To solve my earlier errors, I followed the content here https://github.com/facebook/react-native/issues/25483#issuecomment-508446776, which I understand changed my project to use AndroidX.
To solve these two new errors, I tried adding the line implementation "com.android.support:support-annotations:+" to my gradle.build dependencies and then run ./gradlew clean but it didn't work or I did it wrong. I think I'm going about it the wrong way.
Edit: I added implementation "androidx.annotation:annotation:1.1.0" but it didn't solve anything yet.
Edit 2: I tried the guide here: https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility#recommended-use-android-studio-to-migrate-your-app. Steps 1, 3 and 4 were the only ones that seemed to apply to me.
This resulted in the following error:
error: package android.support.v7.app does not exist
import android.support.v7.app.AppCompatActivity;
Edit 3: Issue (with my splash screen class) was fixed by adding implementation "androidx.appcompat:appcompat:1.1.0" to my build.gradle and replacing
import android.support.v7.app.AppCompatActivity;
with
import androidx.appcompat.app.AppCompatActivity;
My issue is now fixed. I'm sorry for asking questions which may seem like a hinderance to people more well versed in this.