React-native-app-auth: error: package android.support.annotation does not exist when building assembleDebug

Created on 16 Sep 2019  路  2Comments  路  Source: FormidableLabs/react-native-app-auth

Issue

I'm trying to build my react native project, which already use react native 0.60+, IDE visual studio code, and also already migrate to AndroidX. When I run ./gradlew assembleDebug, I encountered error below:

> Task :react-native-app-auth:compileDebugJavaWithJavac FAILED
/Users/martintjandra/Projects/coach-opal/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;
                                 ^
/Users/martintjandra/Projects/coach-opal/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
/Users/martintjandra/Projects/coach-opal/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
  ...
  ...

After looking around, I see that this error is caused by the project already migrated to AndroidX but the plugins in node module still don't. Some people suggest that android.support.annotation.Nullable is the way of Android plugins, not AndroidX. The AndroidX calls will be androidx.annotation.Nullable. I also read that jetifier should take care about things like this, and I also make sure that android.useAndroidX=true and
android.enableJetifier=true is present in the gradle.properties. I see in another thread #326 that the merging was on hold until RN 0.60 is released. Has it been merging yet? I see in #328 that it probably is? I already using the latest version of react-native-app-auth ^4.4.0.

How can I resolve this issue?

Most helpful comment

run npx jetify every time you install/update/delete NPM package. It's just work around.

All 2 comments

run npx jetify every time you install/update/delete NPM package. It's just work around.

Thank you! v5 will be released today, so closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

titoff002 picture titoff002  路  7Comments

timeinvestgroup picture timeinvestgroup  路  8Comments

erichulser picture erichulser  路  5Comments

ozasadnyy picture ozasadnyy  路  8Comments

Electrofenster picture Electrofenster  路  4Comments