SecurityException异常:Parcel.readException从谷歌分析code到来 [英] SecurityException: Parcel.readException coming from google analytics code
问题描述
我们的应用越来越从我们的崩溃报告的软件相当多的不同SecurityException异常报告。下面是崩溃的堆栈跟踪:
Our app is getting quite a few different SecurityException reports from our crash report software. Here is a stacktrace of the crash:
java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@43fda840 (pid=17925) when registering receiver android.content.IIntentReceiver$Stub$Proxy@43fd9458
at android.os.Parcel.readException(Parcel.java:1431)
at android.os.Parcel.readException(Parcel.java:1385)
at android.app.ActivityManagerProxy.registerReceiver(ActivityManagerNative.java:2466)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1717)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1685)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1679)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:453)
at com.google.android.gms.analytics.q.v(Unknown Source)
at com.google.android.gms.analytics.r.cF(Unknown Source)
at com.google.android.gms.analytics.r.cH(Unknown Source)
at com.google.android.gms.analytics.s.cO(Unknown Source)
at com.google.android.gms.analytics.s.cP(Unknown Source)
at com.google.android.gms.analytics.s.d(Unknown Source)
at com.google.android.gms.analytics.s$e.run(Unknown Source)
at java.util.Timer$TimerImpl.run(Timer.java:284)
堆栈跟踪始终是相同的,但似乎改变的仅仅是 android.app.ApplicationThreadProxy@41da9030(PID = 9103)
和 android.content.IIntentReceiver$Stub$Proxy@41ee0688
有不同的数字对他们(这是线程ID的还是什么?)
The stack trace is always the same, except the only thing that seems to change is android.app.ApplicationThreadProxy@41da9030 (pid=9103)
and android.content.IIntentReceiver$Stub$Proxy@41ee0688
have different numbers on them (is this thread id's or something?)
现在这个例外似乎是链接到意图的大小(请参见下面的链接)
Now this exception seems to be linked to intent size (see the following links)
- <一个href="http://stackoverflow.com/questions/18096607/using-crop-intent-getting-java-lang-securityexception-unable-to-find-app-for-ca">stackoverflow帖子
- <一个href="http://stackoverflow.com/questions/12691149/when-i-send-hashmap-with-size-more-than-20-in-android-4-1-i-get-crash">another计算器帖子
- 看到在这个问题上的意见
- 看到b0bs回复这里
- stackoverflow post
- another stackoverflow post
- see the comment on this question
- see b0bs reply here
这是唯一的原因是什么?如果是的话怎么我的code导致了这一点似乎只来自谷歌分析code?我使用GA错了吗?我似乎并没有做太多,除了做一个跟踪器。
Is this the only cause? If so how is my code causing this when it seems to only come from google analytics code? Am I using GA wrong? I don't seem to be doing much besides making a tracker.
修改
这是我如何创建我的跟踪器。我有一个单跟踪我的应用程序对象
This is how I am creating my tracker. I have a singleton tracker in my application object
Tracker appTracker;
synchronized Tracker getTracker()
{
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
if (appTracker == null)
{
appTracker = analytics.newTracker([some key]);
appTracker.enableAdvertisingIdCollection(true);
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
}
return appTracker;
}
然后在我的BaseActivity我有以下code:
Then in my BaseActivity I have the following code:
public void initAnalytics() {
if (Global.TRACKING_ENABLED) {
mTracker = app.getTracker();
}
}
public void sendCommerceData(Map<String, String> params)
{
mTracker.send(params);
}
public void sendTrackViewData(String _path)
{
mTracker.setScreenName(_path);
mTracker.send(new HitBuilders.AppViewBuilder().build());
}
public void sendEventData(String category, String action, String label, long value)
{
mTracker.send(new HitBuilders.EventBuilder()
.setCategory(category)
.setAction(action)
.setLabel(label)
.setValue(value).build());
}
编辑2 的
EDIT 2
确定这里是利用sendCommerceData的:
ok here is the use of sendCommerceData:
sendCommerceData(new HitBuilders.ItemBuilder()
.setTransactionId(Integer.toString(order.orderId))
.setName(orderItem.tradeTitle)
.setSku(orderItem.tradeId)
.setCategory(orderItem.categoryFullname)
.setPrice(price)
.setQuantity(orderItem.quantity)
.build());
u_u
推荐答案
我的猜测是,你正在运行的ProGuard您的应用程序,但还没有添加如下例外您的ProGuard-rules.txt:
My guess is that you are running ProGuard on your application but haven't added the following exceptions to your proguard-rules.txt:
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
这篇关于SecurityException异常:Parcel.readException从谷歌分析code到来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!