I've set android.useAndroidX = true
and android.enableJetifier = true
on gradle.properties. But when I run react-native run-android
I see:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1902 file(s) to forward-jetify. Using 4 workers...
But when I change dir to android dir, and run ./gradlew assembleDebug
, I didn't see such thing. Hence my build breaks everywhere where there's android.support.*
library imported.
> Task :react-native-app-auth:compileDebugJavaWithJavac FAILED
.../node_modules/react-native-app-auth/android/src/main/java/com/rnappauth/
RNAppAuthModule.java:10: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
.../node_modules/react-native-app-auth/android/src/main/java/com/rnappauth/RNAppAuthModule.java:11: error: cannot find symbol
import android.support.customtabs.CustomTabsCallback;
^
symbol: class CustomTabsCallback
location: package android.support.customtabs
.../node_modules/react-native-app-auth/android/src/main/java/com/rnappauth/RNAppAuthModule.java:12: error: cannot find symbol
import android.support.customtabs.CustomTabsClient;
^
symbol: class CustomTabsClient
location: package android.support.customtabs
(25 more errors)
Why is this happening? How can I fix this? Is there any way to externally force gradlew to run jetifier?
I found the answer. So that your gradle build includes the jetifier-ed codes of your libraries, the step is simple.
react-native run-android
first. This will jetifier the libraries and put them in the build folder../gradlew assembleDebug
. This will grab your jetifier-ed code in the build folder into APK without complaining anymore.My case is that I run ./gradlew assembleDebug
before I ever run react-native run-android
after I clone the project. Deleting build folder in android folder also resulting the same situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With