androidreact-nativegradlewandroid-jetifier

Why gradlew assembleDebug doesn't run jetifier, while react-native run-android run jetifier?


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?


Solution

  • you can run

    npx jetify

    before assembleDebug