hansemannn / titanium-crashlytics

Use the native Crashlytics SDK in Titanium (iOS / Android).
MIT License
18 stars 18 forks source link

Android error #1

Closed Wingee closed 5 years ago

Wingee commented 6 years ago

I've added the meta tag

I've signed up to Fabric, although Fabric dashboard just keeps redirecting me to the installation instructions.

But I'm getting the following error.

[ERROR] : TiExceptionHandler: (main) [3425,3425] ----- Titanium Javascript Runtime Error ----- [ERROR] : TiExceptionHandler: (main) [0,3425] - In /app.js:91,13 [ERROR] : TiExceptionHandler: (main) [0,3425] - Message: Uncaught Must Initialize Fabric before using singleton() [ERROR] : TiExceptionHandler: (main) [0,3425] - Source: Crashlytics.crash(); [ERROR] : V8Exception: Exception occurred at /app.js:91: Uncaught Must Initialize Fabric before using singleton() [ERROR] : V8Exception: Must Initialize Fabric before using singleton() [ERROR] : CrashlyticsCore: . [ERROR] : CrashlyticsCore: . | | [ERROR] : CrashlyticsCore: . | | [ERROR] : CrashlyticsCore: . | | [ERROR] : CrashlyticsCore: . \ | | / [ERROR] : CrashlyticsCore: . \ / [ERROR] : CrashlyticsCore: . \ / [ERROR] : CrashlyticsCore: . \/ [ERROR] : CrashlyticsCore: . [ERROR] : CrashlyticsCore: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up, [ERROR] : CrashlyticsCore: install an Android build tool and ask a team member to invite you to this app's organization. [ERROR] : CrashlyticsCore: . [ERROR] : CrashlyticsCore: . /\ [ERROR] : CrashlyticsCore: . / \ [ERROR] : CrashlyticsCore: . / \ [ERROR] : CrashlyticsCore: . / | | \ [ERROR] : CrashlyticsCore: . | | [ERROR] : CrashlyticsCore: . | | [ERROR] : CrashlyticsCore: . [ERROR] : TiBaseActivity: (main) [30,3455] Error dispatching lifecycle event: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up, [ERROR] : TiBaseActivity: install an Android build tool and ask a team member to invite you to this app's organization. [ERROR] : TiBaseActivity: io.fabric.sdk.android.services.concurrency.UnmetDependencyException: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up, [ERROR] : TiBaseActivity: install an Android build tool and ask a team member to invite you to this app's organization. [ERROR] : TiBaseActivity: at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:235) [ERROR] : TiBaseActivity: at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:209) [ERROR] : TiBaseActivity: at io.fabric.sdk.android.InitializationTask.onPreExecute(InitializationTask.java:44) [ERROR] : TiBaseActivity: at io.fabric.sdk.android.services.concurrency.AsyncTask.executeOnExecutor(AsyncTask.java:611) [ERROR] : TiBaseActivity: at io.fabric.sdk.android.services.concurrency.PriorityAsyncTask.executeOnExecutor(PriorityAsyncTask.java:43) [ERROR] : TiBaseActivity: at io.fabric.sdk.android.Kit.initialize(Kit.java:69) [ERROR] : TiBaseActivity: at io.fabric.sdk.android.Fabric.initializeKits(Fabric.java:440) [ERROR] : TiBaseActivity: at io.fabric.sdk.android.Fabric.init(Fabric.java:384) [ERROR] : TiBaseActivity: at io.fabric.sdk.android.Fabric.setFabric(Fabric.java:342) [ERROR] : TiBaseActivity: at io.fabric.sdk.android.Fabric.with(Fabric.java:313) [ERROR] : TiBaseActivity: at ti.crashlytics.TitaniumCrashlyticsModule.onStart(TitaniumCrashlyticsModule.java:39) [ERROR] : TiBaseActivity: at org.appcelerator.titanium.TiLifecycle.fireLifecycleEvent(TiLifecycle.java:150) [ERROR] : TiBaseActivity: at org.appcelerator.titanium.TiBaseActivity.onStart(TiBaseActivity.java:1378) [ERROR] : TiBaseActivity: at org.appcelerator.titanium.TiLaunchActivity.onStart(TiLaunchActivity.java:411) [ERROR] : TiBaseActivity: at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1340) [ERROR] : TiBaseActivity: at android.app.Activity.performStart(Activity.java:7191) [ERROR] : TiBaseActivity: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2918) [ERROR] : TiBaseActivity: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030) [ERROR] : TiBaseActivity: at android.app.ActivityThread.-wrap11(Unknown Source:0) [ERROR] : TiBaseActivity: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) [ERROR] : TiBaseActivity: at android.os.Handler.dispatchMessage(Handler.java:105) [ERROR] : TiBaseActivity: at android.os.Looper.loop(Looper.java:164) [ERROR] : TiBaseActivity: at android.app.ActivityThread.main(ActivityThread.java:6938) [ERROR] : TiBaseActivity: at java.lang.reflect.Method.invoke(Native Method) [ERROR] : TiBaseActivity: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) [ERROR] : TiBaseActivity: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

hansemannn commented 6 years ago

Hey there! Do you use main- or (deprecated) kroll-thread? I have only tested with main-thread so far.

Wingee commented 6 years ago

Hi! Krollthread.... that must be the issue

hansemannn commented 6 years ago

Oh, I just reproduced it. You need to wait until the app finished opening (e.g. after the first open event of your window). I configured the module so that you do not need to initialize it manually, but the native SDK initializes with the native Activity, which is only available when the app is ready to go.

hansemannn commented 6 years ago
import Crashlytics from 'ti.crashlytics';

const window = Ti.UI.createWindow();
window.addEventListener('open', () => {
    Crashlytics.log('HELLO_WORLD')
});
window.open();
Wingee commented 6 years ago

My app is built using Alloy, so I tried this:

        $.index.addEventListener('open', function(e) {
            Alloy.Globals.Crashlytics = require('ti.crashlytics');
            setTimeout(function(){
                Alloy.Globals.Crashlytics.crash();
            },10000);
        });

This error now occurs during the call to make it crash:

[ERROR] : TiExceptionHandler: (main) [10210,10600] ----- Titanium Javascript Runtime Error ----- [ERROR] : TiExceptionHandler: (main) [0,10600] - In /alloy/controllers/index.js:230,27 [ERROR] : TiExceptionHandler: (main) [0,10600] - Message: Uncaught Must Initialize Fabric before using singleton() [ERROR] : TiExceptionHandler: (main) [1,10601] - Source: Alloy.Globals.Crashlytics.crash(); [ERROR] : V8Exception: Exception occurred at /alloy/controllers/index.js:230: Uncaught Must Initialize Fabric before using singleton() [ERROR] : V8Exception: Must Initialize Fabric before using singleton()

hansemannn commented 6 years ago

The module should be required at the earliest point, the API's should be called afterwards. And that it generally crashes is normal, that's what the API is for. But it should be initialized before. I guess you have properly prepared your tiapp.xml like described in https://github.com/hansemannn/titanium-crashlytics-demo ? Including the apiKey in the manifest, the platform/res/values entry etc?

Wingee commented 6 years ago

Yes I had required the module in the alloy.js file originally which was causing the error. If I put it back into the alloy.js file the original error exists.

I've started this on Android and yes I've put the apikey in the manifest section of the tiapp.xml

hansemannn commented 6 years ago

Does my sample app run for you?

Wingee commented 6 years ago

From the looks of your sample you're using an SDK version newer than 7.2.0GA? I believe...

hansemannn commented 6 years ago

Yep, 7.3.0 (RC today), but it should work the same with 7.2.0 I believe.

macasfaj commented 6 years ago

@Wingee @hansemannn I have the same issue, using 7.2.0GA and Android module 1.1.0.

One question, I'm not using crashlytics.xml. What should I add there?

Thanks!

hansemannn commented 6 years ago

I just updated the Android module to 1.1.1 which might resolve this. I have not had the change to test all components of it, so feedback and contributions are welcome!

Wingee commented 6 years ago

Unfortunately still having the same error @hansemannn :

[ERROR] : CrashlyticsCore: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up, [ERROR] : CrashlyticsCore: install an Android build tool and ask a team member to invite you to this app's organization.

This is building with 7.3.1 GA and the 1.1.1 module

testampat commented 6 years ago

I am still getting error of [ERROR] : TiExceptionHandler: Crashlytics.crash(); [ERROR] : TiExceptionHandler: ^ [ERROR] : TiExceptionHandler: Error: Must Initialize Fabric before using singleton() [ERROR] : TiExceptionHandler: at Titanium. (/alloy/controllers/crashlytics.js:71:16)

vishal95713 commented 5 years ago

I fixed this problem by adding UUID to platform/android/res/values/strings :) for reference check this link fabric After adding this I did not get any error but firebase does not update crash.

hansemannn commented 5 years ago

Thanks! Updating the readme now.

vishal95713 commented 5 years ago

Hello Hansemannn,

After than also my app is not updating in crashlytics dashboard. I don't know what I am doing wrong.