hansemannn / titanium-firebase-auth

Use the Firebase Autentication SDK in Axway Titanium 🚀
Other
7 stars 8 forks source link

Failed resolution of: Lcom/google/android/gms/internal/aad; #15

Closed culda closed 4 years ago

culda commented 4 years ago

Environment:

Android Titanium 8.3.1 playservices 16.1.3 firebase.core 5.0.0 firebase.analytics 3.0.0 firebase.cloudmessaging 2.0.4 firebase.auth 1.0.1

var FirebaseCore = require('firebase.core');
FirebaseCore.configure();
var FirebaseAuth = require('firebase.auth');
var currentUser = FirebaseAuth.currentUser();

I tried various version combinations, but all roads lead to this error - which triggers whenever I use any method from the FirebaseAuth object such as currentUser().

It would be awesome if somebody could share a working list of module versions that I could try.

[ERROR] :  TiBaseActivity: (main) [187,20056] Error dispatching lifecycle event: Failed resolution of: Lcom/google/android/gms/internal/aad;
[ERROR] :  TiBaseActivity: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/aad;
[ERROR] :  TiBaseActivity:  at java.lang.Class.classForName(Native Method)
[ERROR] :  TiBaseActivity:  at java.lang.Class.forName(Class.java:454)
[ERROR] :  TiBaseActivity:  at java.lang.Class.forName(Class.java:379)
[ERROR] :  TiBaseActivity:  at com.google.firebase.FirebaseApp.initializeApis(com.google.firebase:firebase-common@@16.1.0:810)
[ERROR] :  TiBaseActivity:  at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common@@16.1.0:781)
[ERROR] :  TiBaseActivity:  at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@16.1.0:369)
[ERROR] :  TiBaseActivity:  at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@16.1.0:332)
[ERROR] :  TiBaseActivity:  at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@16.1.0:316)
[ERROR] :  TiBaseActivity:  at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@16.1.0:53)
[ERROR] :  TiBaseActivity:  at android.content.ContentProvider.attachInfo(ContentProvider.java:2092)
[ERROR] :  TiBaseActivity:  at android.content.ContentProvider.attachInfo(ContentProvider.java:2066)
[ERROR] :  TiBaseActivity:  at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@16.1.0:47)
[ERROR] :  TiBaseActivity:  at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
[ERROR] :  TiBaseActivity:  at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)
[ERROR] :  TiBaseActivity:  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6445)
[ERROR] :  TiBaseActivity:  at android.app.ActivityThread.access$1300(ActivityThread.java:219)
[ERROR] :  TiBaseActivity:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
[ERROR] :  TiBaseActivity:  at android.os.Handler.dispatchMessage(Handler.java:107)
[ERROR] :  TiBaseActivity:  at android.os.Looper.loop(Looper.java:214)
[ERROR] :  TiBaseActivity:  at android.app.ActivityThread.main(ActivityThread.java:7356)
[ERROR] :  TiBaseActivity:  at java.lang.reflect.Method.invoke(Native Method)
[ERROR] :  TiBaseActivity:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
[ERROR] :  TiBaseActivity:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
[ERROR] :  TiBaseActivity: Caused by: java.lang.ClassNotFoundException: com.google.android.gms.internal.aad

Attaching full console log

console-missing-aad.log

culda commented 4 years ago

More than happy to debug myself if somebody could share a working set of modules that includes firebase-auth. I just don't have a good reference point and I feel like my versions are bad because I jumped so many hurdles by updating the versions, just not this hurdle.

culda commented 4 years ago

Update I replaced the old AAR with firebase-auth-15.0.0.aar under the firebase.auth module and I'm getting a different error (feels like progress)

[ERROR] :  TiExceptionHandler: (main) [6,178] /app.js:35
[ERROR] :  TiExceptionHandler: var currentUser = FirebaseAuth.currentUser();
[ERROR] :  TiExceptionHandler:                                ^
[ERROR] :  TiExceptionHandler: Error: Attempt to invoke virtual method 'com.google.firebase.auth.FirebaseUser com.google.firebase.auth.FirebaseAuth.getCurrentUser()' on a null object reference
[ERROR] :  TiExceptionHandler:     at /app.js:35:32
[ERROR] :  TiExceptionHandler:     at Module._runScript (ti:/module.js:608:9)
[ERROR] :  TiExceptionHandler:     at Module.load (ti:/module.js:107:7)
[ERROR] :  TiExceptionHandler:     at Module.loadJavascriptText (ti:/module.js:453:9)
[ERROR] :  TiExceptionHandler:     at Module.loadAsFile (ti:/module.js:508:15)
[ERROR] :  TiExceptionHandler:     at Module.loadAsFileOrDirectory (ti:/module.js:425:20)
[ERROR] :  TiExceptionHandler:     at Module.require (ti:/module.js:255:17)
[ERROR] :  TiExceptionHandler:     at Module.global.Module.require (<embedded>:9507:34)
[ERROR] :  TiExceptionHandler:     at require (ti:/module.js:566:15)
[ERROR] :  TiExceptionHandler:     at global.require (<embedded>:9491:10)
[ERROR] :  TiExceptionHandler:
[ERROR] :  TiExceptionHandler:     firebase.auth.TitaniumFirebaseAuthModule.getCurrentUser(TitaniumFirebaseAuthModule.java:266)
[ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
[ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:168)
[ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.KrollRuntime.runModule(KrollRuntime.java:225)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.TiLaunchActivity.loadScript(TiLaunchActivity.java:107)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.TiRootActivity.loadScript(TiRootActivity.java:480)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.TiLaunchActivity.onResume(TiLaunchActivity.java:192)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.TiRootActivity.onResume(TiRootActivity.java:499)
[ERROR] :  TiExceptionHandler:     android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1446)
[ERROR] :  TiExceptionHandler:     android.app.Activity.performResume(Activity.java:7939)
[ERROR] :  V8Exception: Exception occurred at /app.js:35: Uncaught Error: Attempt to invoke virtual method 'com.google.firebase.auth.FirebaseUser com.google.firebase.auth.FirebaseAuth.getCurrentUser()' on a null object reference
culda commented 4 years ago

I've made a new build and tried every possible version of firebase-auth .aar, still no avail. My current build Titanium 9.0.1

        <module platform="android" version="17.1.1">ti.playservices</module>
        <module platform="android" version="6.0.0">firebase.core</module>
        <module platform="android" version="3.0.0">firebase.analytics</module>
        <module platform="android" version="3.0.0">firebase.cloudmessaging</module>
        <module platform="android" version="1.0.1">firebase.auth</module>

Using the sample code

var FirebaseAuth = require('firebase.auth');

FirebaseAuth.signInWithEmail({
  email: 'john@doe.com',
  password: 't1r0ck$!',
  callback: function(e) {
    if (!e.success) {
      Ti.API.error('Error: ' + e.error);
      return;
    }

    Ti.API.info('Success!');
    Ti.API.info(e.user);
  }
});

Stack trace

[ERROR] :  TiExceptionHandler: (main) [25,332] /app.js:37
[ERROR] :  TiExceptionHandler: FirebaseAuth.signInWithEmail({
[ERROR] :  TiExceptionHandler:              ^
[ERROR] :  TiExceptionHandler: Error: Failed resolution of: Lcom/google/firebase/internal/InternalTokenProvider;
[ERROR] :  TiExceptionHandler:     at /app.js:37:14
[ERROR] :  TiExceptionHandler:     at Module._runScript (ti:/module.js:587:9)
[ERROR] :  TiExceptionHandler:     at Module.load (ti:/module.js:106:7)
[ERROR] :  TiExceptionHandler:     at Module.loadJavascriptText (ti:/module.js:436:9)
[ERROR] :  TiExceptionHandler:     at Module.loadAsFile (ti:/module.js:488:15)
[ERROR] :  TiExceptionHandler:     at Module.loadAsFileOrDirectory (ti:/module.js:410:20)
[ERROR] :  TiExceptionHandler:     at Module.require (ti:/module.js:239:23)
[ERROR] :  TiExceptionHandler:     at Module.global.Module.require (<embedded>:19311:34)
[ERROR] :  TiExceptionHandler:     at require (ti:/module.js:550:15)
[ERROR] :  TiExceptionHandler:     at global.require (<embedded>:19295:10)
[ERROR] :  TiExceptionHandler:
[ERROR] :  TiExceptionHandler:     java.lang.Class.newInstance(Native Method)
[ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.createProxy(KrollProxy.java:136)
[ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)
[ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:55)
[ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:41)
[ERROR] :  TiExceptionHandler:     ti.modules.titanium.TitaniumModule$Timer.run(TitaniumModule.java:167)
[ERROR] :  TiExceptionHandler:     android.os.Handler.handleCallback(Handler.java:883)
[ERROR] :  TiExceptionHandler:     android.os.Handler.dispatchMessage(Handler.java:100)
[ERROR] :  TiExceptionHandler:     android.os.Looper.loop(Looper.java:214)
[ERROR] :  TiExceptionHandler:     android.app.ActivityThread.main(ActivityThread.java:7356)
[ERROR] :  V8Exception: Exception occurred at /app.js:37: Uncaught Error: Failed resolution of: Lcom/google/firebase/internal/InternalTokenProvider;
culda commented 4 years ago

Manage to find a workaround - see 6