Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException in setAdvertisingID #105

Closed
n-belokopytov opened this issue Mar 23, 2015 · 1 comment
Closed

java.lang.IllegalStateException in setAdvertisingID #105

n-belokopytov opened this issue Mar 23, 2015 · 1 comment
Assignees
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.
Milestone

Comments

@n-belokopytov
Copy link

I am initializing analytics tracker in the onCreate method of my app and I am getting this:

 Caused by: java.lang.IllegalStateException: Calling this from your main thread can lead to deadlock
        at com.google.android.gms.common.internal.zzx.zzbe(Unknown Source)
        at com.google.android.gms.ads.identifier.AdvertisingIdClient.finish(Unknown Source)
        at com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(Unknown Source)
        at com.snowplowanalytics.snowplow.tracker.Subject.setAdvertisingID(Subject.java:189)
        at com.snowplowanalytics.snowplow.tracker.Subject.setContextualParams(Subject.java:89)
        at com.snowplowanalytics.snowplow.tracker.Subject.<init>(Subject.java:80)
        at com.chefsfeed.Analytics.getSnowplowInstance(Analytics.java:276)

Here is the code in getSnowplowInstance method:

        RequestCallback callback = new RequestCallback() {
            @Override
            public void onSuccess(int successCount) {
                Log.d(TAG, "Buffer length for POST/GET:" + successCount);
            }
            @Override
            public void onFailure(int successCount, int failureCount) {
                Log.d(TAG, "Failures: " + failureCount + "; Successes: " + successCount);
            }
        };

        Emitter e2 = new Emitter
                .EmitterBuilder("com.chefsfeed", context)
                .callback(callback)
                .build();

        // Create a Tracker with all options
        mTracker = new Tracker
                .TrackerBuilder(e2, context.getPackageName(), context.getApplicationInfo().name)
                .base64(true) // Optional - defines if we use base64 encoding
                .platform(DevicePlatforms.Mobile) // Optional - defines what platform the event will report to be on
                .subject(new Subject(context)) // Optional - a subject which contains values appended to every event
                .build();

Also unrelated to that - your lib sure has a lot of dependencies and is a pain to integrate. Adding
-dontwarn com.snowplowanalytics.snowplow.tracker.**
-dontwarn com.fasterxml.jackson.databind.**
-dontwarn okio.**
-dontwarn rx.internal.util.unsafe.**
to the proguard and all the corresponding dependencies to the gradle file.

@alexanderdean alexanderdean added this to the Version 0.4.0 milestone Mar 23, 2015
@alexanderdean alexanderdean added the type:defect Bugs or weaknesses. The issue has to contain steps to reproduce. label Mar 23, 2015
@jbeemster
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.
Projects
None yet
Development

No branches or pull requests

3 participants