6

I am trying to implement Google Sign In on my application.

Its working fine, but when I try to login, I get the following error on my logcat:

2018-10-04 14:55:14.784 16313-16313/? I/AppCompatDelegate: Failed to instantiate custom view inflater android.support.v7.app.AppCompatViewInflater. Falling back to default. java.lang.ClassNotFoundException: android.support.v7.app.AppCompatViewInflater at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:453) at java.lang.Class.forName(Class.java:378) at android.support.v7.app.AppCompatDelegateImpl.a(:com.google.android.gms@13280019@13.2.80 (040400-211705629):1) at android.support.v7.app.AppCompatDelegateImpl.onCreateView(:com.google.android.gms@13280019@13.2.80 (040400-211705629):1) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1933) at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2586) at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2659) at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2067) at android.app.ActivityTransitionState.setEnterActivityOptions(ActivityTransitionState.java:160) at android.app.Activity.performCreate(Activity.java:7016) at android.app.Activity.performCreate(Activity.java:7000) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatViewInflater" on path: DexPathList[[zip file "/system/framework/com.android.media.remotedisplay.jar", zip file "/system/framework/com.android.location.provider.jar", zip file "/data/app/com.google.android.gms-mJ0x6f9TEv9BnQUq-xGhTw==/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.gms-mJ0x6f9TEv9BnQUq-xGhTw==/lib/arm64, /data/app/com.google.android.gms-mJ0x6f9TEv9BnQUq-xGhTw==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:453)  at java.lang.Class.forName(Class.java:378)  at android.support.v7.app.AppCompatDelegateImpl.a(:com.google.android.gms@13280019@13.2.80 (040400-211705629):1)  at android.support.v7.app.AppCompatDelegateImpl.onCreateView(:com.google.android.gms@13280019@13.2.80 (040400-211705629):1)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1933)  at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2586)  at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2659)  at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2067)  at android.app.ActivityTransitionState.setEnterActivityOptions(ActivityTransitionState.java:160)  at android.app.Activity.performCreate(Activity.java:7016)  at android.app.Activity.performCreate(Activity.java:7000)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6494)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

I am using the new AndroidX libraries and I have implemented the following dependency:

implementation 'androidx.appcompat:appcompat:1.0.0'

I have also changed the gradle.properties to let Android knows that I am using the new AndroidX libraries:

# Default properties
org.gradle.jvmargs=-Xmx1536m

# Android X properties
android.useAndroidX=true
android.enableJetifier=true

By modifying the gradle.properties all other dependencies should use the new AndroidX libraries right? Why it is trying to use an old V7 library? And how should I solve this problem?


EDIT

Here is my gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId 'my.package.name'

        versionName '1.0.0'
        versionCode 1

        minSdkVersion 16
        targetSdkVersion 28

        multiDexEnabled true
    }

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

dependencies {
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.0'

    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.2.71'
}
Ravers
  • 988
  • 2
  • 14
  • 45
  • what is your android studio version? –  Oct 08 '18 at 14:27
  • The AppcompatViewInflator's androidX dependency is androidx.appcompat.app.AppCompatViewInflater. Maybe your code is not refactored by AS. I think manually changing the import when you use the AppCompatViewInflator might fix the problem. I use 'migrate to AndroidX' whenever I need to switch to AndroidX so that the existing code can be also refactored. – WasabiTea Oct 08 '18 at 14:28
  • @sanaebadi I am using Android Studio 3.2 – Ravers Oct 09 '18 at 11:59
  • @WasabiTea unfortunately even refactoring with AS did not solve the problem. – Ravers Oct 09 '18 at 12:09
  • How did you fix this? – thiagolr Jan 18 '20 at 13:26

2 Answers2

0

I dont think above stack trace from logcat is the actual issue you are facing since the issue is info (I) type but not error. I think there is some other error you might be missing. Try to use adb -d logcat -s <ClassNameWhichCanThrowError> to see the actual error or dig deep into logcat for any error of type E/ClassNameWhichCanThrowError

tranandh
  • 118
  • 1
  • 8
0

I had same problem, but I found another log which is google login fail. So, I went back to check where the problem is. Finally, it's just because I didn't give firebase SHA-1 key(debug). Maybe you can try the same function.

Aaron
  • 139
  • 1
  • 3