jpop jpop - 24 days ago 24
Android Question

Too many alarms/receivers errors

I've noticed a bunch of errors showing up in error monitoring tools, connected with FirebaseInstanceIdService:


java.lang.IllegalArgumentException: regist too many Broadcast Receivers
1 at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1838)
2 at android.app.ContextImpl.registerReceiver(ContextImpl.java:1794)
3 at android.app.ContextImpl.registerReceiver(ContextImpl.java:1788)
4 at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:489)
5 at com.google.firebase.iid.FirebaseInstanceIdService.boolean zzag(android.content.Intent)(Unknown Source)
6


happening on HUAWEI RIO-L01 device running Android 5.1, and:


ava.lang.SecurityException: !@Too many alarms (500) registered from pid 25905 uid 10022
1 at android.os.Parcel.readException(Parcel.java:1546)
2 at android.os.Parcel.readException(Parcel.java:1499)
3 at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:206)
4 at android.app.AlarmManager.setImpl(AlarmManager.java:428)
5 at android.app.AlarmManager.set(AlarmManager.java:215)
6 at com.google.firebase.iid.FirebaseInstanceIdService.void zzah(android.content.Intent)(Unknown Source)


happening on samsung SM-G800F running Android 5.1.1. Anyone know what's going on?

I suspect this is probably caused by phone vendor code and not by Firebase, but it still messes with my crash rate stats, so I'd like to work around it if possible.

Errors started with recent app release, but the FCM code it's related to is older than that, which is why I hope it's avoidable. I'm not sure what the change was that precipitated it, there was nothing directly FCM related that I can isolate.

I'm using Firebase 9.6.1, build tools 24.0.2, targetSdk 19, minSdk 14.

Here's the app gradle file (redacted to remove testing, variants, irrelevant build types):

apply plugin: 'com.android.application'
apply plugin: 'com.getkeepsafe.dexcount'

android {
compileSdkVersion 24
buildToolsVersion '24.0.2'

dataBinding {
enabled = true
}

defaultConfig {
applicationId 'hr.doesnt.matter'
minSdkVersion 14
targetSdkVersion 19
versionName '1.3.5.4'
versionCode 13540

multiDexEnabled true

}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-android.pro'
signingConfig signingConfigs.release
}
dexOptions {
preDexLibraries true
javaMaxHeapSize "6g" // Use gig increments depending on needs
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
// - SUPPORT LIBS
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:percent:24.2.1'
// - GOOGLE SERVICES
compile 'com.google.android.gms:play-services-base:9.6.1'
compile 'com.google.android.gms:play-services-analytics:9.6.1'
compile 'com.google.firebase:firebase-messaging:9.6.1'
compile 'com.google.firebase:firebase-config:9.6.1'
// - FONTS
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
// - TOOLS
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.2'
compile 'com.fasterxml.jackson.core:jackson-core:2.5.2'
compile 'com.koushikdutta.async:androidasync:2.1.7'
compile 'com.splunk.mint:mint:5.0.0'
compile 'nf.fr.eraasoft:objectpool:1.1.2'
compile 'com.google.android.exoplayer:exoplayer:r1.5.2'
// - RX
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.trello:rxlifecycle:0.5.0'
compile 'com.trello:rxlifecycle-components:0.5.0'

}

configurations.all {
resolutionStrategy {
force "com.android.support:support-annotations:24.2.1"
force "com.android.support:support-v4:24.2.1"
}
}

apply plugin: 'com.google.gms.google-services'


And here's the project gradle file:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}

allprojects {
repositories {
jcenter()
maven { url "https://mint.splunk.com/gradle/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}

Answer

Seems that subsequent library releases (Firebase 9.8.0 at least) have remedied that situation as I don't see it happening anymore. True cause remains a mystery. :)

Comments