Closed Yanis540 closed 10 months ago
Hello !
I ve had the same issue yesterday. I believe this is because of the SDK49. Try to roll back to SDK48
HI ! Still the same issu even when rolling back to SDK48 on expo .... but thank you
Hello, sdk 48/49 should make no difference. please try deleting your android and ios folders in the project. Then run the
npx expo run:android
Or
npx expo run:ios
Commands as described in https://docs.expo.dev/workflow/customizing/
Let me know if that works 👍
Hello , i tried as you suggested running the build for android , but got an error :
env: load .env env: export GOOGLE_WEB_CLIENT_ID GOOGLE_SECRET › Building app... Configuration on demand is an incubating feature. FAILURE: Build failed with an exception. * Where: Settings file '....\android\settings.gradle' line: 3 * What went wrong: A problem occurred evaluating settings 'frontend'. > Could not read script '....\node_modules\expo\scripts\autolinking.gradle' as it does not exist. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 1s Error: ....\android\gradlew.bat exited with non-zero code: 1 Error: ....\android\gradlew.bat exited with non-zero code: 1 at ChildProcess.completionListener (....\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23) at Object.onceWrapper (node:events:628:26) at ChildProcess.emit (node:events:513:28) at cp.emit (....\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) ... at Object.spawnAsync [as default] (....\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21) at spawnGradleAsync (....\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46) at Object.assembleAsync (....\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18) at runAndroidAsync (....\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:35:24) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
the problem is i checked the folder in node modules and the autolinking.gradle was there (see below)
<img src="https://github.com/react-native-google-signin/google-signin/assets/88095727/5b554151-a4f8-4a37-86a8-0daf6ab48480" />
Just for info, when i use prebuild
npx expo prebuild
it creates the .android folder normally but the error i mentionned (with google sign in ) is still there.
I know the gradle error is related to expo, but i searched for it there's nothing working tbh .. Thank you !
Still has this issue , any solution update ? thanks!
Hi, I have this same error too, are there going to be any kind of updates about this?
Same error lingering for a week, new to mobile development as well. Is Google Authentication incompatible with Expo? Is it easier if I eject and use React Native cli instead to get my app working with Google Authentication? Considering packages such as expo-google-auth are deprecated.
Hello and thanks for asking, so far, no one was able to provide a runnable reproduction (code or reproduction steps) of the issue. Unfortunately, I cannot debug your problems from comments or screenshots.
An example of issue I can help with is here https://github.com/vonovak/react-native-theme-control/issues/15
Thank you 🙂
Steps to Reproduce: (using: expo ~49.0.7, react 18.2.0, react-native 0.72.3, @react-native-google-signin/google-signin ^10.0.1)
import React, { createContext, useState } from 'react'
import { GoogleSignin, statusCodes } from '@react-native-google-signin/google-signin';
const AuthContext = createContext({}); GoogleSignin.configure();
export const AuthProvider = ({ children }) => { const [user, setUser] = useState(null); const [loading, setLoading] = useState(false);
const signInWithGoogle = async () => { try { await GoogleSignin.hasPlayServices(); const user = await GoogleSignin.signIn(); setUser(user); } catch (error) { if (error.code === statusCodes.SIGN_IN_CANCELLED) { // user cancelled the login flow setLoading(false); } else if (error.code === statusCodes.IN_PROGRESS) { // operation (e.g. sign in) is in progress already setLoading(true); } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) { // play services not available or outdated setLoading(false); } else { // some other error happened setLoading(false); } } } return ( <AuthContext.Provider value={{ user, signInWithGoogle, loading, }}> {children} </AuthContext.Provider> ) }
export default useAuth = () => useContext(AuthContext);
4. In App.js:
import { StatusBar } from 'expo-status-bar'; import { StyleSheet, Text, View } from 'react-native'; import { AuthProvider } from './Auth.js';
export default function App() { return (
); }
const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, });
5. npx expo start
6. i (iphone emulator)
Steps to reproduce :
npx expo install @react-native-google-signin/google-signin
npm install --save @react-native-firebase/app
npm i @react-native-firebase/auth
npx expo install expo-dev-client
eas build:configure
eas.json
"build": {
"development": {
"android":{
"buildType": "apk"
}
},
"preview": {
"android":{
"buildType": "apk"
}
},
"production": {
"android":{
"buildType": "apk"
}
}
},
eas build
eas credentials # Got the SHA-1 certificat from here
After that in configured the project in firebase and put the SHA-1 for android, and activated the google auth
app.json :
"expo":{
"android":{
"googleServicesFile": "./google-services.json"
},
...
"plugins": [
"@react-native-firebase/app",
"@react-native-google-signin/google-signin"
],
}
eas build # generating the build to put on Android Studio emulator
npx expo start --dev-client
import 'expo-dev-client'
import { StyleSheet, Text, View , StatusBar } from 'react-native';
import { registerRootComponent } from 'expo';
import Navigator from './src/routes/Navigator';
import { ToastProvider } from 'react-native-toast-notifications'
import google from './src/lib/google';
import {useEffect} from "react"
export default function App() {
useEffect(()=>{
google.config()
},[])
return (
<ToastProvider>
<Navigator />
</ToastProvider>
);
}
import { GoogleSignin,GoogleSigninButton,statusCodes, } from '@react-native-google-signin/google-signin';
export const config = () =>GoogleSignin.configure({
offlineAccess: true,
scopes:["email","profile"],
webClientId:"WEB CLIENT D" ,
});
const google = {
config,
}
export default google ;
Thank you 🙂
hello everyone, @paullam328 thanks for providing repro steps. You need to launch your app with the commands mentioned here https://docs.expo.dev/workflow/customizing/#generate-native-projects-with-prebuild (documented in the readme at https://github.com/react-native-google-signin/google-signin#expo-installation)
@Yanis540 I wasn't able to reproduce the issue from the information you provided. If you're stuck, feel free to reach out to me and I can fix your problem, as a paid service.
thank you!
I had the same issue as described and following this:
Hello, sdk 48/49 should make no difference. please try deleting your android and ios folders in the project. Then run the
npx expo run:android
Or
npx expo run:ios
Commands as described in https://docs.expo.dev/workflow/customizing/
Let me know if that works 👍
And then running a new eas dev build with: eas build --profile development --platform android
and reinstalling the app in the device or emulator worked for me.
Is there any latest progress or solution to this problem?
hello, no, there is no progress. If there was any, it would be posted here.
I believe the solution is given in https://github.com/react-native-google-signin/google-signin/issues/1191#issuecomment-1677136018
If that doesn't help, a runnable reproduction is needed.
Thank you
Yes, after prebuild, it finally runs normally, thank you
Hi i'm pretty new to mobile dev, i'm currently using RN with EXPO and firebase, and for some reason Google Sign In doesn't wanna work i'm getting these two errors :
ERROR; RN GoogleSignin native module is not correctly linked. Please read the readme, setup and troubleshooting instructions carefully or try manual linking. ERROR : TypeError: Cannot read property 'SIGN_IN_CANCELLED' of null, js engine: hermes
Installations:
eas.json
Running this :
After that in configured the project in firebase and put the SHA-1 for android, and activated the google auth
app.json :
After Installing that i installed the build on the emulator and ran
Code for the application :
Dependencies:
package.json