Skip to main content

Setup Android Environment

Update Google Sign-In and setup firebase for android

  1. In firebase/authentification, enable Google Sign-In & apple sign-in. img.png
  2. Settings -> General -> Android, download google-services.json.
  3. In Android Studio, go to the Project view (use the Project tab on the left side).
  4. Navigate to the 'app' folder inside your project's main directory.
  5. Paste the google-services.json file into the 'app' folder.
  6. in js source src/config/index.js, update the GOOGLE_SIGNIN_CLIENT_ID with the client_id under this property client/oauth_client/client_id found in the google-services.json file, (the id ends with .apps.googleusercontent.com). Make sure to pick the client_id with client_type: 3.

SHA1 key for Firebase (!important)

Google auth requires a SHA1 key to work. You need to add the SHA1 key to the Firebase console.

  • To generate a certificate run cd android && ./gradlew signingReport. This generates two variant keys. You have to copy both 'SHA1' and 'SHA-256' keys that belong to the 'debugAndroidTest' variant key option. Then, you can add those keys to the 'SHA certificate fingerprints' on your app in Firebase console.
    • Go to the Firebase console.
    • Select your project.
    • Go to Project settings.
    • In the Your apps card, select the Android app.
    • In the SHA certificate fingerprints section, click Add fingerprint.
  • in prod after releasing the app, you have to add the SHA1 key of the release key to the Firebase console.
  • To get the SHA1 key for the release key:
    • Run the following command: keytool -list -v -keystore <PATH_TO_YOUR_RELEASE_KEY> -alias <ALIAS_NAME> -storepass <STORE_PASSWORD> -keypass <KEY_PASSWORD>
    • Replace the placeholders with the actual values.
    • You will find the SHA1 and SHA-256 keys in the output.
  • if signing is managed by google play, you can find the SHA1 key in the google play console.
    • Go to the Google Play Console.
    • Select your app.
    • Go to Release > Setup > App Integrity.
    • Copy the SHA-1 certificate fingerprint from the App signing certificate section.
    • Add the SHA-1 certificate fingerprint to the Firebase project.

Firebase auth service account for backend

  1. Go to Firebase Console -> Project Settings -> Service Accounts.
  2. Click on 'Generate new private key'.
  3. Store if in a secure place, as you won't be able to download it again.
  4. Save the JSON file in the .dev folder in your backend project as firebase-service-account.json.

Update Variables in strings.xml

  • fb_app_id & fb_client_token:
    • Facebook app id: from your app page.
    • Client token: Sign into your developer account. On the Apps page, select an app to open its dashboard. In the Dashboard, navigate to Settings > Advanced > Security > Client token.
  • code_push_deployment_key: Refer to this guide to get the deployment key: Here
  • fb_display_name: Your app's name.

Update Bundle ID for Android

  1. Update Package in AndroidManifest.xml: Modify the package attribute with the new name.
  2. Refactor Package Name: Right-click the package in app/src/main/java, select Refactor > Rename, and change the name.
  3. Update Build.gradle: Change applicationId in build.gradle (Module: app) to the new package name.
  4. Revise Code References: Update any old package references in your code, such as in R class imports.
  5. Clean and Rebuild Project: Use Build > Clean Project, then Build > Rebuild Project.

IAP Product Creation for Android

  1. Sign in to your Google Play Console.
  2. Select Your App: Choose the app you want to add the IAP to.
  3. Create In-App Products: Go to the 'Monetize' section, then 'Products', and select 'In-app products'. Click on 'Create Product'.
  4. Fill Product Details: Enter the product ID, name, description, and set the pricing.
  5. Activate Product: Save and activate the in-app product.