2013-01-17 39 views
0

我的應用使用ACRA進行錯誤報告,並且我收到了一些來自我的設備的錯誤報告:只能使用低16位的requestCode .. Google顯示使用時發生此錯誤startActivityForResult,但我已經搜索了我的代碼幾次,並且我不會在任何地方調用。使用ACRA時的例外情況

我很困惑,想知道這是如何影響用戶的(有趣的是,崩潰報告測試版沒有顯示在所有的任何錯誤)。

其他人遇到這樣?

java.lang.RuntimeException: Unable to resume activity {com.myapp/com.myapp.MyActivity}: 
java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode 
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2120) 
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2135) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:957) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:130) 
at android.app.ActivityThread.main(ActivityThread.java:3683) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:507) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode 
at android.support.v4.app.g.startActivityForResult(SourceFile:690) 
at com.android.e.a.a(Unknown Source) 
at com.android.e.e.a(Unknown Source) 
at com.android.o.e.a(Unknown Source) 
at com.android.o.b.a(Unknown Source) 
at com.android.framework.context.d.a(Unknown Source) 
at com.android.framework.context.d.onResume(Unknown Source) 
at com.android.Kiwi.onResume(Unknown Source) 
at com.myapp.MyActivity.onResume(SourceFile) 
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150) 
at android.app.Activity.performResume(Activity.java:3832) 
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2110) 
... 10 more 
java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode 
at android.support.v4.app.g.startActivityForResult(SourceFile:690) 
at com.android.e.a.a(Unknown Source) 
at com.android.e.e.a(Unknown Source) 
at com.android.o.e.a(Unknown Source) 
at com.android.o.b.a(Unknown Source) 
at com.android.framework.context.d.a(Unknown Source) 
at com.android.framework.context.d.onResume(Unknown Source) 
at com.android.Kiwi.onResume(Unknown Source) 
at com.myapp.MyActivity.onResume(SourceFile) 
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150) 
at android.app.Activity.performResume(Activity.java:3832) 
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2110) 
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2135) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:957) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:130) 
at android.app.ActivityThread.main(ActivityThread.java:3683) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:507) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
at dalvik.system.NativeStart.main(Native Method) 

有人可以幫助我嗎?

+0

您使用的是谷歌地圖v2嗎?我相信這是一個與之相關的錯誤。 –

回答

8

從FragmentActivity的源代碼:

/** 
* Modifies the standard behavior to allow results to be delivered to fragments. 
* This imposes a restriction that requestCode be <= 0xffff. 
*/ 
@Override 
public void startActivityForResult(Intent intent, int requestCode) { 
    if (requestCode != -1 && (requestCode&0xffff0000) != 0) { 
     throw new IllegalArgumentException("Can only use lower 16 bits for requestCode"); 
    } 
    super.startActivityForResult(intent, requestCode); 
} 

看來你的請求的代碼只能去高達0xffff,換算成65535我們基地10種癡迷人類。

+0

但我沒有在我的代碼中調用startActivityForResult() – user1980076

+0

您在對話框通知模式下使用ACRA,我接受它。這會導致ACRA調用startActivityForResult(),導致您的異常。 –

+0

謝謝。我會檢查這一點。 – user1980076