paint-brush
Google Sign In and EXPO GO: A Guide to Help You Fix Any Issues That Ariseby@renanb
1,357 reads
1,357 reads

Google Sign In and EXPO GO: A Guide to Help You Fix Any Issues That Arise

by Renan BotasseDecember 5th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Despite EXPO GO being a good development platform, as it allows you to create applications for Android, iOS, and web with the same codebase, it also has some limitations, such as performing social login through Google.
featured image - Google Sign In and EXPO GO: A Guide to Help You Fix Any Issues That Arise
Renan Botasse HackerNoon profile picture

Despite EXPO GO being a good development platform, as it allows you to create applications for Android, iOS, and the web with the same codebase, it also has some limitations, such as performing social login through Google.


Until very recently, adding social login to applications developed with EXPO GO was quite straightforward. However, Google's security updates now require you to add custom native code to incorporate this package into your application.


Now, it requires you to build the Android version of your EXPO GO application, and within this build, make some native adaptations for this package to work.


A guide that usually resolves the use of Google login when there are no issues would be helpful in this situation.

And it is at this point that you may begin to encounter some issues.

ANDROID: “BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 65.

This is typically due to compatibility problems between the versions of JDK, Gradle, and Kotlin that you may be using.


Here are tables that will help you compare the versions being used.


To determine your Java version, use the command java --version, which will display the Java versions currently in use (there might be more than one). Additionally, the command /usr/libexec/java_home -V shows the installed and system-used Java version. Here are examples:



If you have multiple versions installed, you can go to each repository and execute sudo rm -fr (jdk version) to delete the version.


As for the gradle -version command, it shows the installed version of Gradle on the system. It's important to note that this version is not directly linked to the version you specify during the application build process.


For example, with version 8.4 installed, you can specify that the application should be built with any version older than it.


This command is also useful as it provides information about the Kotlin versions and some additional details.



As mentioned, the Gradle version used to build your project is the one you specify in thegradle/wrapper/gradle-wrapper.properties file by adding the correct classpath in the android/build.gradle file. In my case, I was using:


distributionUrl=https\\://services.gradle.org/distributions/gradle-8.0.1-all.zip


With that said, to organize versions more efficiently, the simplest way is to use SDKMAN, a tool for managing installed JDK versions used by the system.


In my case, the ideal JDK version was 17.0.9, with Gradle 8.0.1, and Kotlin 1.8.10.


To achieve this, I went through the process of removing all JDK versions from my machine. Using SDKMAN, I installed the desired version and set it as the active version, all through the terminal.


After that, I returned to the application to verify that the android/build.gradle file contained distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip and ensured that buildscript.ext.kotlinVersion was set to 1.8.10.


Additionally, I checked that classpath('org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10') was present in buildscript.dependencies.


With this, I overcame the issue with the error "BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 65."

iOS

When attempting to build without changing any other configurations, I encountered the problem: "RNGoogleSignin: failed to determine clientID - GoogleService-Info.plist was not found, and iosClientId was not provided."


This text assumes your OAuth 2.0 configuration is already correct, so we haven't delved into creating IDs, etc. However, this tutorial might help you configure OAuth.


Assuming the ID is correct, created for both iOS and Android, this error is directly related to the application's Client ID.


The steps to make GoogleSignIn work on iOS are simple. Build the application on iOS using npx run: ios. Inside the ios/Podfile file, add pod 'GoogleSignIn’.

Inside the app.json file, add:



Check if the ios/APP_NAME/info.plist had:



In the component (inside EXPO GO), created to perform login through GoogleSignIn, ensure that you also add the iOS client ID.



After making these configurations, you might encounter the error commandError: Failed to build iOS project. "xcodebuild" exited with error code 65. This can be resolved with the following commands:


  1. cd ios

  2. pod install

  3. cd ..

  4. npx expo run: ios


Essentially, this was my journey to resolve configuration issues in my environment and application to successfully add GoogleSignIn to my EXPO GO project.


Below, I'll list the main links that helped me in discovering and resolving this issue:


https://github.com/react-native-google-signin/google-signin


https://stackoverflow.com/questions/68597899/bug-exception-in-phase-semantic-analysis-in-source-unit-buildscript-unsup


https://stackoverflow.com/questions/5124368/gradle-doesnt-work-in-intellij-problems-with-java-home


https://unix.stackexchange.com/questions/21689/how-to-find-path-where-jdk-installed


https://stackoverflow.com/questions/30054911/how-to-determine-the-version-of-gradle


https://stackoverflow.com/questions/76823607/how-to-uninstall-version-of-openjdk


https://medium.com/@sandeep11/how-to-install-gradle-and-java-jdk17-on-latest-macos-2023-ad4236d2be19


https://www.oracle.com/in/java/technologies/downloads/#java17


https://stackoverflow.com/questions/34005713/difference-between-clean-gradlew-clean


https://medium.com/pragmatic-programmers/classpath-dependencies-3514e5497a54


https://market.nativescript.org/plugins/@nativescript/google-signin/

Other Issues May Also Arise.

:expo-modules-core' could not be found in the project


compileDebugKotlin FAILED


The legacy expo-cli does not support Node +17. Migrate to the versioned Expo CLI


Expo-modules-corecompiledebugkotlin


The binary version of its metadata is 1.8.0, the expected version is 1.6.0


Android build failures No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found.


react-native-gradle-plugin:compileKotlin FAILED


The Kotlin Gradle plugin was loaded multiple times in different subprojects