I just released an app on the play store and have gotten a crash report from a galaxy note 4 with this stack trace:
java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
at android.support.v4.app.q.a(Unknown Source)
at android.support.v4.app.q.startIntentSenderForResult(Unknown Source)
at android.support.v4.app.x.startIntentSenderForResult(Unknown Source)
at com.google.android.gms.common.ConnectionResult.a(Unknown Source)
at com.google.android.gms.common.api.internal.ba.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
I have tested my app on multiple devices and have never gotten an error like this! I do have proguard on which i believe may be the culprit? What do you guys think? The app crashed on the first activity and i only have one requestCode whose value is 111. I don't understand why i could be getting this exception. Google sign in is implemented in the first activity and here is where the requestCode is being used:
private static final int SIGN_IN_REQUEST_CODE = 111 ; (instance variable)
private void signIn() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, SIGN_IN_REQUEST_CODE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SIGN_IN_REQUEST_CODE) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
}
}
Thanks, Sameer