SDKBox analytics plugin not initialized - Android

Hi,

I have a problem with Google Analytics integration in my game.

I’ve tried the sample app, and it works. My app is exactly the same and it doesn’t.
I can’t see
I/SDKBox (PID): class name : ----com/sdkbox/plugin/PluginGoogleAnalytics----
in logs when it starts. Actually I see nothing related to analytics/sdkbox in the logs. I’m sure that sdkbox::PluginGoogleAnalytics::init(); is invoked and start session as well. Every step in the docs checked as well.

Do you know what else can cause that the plugin is not initialized?

BTW, everything works in iOS, when I added IAP it works on both iOS and Android, only analytics are a problem.

Thanks,
Adam

Hi @akotkowski

Could you please tally your part of the code with the Manual Integration for Android
section of the docs and see if something is missing.

Also, do cross-check once with the sample and make sure your tracking code is correct also.

Best,
Pabitra

Hey,
Thanks for the answer.
I’ve checked project configuration if it’s in line with manual integration about 1000 times :smile:
Now I made a new project:
cocos new -l cpp -p com.akotkowski.businessinc business-inc
, install the latest sdkbox:
python -c "import urllib; s = urllib.urlopen('https://raw.githubusercontent.com/sdkbox-doc/en/master/install/install.py').read(); exec s"
, import googleanalytics plugin:
sdkbox import googleanalytics -> finished OK
change tracking code in sdkbox_config.json
and run it with:
cocos run -p android
and it still doesn’t work. Here is the log:

D/cocos2d-x debug info(29268): [SDKBOX] - INIT
D/cocos2d-x debug info(29268): create rendererRecreatedListener for GLProgramState
D/CocosPlayClient.cpp(29268): isEnabled = 0
D/CocosPlayClient.cpp(29268): isDemo = 0
D/CocosPlayClient.cpp(29268): isNotifyFileLoadedEnabled = 0
D/cocos2d-x debug info(29268): create rendererRecreatedListener for GLProgramState
D/cocos2d-x debug info(29268): create rendererRecreatedListener for GLProgramState
D/cocos2d-x debug info(29268): create rendererRecreatedListener for GLProgramState
D/cocos2d-x debug info(29268): [SDKBOX] - SESSION START
I/TRACKING_STORAGE(29268): Can’t load tracking info: java.io.IOException: BufferedInputStream is closed
I/TRACKING_STORAGE(29268): Size loaded: 0
I/TRACKING_STORAGE(29268): Saved 0 tracking info _elements.
W/dalvikvm(29268): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
D/CSC (29268): No application token, skip remote config process
W/dalvikvm(29268): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
W/dalvikvm(29268): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
W/dalvikvm(29268): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
D/CSC (29268): Applied config ‘{“android”:{“GoogleAnalytics”:{“trackingCode”:“UA-CODE-1”}},“ios”:{“GoogleAnalytics”:{“trackingCode”:“UA-CODE-1”}}}’
W/dalvikvm(29268): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
W/dalvikvm(29268): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
I/dalvikvm(29268): Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
W/dalvikvm(29268): VFY: unable to resolve virtual method 145: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
D/dalvikvm(29268): VFY: replacing opcode 0x6e at 0x00c8
E/dalvikvm(29268): Could not find class ‘android.support.v4.app.NotificationCompat$Builder’, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
W/dalvikvm(29268): VFY: unable to resolve new-instance 207 (Landroid/support/v4/app/NotificationCompat$Builder;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
D/dalvikvm(29268): VFY: replacing opcode 0x22 at 0x00f5
E/dalvikvm(29268): Could not find class ‘android.support.v4.app.FragmentActivity’, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
W/dalvikvm(29268): VFY: unable to resolve instanceof 202 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
D/dalvikvm(29268): VFY: replacing opcode 0x20 at 0x0000
E/dalvikvm(29268): Could not find class ‘android.support.v4.app.FragmentActivity’, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
W/dalvikvm(29268): VFY: unable to resolve check-cast 202 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
D/dalvikvm(29268): VFY: replacing opcode 0x1f at 0x0004
I/dalvikvm(29268): Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzh
W/dalvikvm(29268): VFY: unable to resolve virtual method 314: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
D/dalvikvm(29268): VFY: replacing opcode 0x6e at 0x000b
D/dalvikvm(29268): DexOpt: unable to opt direct call 0x039b at 0xf7 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.zza
V/Zygote (29297): Switching descriptor 32 to /dev/null
V/Zygote (29297): Switching descriptor 10 to /dev/null
I/ActivityManager( 2205): Start proc com.google.android.partnersetup for broadcast com.google.android.partnersetup/.RlzPingBroadcastReceiver: pid=29297 uid=10022 gids={50022, 3003}
I/ActivityManager( 2205): Killing 28461:com.android.gallery3d/u0a43 (adj 15): empty #17
D/TRACKING_STORAGE(29268): Track pending request ok.
I/TRACKING_STORAGE(29268): Saved 1 tracking info _elements.
I/TRACKING_STORAGE(29268): Sync request while syncing
I/TRACKING_STORAGE(29268): Sync request while syncing
D/ActivityThread(29297): handleBindApplication:com.google.android.partnersetup
D/ActivityThread(29297): setTargetHeapUtilization:0.25
D/ActivityThread(29297): setTargetHeapMinFree:524288
V/Zygote (29315): Switching descriptor 32 to /dev/null
V/Zygote (29315): Switching descriptor 10 to /dev/null
I/ActivityManager( 2205): Start proc com.android.gallery3d for broadcast com.android.gallery3d/.app.PackagesMonitor: pid=29315 uid=10043 gids={50043, 1006, 3003, 1028, 1015, 3002}
I/ActivityManager( 2205): Killing 29064:com.android.keychain/1000 (adj 15): empty #17
D/ActivityThread(29315): handleBindApplication:com.android.gallery3d
D/ActivityThread(29315): setTargetHeapUtilization:0.25
D/ActivityThread(29315): setTargetHeapMinFree:524288
I/UpdateIcingCorporaServi(28087): Updating corpora: APPS=com.akotkowski.businessinc, CONTACTS=MAYBE
D/ChimeraCfgMgr(27782): Loading module com.google.android.gms.games from APK com.google.android.gms
D/PackageBroadcastService(27782): Received broadcast action=android.intent.action.PACKAGE_ADDED and uri=com.akotkowski.businessinc
D/ChimeraCfgMgr(27782): Loading module com.google.android.gms.gass from APK com.google.android.gms
D/AsyncTaskServiceImpl(27782): Submit a task: h
D/ChimeraCfgMgr(27782): Loading module com.google.android.gms.gass from APK com.google.android.gms
D/ChimeraCfgMgr(27782): Loading module com.google.android.gms.vision from APK com.google.android.gms
D/h (27782): Processing package: com.akotkowski.businessinc
I/ActivityManager( 2205): Delay finish: com.android.vending/com.google.android.finsky.receivers.PackageMonitorReceiver$RegisteredReceiver
D/GassUtils(27782): Found app info for package com.akotkowski.businessinc:1. Hash: 7e135fe4707ae8d03f28f2ccda4deb600228000fa393302ff14be1b139e79b39
I/PeopleContactsSync(27782): CP2 sync disabled
D/h (27782): Found info for package com.akotkowski.businessinc in db.
D/TRACKING_STORAGE(29268): Track pending request ok.
I/TRACKING_STORAGE(29268): Saved 2 tracking info _elements.
I/UpdateIcingCorporaServi(28087): UpdateCorporaTask done [took 207 ms] updated apps [took 207 ms]
I/ActivityManager( 2205): Resuming delayed broadcast
I/ActivityManager( 2205): Killing 29079:com.google.android.googlequicksearchbox/u0a25 (adj 15): empty #17
D/TRACKING_STORAGE(29268): Track pending request ok.
I/TRACKING_STORAGE(29268): Saved 1 tracking info _elements.
D/TRACKING_STORAGE(29268): Track pending request ok.
I/TRACKING_STORAGE(29268): Saved 0 tracking info _elements.
I/TRACKING_STORAGE(29268): Saved 0 tracking info _elements.
I/Icing (27782): Indexing 82227D4EBE9725A61796FBDF5CC42364E1DB8A82 from com.google.android.googlequicksearchbox
I/Icing (27782): Indexing done 82227D4EBE9725A61796FBDF5CC42364E1DB8A82
W/ProcessCpuTracker( 2205): Skipping unknown process pid 29338
D/LightsService( 2205): Excessive delay setting light: 103ms
D/Finsky (28111): [7822] AppStatesReplicator.handleContentSyncResponse: Completed 0 account content syncs with 0 successful.
D/Finsky (28111): [1] ContentSyncService$5.onFinished: Installation state replication succeeded.
I/PowerManagerService( 2205): Going to sleep due to screen timeout…
D/SurfaceFlinger( 1850): Screen released, type=0 flinger=0x41023450
D/AKMD2 ( 2205): akm_disable_sensor: Accel is disabled. (orien = 0)
I/AKMD2 ( 2205): enable_accelerometer, mEnabled = 1, enable = 0
D/Cocos2dxActivity(29268): onPause()
D/cocos2d-x debug info(29268): [SDKBOX] - SESSION END
D/TinyALSA-Audio Hardware(12210): audio_hw_set_parameters(0x400b8948, screen_state=off)++
D/TinyALSA-Audio Hardware(12210): audio_hw_set_parameters(0x400b8948, screen_state=off)-- (PARAMETER ERROR)
E/audio_a2dp_hw(12210): adev_set_parameters: ERROR: set param called even when stream out is null
D/TRACKING_STORAGE(29268): Track pending request ok.
I/TRACKING_STORAGE(29268): Saved 1 tracking info _elements.
D/MdnsClient(27782): Multicast lock held. Releasing
D/TRACKING_STORAGE(29268): Track pending request ok.
I/TRACKING_STORAGE(29268): Saved 0 tracking info _elements.
I/TRACKING_STORAGE(29268): Saved 0 tracking info _elements.

Any ideas what is wrong?
For me this:
I/TRACKING_STORAGE(29268): Can't load tracking info: java.io.IOException: BufferedInputStream is closed
looks suspicious, but it reads the json - it’s printed in logs below.
-adam

Let me guesss… plugin version 1.5 :wink:

@pabitrapadhy it looks that latest release is still broken, we have also issue with Analytics, maybe it conflicting with some other plugins, but it really became noticeable after latest release and SDKBOX behaviour is unpredictable :frowning:

In our case as I stated before we got Dublicated DEX issue in Debug build, and analytics not working. Not sure if it was related or not but when deleted libs and obj folders it worked, but when compiled second time it again didn’t worked…

Yep, the version is 1.5.0.3
Sample project is based on 1.4, but I already have IAP 1.5 in my project so I guess I cannot mix the versions (init APIs are different)

BTW sample project doesn’t work for android-studio. It doesn’t compile, but even when I managed to compile it, it still doesn’t report.

Tried hard to have it working and finally can confirm what @energyy said. It worked for a while, and when rebuild (not fully, just apk) it stops. It seems to be not deterministic and very hard to fix without sdkbox sources. I give it up and wait for the next bug free version.

it seems 1.3.x version was most stable, if you have older version - try with it .

1.4 and 1.5 versions have to many bugs and not production ready.

BTW are you trying to use android studio or eclipse for builds?

I was trying both. For android studio I didn’t make it working at all. From commandline (eclipse) I had it working but only for a while. Unfortunately I don’t have 1.3 version of IAP and GAE plugins which I use.
-adam

Based on the log looks like GA is working, did you able to get the events in Google Analytics dashboard.