简体   繁体   中英

Error while adding google signin lib in react native

I'm working on login into AWS through Google, but while adding the google sign in library I'm getting an error.

C:\\Users\\krishna21\\Awsslogin\\node_modules\\react-native-google-signin\\android\\src\\main\\java\\co\\apptailor\\googlesignin\\RNGoogleSigninModule.java:7: error: package android.support.annotation does not exist import android.support.annotation.NonNull; ^

C:\\Users\\krishna21\\Awsslogin\\node_modules\\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; ^

C:\\Users\\krishna21\\Awsslogin\\node_modules\\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;

I have added

npm install --save react-native-google-signin

this library I'm running the app through

react-native run-android --no-jetifier

Try adding these to your dependencies:

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.annotation:annotation:1.0.2'

I think you're using androidx which had a huge change in support packages: https://developer.android.com/jetpack/androidx/migrate#artifact_mappings

First of all, try using AWS Amplify, which is far superior in features and its been tested for security and errors. In AWS Federated Login can be done in 2 ways, one using Cognito User Pool as well as using Cognito Identity Pool. Please add the Google Client ID in Edit identity pool->Authentication providers->Google+ Whitelist the domain which you are hitting in Google Developer account. Full documention is here https://itnext.io/google-sign-in-using-aws-amplify-and-amazon-cognito-69cc3bf219ad

https://aws.amazon.com/blogs/mobile/amplify-framework-adds-authentication-features-and-enhancements-for-ios-and-android-mobile-sdks/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM