0

I've created an Android application. I tested it in debug mode and works completely fine. But when I tried to release build the apk, it's not connecting to the internet at all. I used Google sign in and firebase.

AndroidManifest.xml

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.REAL_GET_TASKS " />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    ....

build.gradle

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    compileSdkVersion 31
    buildToolsVersion "31.0.0"

    defaultConfig {
        applicationId "com.defenderstudio.geeksjob"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName '1.0'
        multiDexEnabled true


        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            shrinkResources false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildFeatures {
        viewBinding true
    }
}
...
Nimantha
  • 6,405
  • 6
  • 28
  • 69
Rafi
  • 39
  • 5

1 Answers1

0

If you were you not able to login using Google sign in, you have to put your Release SHA1 (from Google play or firbase console and your apk generated) key in google firebase console and then download and replace Json File and you'll be able to login.

Sohail Yasin
  • 344
  • 1
  • 3
  • 16
  • 1
    Jajhakallah brother. It worked. From your answer I got one clue that my SHA1 key is the problem and then searched for it and found this [link] :(https://stackoverflow.com/questions/36999751/google-signin-not-working-in-release-mode-apk-android). Then I found the answer I was waiting for. Still you got it right. Assalamualaikum – Rafi Dec 01 '21 at 01:03
  • @Rafi then you can mark this as accepted answere – Sohail Yasin Dec 01 '21 at 10:21
  • 1
    Sorry. You've to make some changes in your answer. Cause your answer marks somewhere else. You have to write down that I must add my SHA1 release key in the firebase console (Not Google console). Then that would be a correct answer. – Rafi Dec 02 '21 at 02:56