我使用的版本是11.4.2 这是日志:
java.lang.RuntimeException:无法启动接收器 com.google.android.gms.measurement.AppMeasurementReceiver: java.lang.IllegalStateException:不允许启动服务意图{ act = com.google.android.gms.measurement.UPLOAD cmp = / com.google.android.gms.measurement.AppMeasurementService(具有 }:应用程序位于后台uid UidRecord {81230bc u0a190 TRNB bg:+ 2m52s798ms空闲更改:未激活的进程:1 seq(51,51,51)}
我检查了firebase-analytics源代码,发现直接在context.startService()
的AppMeasurementReceiver中有一个段落代码,如下所示:
public static ComponentName startWakefulService(Context context, Intent intent) {
synchronized (sActiveWakeLocks) {
int id = mNextId;
mNextId++;
if (mNextId <= 0) {
mNextId = 1;
}
intent.putExtra(EXTRA_WAKE_LOCK_ID, id);
ComponentName comp = context.startService(intent);
if (comp == null) {
return null;
}
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
"wake:" + comp.flattenToShortString());
wl.setReferenceCounted(false);
wl.acquire(60 * 1000);
sActiveWakeLocks.put(id, wl);
return comp;
}
}
但是我去检查了最新版本的firebase,发现此代码尚未修改,这是怎么引起的?如何处理?