So, as the title said, I always failed at sign in with error code "12500" every time I'm using release apk, but always successfully signed in when on debug apk. Already updated Google Play Services to the latest version, also re-downloaded the google-services.json. Still failed sign in by error code "12500" on release apk.
My Activity:
public class ActivityLogin extends AppCompatActivity {
@BindView(R.id.iv_google)ImageView ivGPlus;
private GoogleSignInClient mGoogleSignInClient;
private final int RC_SIGN_IN = 123;
private Context context;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
ButterKnife.bind(this);
prepareGoogle();
initUI();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
GoogleSignInAccount account = task.getResult(ApiException.class);
} catch (ApiException e) {
e.printStackTrace();
}
}
}
private void initUI(){
ivGPlus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
signInGoogle();
}
});
}
//login google
private void prepareGoogle(){
mAuth = FirebaseAuth.getInstance();
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getResources().getString(R.string.default_web_client_id))
.requestServerAuthCode(getResources().getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
}
private void signInGoogle() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
}
I also already disabled the proguard:
android {
compileSdkVersion 27
buildToolsVersion '28.0.2'
defaultConfig {
applicationId "com.example.app"
minSdkVersion 19
targetSdkVersion 27
versionCode 17
versionName "1.1.9.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode = true
}
}