Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Investigating if certain plugins cause excessive ANRs
Started by perflubron Oct 24 2017 11:44 PM

36 replies to this topic
firebase firebase-analytics google google play anr kidoz admob
[TOPIC CONTROLS]
Page 1 of 2 1 2
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

I'm using Firebase analytics. I'm investigating ANRs reported on Google Play, and it appears that the most frequent ones are associated with various receivers added by the Firebase analytics plugin to the Manifest.

 

Edit: I have various plugin configurations across my portfolio, and I'm trying to pin down why some apps have over 1% ANR rate while others have almost 0% ANR rate. First I thought it was related to Firebase, but that appears untrue. The posts below contain discussion.

Before proceeding, why is this important? As annouced at Google Playtime 2017, Google will start penalizing apps (using reduced ranking) which exhibit "Bad behaviour" as reported in the Android Vitals section of the dev console. For ANRs, the limit is 0.47% ANR rate, and I'm currently at 1.28%.

One of my most frequent ANRs is in executing service se.appfamily.superpuzzlefree/shared.google.play.services.base.PackageStateChangedService

It appears to happen when exiting the app:


"main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 obj=0x76918598 self=0xf4fe4500 | sysTid=21370 nice=-4 cgrp=default sched=0/0 handle=0xf77cad54 | state=S schedstat=( 0 0 0 ) utm=39 stm=41 core=5 HZ=100 | stack=0xff1a1000-0xff1a3000 stackSize=8MB | held mutexes=

native: pc 00000000000176a4 /system/lib/libc.so (syscall+28)
native: pc 00000000000401d5 /system/lib/libc.so (pthread_join+124)
native: pc 0000000000015b58 /data/app/se.appfamily.superpuzzlefree-1/lib/arm/libopenal.so (alcDestroyContext+516)
native: pc 0000000000008ed7 /data/app/se.appfamily.superpuzzlefree-1/lib/arm/libalmixer.so (ALmixer_Quit+230)
native: pc 000000000011d014 /data/app/se.appfamily.superpuzzlefree-1/lib/arm/libcorona.so (???)
native: pc 000000000011f448 /data/app/se.appfamily.superpuzzlefree-1/lib/arm/libcorona.so (???)
native: pc 000000000012f53c /data/app/se.appfamily.superpuzzlefree-1/lib/arm/libcorona.so (???)
native: pc 000000000002b6c4 /data/app/se.appfamily.superpuzzlefree-1/lib/arm/libcorona.so (???)
native: pc 000000000002e9c0 /data/app/se.appfamily.superpuzzlefree-1/lib/arm/libcorona.so (Java_com_ansca_corona_JavaToNativeShim_nativeDone+28)
native: pc 0000000000425af5 /data/app/se.appfamily.superpuzzlefree-1/oat/arm/base.odex (Java_com_ansca_corona_JavaToNativeShim_nativeDone__J+80)
at com.ansca.corona.JavaToNativeShim.nativeDone (Native method)
at com.ansca.corona.JavaToNativeShim.destroy (JavaToNativeShim.java:277)
at com.ansca.corona.Controller.destroy (Controller.java:286)
- locked <0x0a532824> (a com.ansca.corona.Controller)

at com.ansca.corona.CoronaRuntime.dispose (CoronaRuntime.java:88)
at com.ansca.corona.CoronaActivity.onDestroy (CoronaActivity.java:1679)
at android.app.Activity.performDestroy (Activity.java:7130)
at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1171)
at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5126)
at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5171)
at android.app.ActivityThread.access$1700 (ActivityThread.java:230)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1881)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:148)
at android.app.ActivityThread.main (ActivityThread.java:7409)
at java.lang.reflect.Method.invoke! (Native method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)



Doesn't seem limited to any particular Android version:

Android 6.0 13,171 57.0% Android 7.0 6,992 30.3% Android 5.1 1,668 7.2% Android 7.1 733 3.2% Android 5.0 529 2.3% Android 8.0 18 0.1%


Afraid I don't have a reproducible case.


Edited by perflubron, 26 October 2017 - 12:47 AM.


[TOPIC: post.html]
#2

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

I don’t manage the shared google play libraries corona does https://bitbucket.org/coronalabs/shared-hosted-google-play-services-base

[TOPIC: post.html]
#3

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

To clarify my plugin uses a shared corona library. That error is from the corona shared library there is nothing I can do, you may want to file a bug report with them.

[TOPIC: post.html]
#4

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

Thanks, I didn't intend to cast any blame on the plugin itself, just highlight the consequences it has (for me, at least). There are multiple other ANRs pointing towards stuff related to Firebase, so I prefer to play safe and simply cease using it.



[TOPIC: post.html]
#5

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

Turns out the offending line in the Manifest is also included if you use Admob (without Firebase). Original post edited, but not sure how to edit the title



[TOPIC: post.html]
#6

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

You can edit title with full editor

Screen_Shot_2017_10_25_at_1_37_49_PM.png


  • perflubron likes this

[TOPIC: post.html]
#7

Yoger Games

[GLOBAL: userInfoPane.html]
Yoger Games
  • Contributor

  • 108 posts
  • Corona SDK

We are not using Firebase or Admob but we still get a lot of the same ANRs for basically all our apps. 

executing service com.kavrakids.Cats_Dogs_Photo_Jigsaw_Puzzle/shared.google.play.services.base.PackageStateChangedService

"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 obj=0x73bc8e98 self=0xf3a05400
  | sysTid=26481 nice=-4 cgrp=default sched=0/0 handle=0xf66b9534
  | state=S schedstat=( 711107157 668022854 1857 ) utm=59 stm=12 core=2 HZ=100
  | stack=0xff5b1000-0xff5b3000 stackSize=8MB
  | held mutexes=
  native: pc 0000000000017708  /system/lib/libc.so (syscall+28)
  native: pc 00000000000473bf  /system/lib/libc.so (pthread_join+146)
  native: pc 0000000000015b58  /data/app/com.kavrakids.Cats_Dogs_Photo_Jigsaw_Puzzle-1/lib/arm/libopenal.so (alcDestroyContext+516)
  native: pc 0000000000008ed7  /data/app/com.kavrakids.Cats_Dogs_Photo_Jigsaw_Puzzle-1/lib/arm/libalmixer.so (ALmixer_Quit+230)
  native: pc 000000000011d48c  /data/app/com.kavrakids.Cats_Dogs_Photo_Jigsaw_Puzzle-1/lib/arm/libcorona.so (???)
  native: pc 000000000011f8c0  /data/app/com.kavrakids.Cats_Dogs_Photo_Jigsaw_Puzzle-1/lib/arm/libcorona.so (???)
  native: pc 000000000012f9b4  /data/app/com.kavrakids.Cats_Dogs_Photo_Jigsaw_Puzzle-1/lib/arm/libcorona.so (???)
  native: pc 000000000002b6fc  /data/app/com.kavrakids.Cats_Dogs_Photo_Jigsaw_Puzzle-1/lib/arm/libcorona.so (???)
  native: pc 000000000002e9f8  /data/app/com.kavrakids.Cats_Dogs_Photo_Jigsaw_Puzzle-1/lib/arm/libcorona.so (Java_com_ansca_corona_JavaToNativeShim_nativeDone+28)
  native: pc 0000000000052415  /data/app/com.kavrakids.Cats_Dogs_Photo_Jigsaw_Puzzle-1/oat/arm/base.odex (Java_com_ansca_corona_JavaToNativeShim_nativeDone__J+80)
  at com.ansca.corona.JavaToNativeShim.nativeDone (Native method)
  at com.ansca.corona.JavaToNativeShim.destroy (JavaToNativeShim.java:277)
  at com.ansca.corona.Controller.destroy (Controller.java:286)
- locked <0x08356239> (a com.ansca.corona.Controller)
  at com.ansca.corona.CoronaRuntime.dispose (CoronaRuntime.java:88)
  at com.ansca.corona.CoronaActivity.onDestroy (CoronaActivity.java:1732)
  at android.app.Activity.performDestroy (Activity.java:6907)
  at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1154)
  at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4267)
  at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:4298)
  at android.app.ActivityThread.-wrap6 (ActivityThread.java)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1576)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:241)
  at android.app.ActivityThread.main (ActivityThread.java:6223)
  at java.lang.reflect.Method.invoke! (Native method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:865)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:755)

It would be great if Corona could fix this as soon as possible. 



[TOPIC: post.html]
#8

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

Joakim, what does your manifest look like? Possibly some other plugin (IAP?) also injects that service requirement? Maybe we'll need to clean this up before filing bug report

[TOPIC: post.html]
#9

Yoger Games

[GLOBAL: userInfoPane.html]
Yoger Games
  • Contributor

  • 108 posts
  • Corona SDK

How do I check the manifest file?



[TOPIC: post.html]
#10

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,785 posts
  • Enterprise

FYI most native plugins use google play services in their app. Google play games service, any firebase plugin, google analytics, google iap, one signal, etc.



[TOPIC: post.html]
#11

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

Extracting manifest from APK: https://github.com/ytsutano/axmldec



[TOPIC: post.html]
#12

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

Using this thread to document findings/thoughts as I go

 

One app, Balloon Pop, uses Firebase and IAP. It has very few ANRs

 

Another app, Animal Memory, uses Firebase and IAP and Kidoz. It has around 1% ANRs

 

The biggest one, Super Puzzle, uses Firebase and IAP and Admob and Kidoz. Lots of ANRs.

 

For Super Puzzle, removing Firebase made no difference as far as I can tell. Which is in line with expectations, since Balloon Pop uses Firebase and is fine.

 

Now I'll publish Super Puzzle without Admob (it isn't used by default, but included in the build settings in case I want to enable it remotely). I'm keeping Kidoz in, but based on the Animal Memory app above (which has Kidoz but not Admob), the hypothesis is unfortunately that I'll still see lots of ANRs. 

 

(Trial and error, but there are plenty of daily installs so I get results quickly)



[TOPIC: post.html]
#13

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

The APK without Admob seems to have made no difference. Now publishing without Kidoz



[TOPIC: post.html]
#14

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

It appears that there are fewer of that kind of ANRs when not using Kidoz, but they are not completely gone, Discussing with Kidoz



[TOPIC: post.html]
#15

luaykanaan

[GLOBAL: userInfoPane.html]
luaykanaan
  • Enthusiast

  • 50 posts
  • Corona SDK

@perflubron: My ANRs skyrocketed after i started using Kidoz. Thanks to your thought/process of elimination i disabled (stopped using) Kidoz. I know you are discussing the issue with Kidoz. Any updated on this from them? The Kidoz plugin hasn't been updated recently, so i'm guessing the sdk hasn't changed either. 

 

Thanks

Luay



[TOPIC: post.html]
#16

Yoger Games

[GLOBAL: userInfoPane.html]
Yoger Games
  • Contributor

  • 108 posts
  • Corona SDK

Is it the "executing service se.appfamily.superpuzzlefree/shared.google.play.services.base.PackageStateChangedService" that you are chasing? Solving that one would in my case get me on the right side of the threshold.



[TOPIC: post.html]
#17

luaykanaan

[GLOBAL: userInfoPane.html]
luaykanaan
  • Enthusiast

  • 50 posts
  • Corona SDK

Yes. same ANR. And i 'fixed' it by disabling Kidoz. My app is ad free for the time being until this issue is resolved and Kidoz update their SDK. 

 

By the way, am I correct in assuming that even if we fix ANRs and crashes, the threshold is calculated over a three months period? So, the app will remain 'penalized' for at least three months?



[TOPIC: post.html]
#18

ran5

[GLOBAL: userInfoPane.html]
ran5
  • Observer

  • 15 posts
  • Corona SDK

Hi All, 

 

Thank you for this discussion, we would like to inform you that we are working with the Corona team who is responsible for the KIDOZ plugin to monitor and solve the issue asap, some fixes have been made and we hope to have new release of the KIDOZ plugin available in the coming days.

 

We will make sure to notify our partners directly as well as here in the forum once the new build is available.

 

In case of any questions, please reach out and contact us at sdk@kidoz.net.



[TOPIC: post.html]
#19

luaykanaan

[GLOBAL: userInfoPane.html]
luaykanaan
  • Enthusiast

  • 50 posts
  • Corona SDK

@ran5: That is excellent news.



[TOPIC: post.html]
#20

bjoern

[GLOBAL: userInfoPane.html]
bjoern
  • Enthusiast

  • 76 posts
  • Corona SDK

Are there any news on this issue?

I am also seeing about 1.72% ANR-Rate, mostly because of:

executing service com.mypackagename/shared.google.play.services.base.PackageStateChangedService

I am using AdMob and Firebase, no Kidoz.

 

Best regards,

Bjoern



[TOPIC: post.html]
#21

luaykanaan

[GLOBAL: userInfoPane.html]
luaykanaan
  • Enthusiast

  • 50 posts
  • Corona SDK

@ran5: any updates? Still waiting for the updates...



[TOPIC: post.html]
#22

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

According to Kidoz, their update was ready November 7th. Waiting for Corona to publish, expected early next week. 

 

I've voiced my frustration at the delay to Kidoz. 



[TOPIC: post.html]
#23

ran5

[GLOBAL: userInfoPane.html]
ran5
  • Observer

  • 15 posts
  • Corona SDK

Hi all,

 

Thanks for waiting.

 

Just a quick update, the new sdk version was published: https://forums.coronalabs.com/topic/67433-kidoz-plugin-update/#entry371445

 

As always, in case of any questions please reach out and contact us at sdk@kidoz.net.



[TOPIC: post.html]
#24

chris_raz

[GLOBAL: userInfoPane.html]
chris_raz
  • Contributor

  • 231 posts
  • Corona SDK

Hi @ran5 i updated our app on 3 December and still getting a very High number of ANR's (1.7%) on the latest uploaded apk.

executing service com.mypackagename/shared.google.play.services.base.PackageStateChangedService

is still the culprit for the majority of the ANRs

 

https://forums.coronalabs.com/topic/67433-kidoz-plugin-update/#entry371445 says it was updated 29th november so i should have the latest update of kidoz and used the latest dailybuild.

 

On another note, it mentions in the above link that banners now dont have to be reloaded, but once i hide the banner, it wont show anymore unless i reload it. also getting quite alot of banner loaded=failed today aswell



[TOPIC: post.html]
#25

perflubron

[GLOBAL: userInfoPane.html]
perflubron
  • Contributor

  • 134 posts
  • Corona SDK

@chris_raz This issue has been plaguing me for a month or more. I have been through 8 different rollouts of my app, with various configurations enabling/disabling Admob, Kidoz and Firebase. I've been extracting and comparing the manifests using https://github.com/ytsutano/axmldec, and checking ANRs and crashes in Google Play.

 

At this point, I have reached the fuzzy conclusion that something doesn't play nice when the three plugins mentioned above are used together - at least in my setup (YMMV).

 

Firebase on its own has worked well in my Balloon Pop app, no issues.

 

Kidoz on its own works well now.

 

Kidoz and Admob seems work ok now, although more ANRs than just Kidoz.

 

Adding Firebase seems to trips things up.

 

So I'm removing Firebase, and removing Admob unless I use it in a particular app. Some apps will have just Kidoz, some will have Kidoz and Admob.




[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]

Also tagged with one or more of these keywords: firebase, firebase-analytics, google, google play, anr, kidoz, admob