Google-signin: AndroidX migration

Created on 26 Jun 2019  Â·  13Comments  Â·  Source: react-native-google-signin/google-signin

Unable to compile application after changing compileSDKVersion=28.

Also had to enable in gradle.properties
android.useAndroidX=true
android.enableJetifier=true

Compilation error: package android.support.annotation does not exist.
signin\android\src\main\java\co\apptailor\googlesignin\RNGoogleSigninModule.java:7: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
react-native-google-signin\android\src\main\java\co\apptailor\googlesignin\RNGoogleSigninModule.java:8: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
react-native-google-signin\android\src\main\java\co\apptailor\googlesignin\Utils.java:4: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;

React native version: "^0.59.9"
React version: "^16.8.3"
react-native-google-signin: "2.0.0"

Most helpful comment

  1. Get inside node_modules, find folder react-native-google-signin, find file build.gradle

  2. Add implementation "androidx.appcompat:appcompat:1.0.+" in dependencies

image

  1. Get inside RNGoogleSigninModule.java and Utils.java, replace android.support.annotation.NonNull to androidx.annotation.NonNull; also android.support.annotation.Nullable to androidx.annotation.Nullable and androidx.annotation.NonNull

image

All 13 comments

  1. Get inside node_modules, find folder react-native-google-signin, find file build.gradle

  2. Add implementation "androidx.appcompat:appcompat:1.0.+" in dependencies

image

  1. Get inside RNGoogleSigninModule.java and Utils.java, replace android.support.annotation.NonNull to androidx.annotation.NonNull; also android.support.annotation.Nullable to androidx.annotation.Nullable and androidx.annotation.NonNull

image

  1. Get inside node_modules, find folder react-native-google-signin, find file build.gradle
  2. Add implementation "androidx.appcompat:appcompat:1.0.+" in dependencies
    image
  3. Get inside RNGoogleSigninModule.java and Utils.java, replace android.support.annotation.NonNull to androidx.annotation.NonNull; also android.support.annotation.Nullable to androidx.annotation.Nullable
    image

Hey,

Thanks for quick answer and provided workaround.
I think manually modifying node modules folder is not sustainable solution and hope there's will be new release for androidx soon.

if anyone wants to contribute a PR for this, it will be appreciated

if anyone wants to contribute a PR for this, it will be appreciated

I have created a pull request. Please have a look at it. @vonovak

you can use this tool:
https://github.com/mikehardy/jetifier

as described in this related blog post:
https://medium.com/@yathousen/the-day-google-decided-to-shake-the-react-native-community-4ba5cdd33388

Just encountered this as well and saw there is a PR. @vonovak looking forward to seeing this fixed, thanks for still being active here

Thanks @SpQuyt, you saved my day.

I believe the way @export-mike mentions https://github.com/react-native-community/react-native-google-signin/issues/688#issuecomment-507370752 is the right way to do this - so I'll close this PR. Let me know if you think otherwise, thanks.

sorry, I thought this was a PR. Reopening for visibility.

It's okay.
Thanks for replying me.

Vào 22:02, T.6, 12 Th7, 2019 Vojtech Novak notifications@github.com đã
viết:

I believe the way @export-mike https://github.com/export-mike mentions #688
(comment)
https://github.com/react-native-community/react-native-google-signin/issues/688#issuecomment-507370752
is the right way to do this - so I'll close this PR. Let me know if you
think otherwise, thanks.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/react-native-community/react-native-google-signin/issues/688?email_source=notifications&email_token=AEH43LNCADUJOPEVUL4RSLLP7CMINA5CNFSM4H3MV7A2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ2ALWQ#issuecomment-510920154,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEH43LIEUPMYXC5OZWSZJIDP7CMINANCNFSM4H3MV7AQ
.

  1. Get inside node_modules, find folder react-native-google-signin, find file build.gradle
  2. Add implementation "androidx.appcompat:appcompat:1.0.+" in dependencies
    image
  3. Get inside RNGoogleSigninModule.java and Utils.java, replace android.support.annotation.NonNull to androidx.annotation.NonNull; also android.support.annotation.Nullable to androidx.annotation.Nullable
    image

Hey,

Thanks for quick answer and provided workaround.
I think manually modifying node modules folder is not sustainable solution and hope there's will be new release for androidx soon.

What I ended up doing is using patch-package to persist the changes to node_modules.

jetifier can do all of these works.

Vào 13:54, T.3, 3 Th9, 2019 Harris Robin Kalash notifications@github.com
đã viết:

>

  1. Get inside node_modules, find folder react-native-google-signin,
    find file build.gradle
  2. Add implementation "androidx.appcompat:appcompat:1.0.+" in
    dependencies
    [image: image]
    https://user-images.githubusercontent.com/17812909/60151724-0c000900-9808-11e9-8e6b-d1f5e19cfe28.png
  3. Get inside RNGoogleSigninModule.java and Utils.java, replace
    android.support.annotation.NonNull to androidx.annotation.NonNull;
    also android.support.annotation.Nullable to
    androidx.annotation.Nullable
    [image: image]
    https://user-images.githubusercontent.com/17812909/60151801-55505880-9808-11e9-88f3-89338de79908.png

Hey,

Thanks for quick answer and provided workaround.
I think manually modifying node modules folder is not sustainable solution
and hope there's will be new release for androidx soon.

What I ended up doing is using patch-package
https://github.com/ds300/patch-package to persist the changes to
node_modules.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/react-native-community/react-native-google-signin/issues/688?email_source=notifications&email_token=AEH43LOSNUGAUNX65IRPV63QHYCYZA5CNFSM4H3MV7A2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5XGTAA#issuecomment-527329664,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEH43LK4TDF3IL3YZ6DQMB3QHYCYZANCNFSM4H3MV7AQ
.

we're using androidX in v3

Was this page helpful?
0 / 5 - 0 ratings