问题描述
我的应用程序使用ACRA的错误报告,和我有一对夫妇从我的错误设备报告:只能使用低16位的请求,code ..谷歌显示了此错误使用startActivityForResult时发生的,但我搜索我的codeA几次,我的M没有要求任何地方。
My app uses ACRA for error reporting, and I've got a couple of reports from my device with the error: Can only use lower 16 bits for requestCode.. Google shows this error occurring when using startActivityForResult, but I've searched my code a few times and I"m not calling that anywhere.
我是pretty的困惑,想知道这是如何影响用户(有趣的是,崩溃报告测试版不显示在所有的错误)。
I'm pretty confused and am wondering how this is impacting users (interestingly enough, the Crash Reports beta doesn't show any errors at all).
任何人都遇到了这个?
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)
有人可以帮助我在这?
Can somebody help me on this?
推荐答案
请求codeS只能是 0xFFFF的
的最大值(65535)。所以,你可能调用 startActivityForResult(意向,REQUEST_ code);
和 REQUEST_ code
大超过65535。
RequestCodes can only be a max of 0xffff
(65535). So you are probably calling startActivityForResult(intent, REQUEST_CODE);
and REQUEST_CODE
is greater than 65535.
解决方案:
- 请申请$ C C小 $
- 覆盖
startActivityForResult
来处理你的更大的请求,codeS(这将主要归结为截断一个黑客或其他一些操作把你的请求,code范围内),在联答案(上面)中存在的$在startActivityForResult
C $ C,它是你正在运行到由拉哈夫苏德问题。
- make request code smaller
- override
startActivityForResult
to handle your larger request codes (which will mostly come down to a hack that truncates or some other manipulation to push your request code within the bounds) In the linked answer (from above) there is the code instartActivityForResult
that is the issue you're running into by Raghav Sood.
这篇关于ACRA例外只能使用低16位的请求,code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!