Error occurred using Google Sign In option in my android studio. after running the app on my physical device, nothing happens

  android, android-studio, firebase, kotlin

Below is the result that I get after clicking on run button

02/23 18:04:57: Launching ‘app’ on Physical Device.
App restart successful without requiring a re-install.
$ adb shell am start -n "com.example.socialmediaapp/com.example.socialmediaapp.SignInActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 31623 on device ‘xiaomi-redmi_note_6_pro-4e621214’.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/Perf: Connecting to perf service.
I/MultiDex: VM with version 2.1.0 has multidex support
Installing application
VM has multidex support, MultiDex support library is disabled.
I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
I/FirebaseInitProvider: FirebaseApp initialization successful
I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to fallback implementation
W/.socialmediaap: Accessing hidden field Landroid/view/WindowInsets;->CONSUMED:Landroid/view/WindowInsets; (light greylist, reflection)
W/.socialmediaap: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
W/.socialmediaap: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
I/.socialmediaap: The ClassLoaderContext is a special shared library.
W/.socialmediaap: Unknown chunk type ‘200’.
W/.socialmediaap: Unsupported class loader
W/.socialmediaap: Skipping duplicate class check due to unsupported classloader
I/DynamiteModule: Considering local module com.google.android.gms.signinbutton_dynamite:0 and remote module com.google.android.gms.signinbutton_dynamite:2
Selected remote version of com.google.android.gms.signinbutton_dynamite, version >= 2
W/System: ClassLoader referenced unknown path:
I/DynamiteLoaderV2Impl: [71] Dynamitemodulesa
W/.socialmediaap: Unsupported class loader
W/.socialmediaap: Skipping duplicate class check due to unsupported classloader
W/Looper: Slow Looper main: Activity com.example.socialmediaapp/.SignInActivity is 472ms late (wall=4ms running=0ms ClientTransaction{ lifecycleRequest=android.app.servertransaction.PauseActivityItem }) because of 3 msg, msg 1 took 152ms (late=1ms h=android.app.ActivityThread$H w=110), msg 2 took 314ms (late=129ms h=android.app.ActivityThread$H w=159)
W/.socialmediaapp: type=1400 audit(0.0:175329): avc: denied { read } for name="u:object_r:serialno_prop:s0" dev="tmpfs" ino=19716 scontext=u:r:untrusted_app:s0:c57,c257,c512,c768 tcontext=u:object_r:serialno_prop:s0 tclass=file permissive=0
/I think here the error lies but i am unable to figure it out/
E/libc: Access denied finding property "ro.serialno"
V/StudioTransport: Agent command stream started.
V/StudioTransport: Transport agent connected to daemon.
V/StudioTransport: Handling agent command 1200 for pid: 31623.
V/StudioTransport: JNIEnv not attached
W/Thread-2: type=1400 audit(0.0:175330): avc: denied { write } for name="perfd" dev="dm-2" ino=3145736 scontext=u:r:untrusted_app:s0:c57,c257,c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
V/StudioTransport: Handling agent command 1200 for pid: 31623.
W/.socialmediaap: Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
V/StudioTransport: Handling agent command 1200 for pid: 31623.
W/.socialmediaap: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
W/.socialmediaap: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
I/Adreno: QUALCOMM build : 6774a42, I60e4284429
Build Date : 09/17/20
OpenGL ES Shader Compiler Version: EV031.25.03.01
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.7.2.R1.09.00.00.442.049
Remote Branch : NONE
Reconstruct Branch : NOTHING
Build Config : S L 6.0.7 AArch64
I/Adreno: PFP: 0x005ff113, ME: 0x005ff066
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 2
W/.socialmediaap: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
I/.socialmediaap: ProcessProfilingInfo new_methods=27 is saved saved_to_disk=1 resolve_classes_delay=8000
W/.socialmediaap: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
I/Timeline: Timeline: Activity_launch_request time:544944458 intent:Intent { act=com.google.android.gms.auth.GOOGLE_SIGN_IN pkg=com.example.socialmediaapp cmp=com.example.socialmediaapp/com.google.android.gms.auth.api.signin.internal.SignInHubActivity (has extras) }
W/ActivityThread: handleWindowVisibility: no activity for token [email protected]
I/Timeline: Timeline: Activity_launch_request time:544944504 intent:Intent { act=com.google.android.gms.auth.GOOGLE_SIGN_IN pkg=com.google.android.gms (has extras) }
W/SignInActivity Tag: Google sign in failed
com.google.android.gms.common.api.ApiException: 10:
at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(com.google.android.gms:[email protected]@17.5.0:4)
at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(com.google.android.gms:[email protected]@19.0.0:9)
at com.example.socialmediaapp.SignInActivity.onActivityResult(SignInActivity.kt:87)
at android.app.Activity.dispatchActivityResult(Activity.java:7590)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4416)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4465)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Here is the build.gradle (app)file

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.example.socialmediaapp"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.android.support:multidex:1.0.3'
    implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion"

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines"
    api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines"

    // UI
    implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion"
    implementation "com.google.android.material:material:$rootProject.materialVersion"

    /* coroutines support for firebase operations */
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.1.1'


    // Import the BoM for the Firebase platform
    implementation platform('com.google.firebase:firebase-bom:26.1.0')
    implementation 'com.google.firebase:firebase-firestore'
    implementation 'com.google.firebase:firebase-auth-ktx'
    implementation 'com.firebaseui:firebase-ui-firestore:6.4.0'

    implementation 'com.google.android.gms:play-services-location:18.0.0'

    implementation 'com.github.bumptech.glide:glide:4.11.0'
    implementation 'com.google.android.gms:play-services-auth:19.0.0'
    implementation 'com.google.firebase:firebase-auth:20.0.2'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

    // Testing
    testImplementation "junit:junit:$rootProject.junitVersion"
    androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"
    androidTestImplementation ("androidx.test.espresso:espresso-core:$rootProject.espressoVersion", {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestImplementation "androidx.test.ext:junit:$rootProject.androidxJunitVersion"

}

Here is the SignInActivity.kt file code

> package com.example.socialmediaapp import android.content.Context
> import android.content.Intent import
> androidx.appcompat.app.AppCompatActivity import android.os.Bundle
> import android.util.Log import android.view.View import
> android.widget.Toast //import com.example.socialapp.daos.UserDao
> //import com.example.socialapp.models.User import
> com.google.android.gms.auth.api.signin.GoogleSignIn import
> com.google.android.gms.auth.api.signin.GoogleSignInAccount import
> com.google.android.gms.auth.api.signin.GoogleSignInClient import
> com.google.android.gms.auth.api.signin.GoogleSignInOptions import
> com.google.android.gms.common.api.ApiException import
> com.google.android.gms.tasks.Task import
> com.google.firebase.auth.FirebaseAuth import
> com.google.firebase.auth.FirebaseUser import
> com.google.firebase.auth.GoogleAuthProvider import
> com.google.firebase.auth.ktx.auth import
> com.google.firebase.ktx.Firebase import
> kotlinx.android.synthetic.main.activity_sign_in.* import
> kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope
> import kotlinx.coroutines.launch import kotlinx.coroutines.tasks.await
> import kotlinx.coroutines.withContext
> 
> class SignInActivity : AppCompatActivity() {
>     private val RC_SIGN_IN=123
>     private val TAG="SignInActivity Tag"
>     private lateinit var auth: FirebaseAuth
>     private lateinit var googleSignInClient:GoogleSignInClient
>     override fun onCreate(savedInstanceState: Bundle?) {
>         super.onCreate(savedInstanceState)
>         setContentView(R.layout.activity_sign_in)
> 
>         // Configure Google Sign In
>         val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
>             .requestIdToken(getString(R.string.default_web_client_id))
>             .requestEmail()
>             .build()
> 
>          googleSignInClient=GoogleSignIn.getClient(this,gso)
>         auth = Firebase.auth
>         signInButton.setOnClickListener {
>             signIn()
>         }
>     }
>     private fun signIn() {
> 
>         val signInIntent = googleSignInClient.signInIntent
>         startActivityForResult(signInIntent, RC_SIGN_IN)
>     }
>     override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
>         super.onActivityResult(requestCode, resultCode, data)
> 
>         // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
>         if (requestCode == RC_SIGN_IN) {
>             val task = GoogleSignIn.getSignedInAccountFromIntent(data)
>             handleSignInResult(task)
>         }
>     }
> 
>     private fun handleSignInResult(completedtask: Task<GoogleSignInAccount>?) {
>         try {
>             // Google Sign In was successful, authenticate with Firebase
>             val account = completedtask?.getResult(ApiException::class.java)!!
>             Log.d(TAG, "firebaseAuthWithGoogle:" + account.id)
> 
>            // Toast.makeText(this,"Sign In",Toast.LENGTH_LONG).show()
>             firebaseAuthWithGoogle(account.idToken!!)
>         } catch (e: ApiException) {
>             // Google Sign In failed, update UI appropriately
>             Log.w(TAG, "Google sign in failed", e)
>             // ...
>         }
> 
> 
>     }
> 
>     private fun firebaseAuthWithGoogle(idToken: String) {
>         val credential = GoogleAuthProvider.getCredential(idToken, null)
>         signInButton.visibility= View.GONE
>         progressBar.visibility=View.VISIBLE
>         GlobalScope.launch(Dispatchers.IO) {
>             val auth = auth.signInWithCredential(credential).await()
>             val firebaseUser = auth.user
>             withContext(Dispatchers.Main) {
>                 updateUI(firebaseUser)
>             }
> 
>         }
>        // Toast.makeText(this,"Sign In",Toast.LENGTH_LONG).show()
> 
> 
>     }
> 
>     private fun updateUI(firebaseUser: FirebaseUser?) {
>        if(firebaseUser!=null){
>             val mainActivityIntent=Intent(this,MainActivity::class.java)
>             startActivity(mainActivityIntent)
> 
>             //Toast.makeText(this,"Sign In",Toast.LENGTH_LONG).show()
>             finish()
>         }
>      else{
>             signInButton.visibility= View.VISIBLE
>             progressBar.visibility=View.GONE
> 
>            // Toast.makeText(this,"Sign In not",Toast.LENGTH_LONG).show()
>       }
> 
>     } }

Source: Android Questions

LEAVE A COMMENT