bigzoo
bigzoo

Reputation: 333

Compile-time verification fail (Account Kit Android)

I have and android app that was working perfectly a while back. I am using account kit provided by Facebook for user authentication and I've hit a wall. After making a few changes and testing the app again, the logins don't work. When the login with phone or sms is initiated, the app crashes with a compile-time verification failed. Honestly, I'm more of Web than Android so forgive my ignorance if this is something small.

                                                                      --------- beginning of crash
08-10 12:59:47.328 20322-20322/com.chris.tatusafety E/AndroidRuntime: FATAL EXCEPTION: main
                                                                      Process: com.chris.tatusafety, PID: 20322
                                                                      java.lang.VerifyError: Rejecting class com.google.android.gms.internal.zzasm because it failed compile-time verification (declaration of 'com.google.android.gms.internal.zzasm' appears in /data/app/com.chris.tatusafety-1/base.apk)
                                                                          at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source)
                                                                          at com.facebook.accountkit.ui.AccountKitActivity.onCreate(AccountKitActivity.java:348)
                                                                          at android.app.Activity.performCreate(Activity.java:6251)
                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2370)
                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477)
                                                                          at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1345)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                          at android.os.Looper.loop(Looper.java:148)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5452)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:762)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
08-10 12:59:47.329 20322-20365/com.chris.tatusafety V/FA: Inactivity, disconnecting from the service

Here's the activity.

package com.chris...;

//    Here I import all my libraries... 


public class LoginActivity extends AppCompatActivity {
    public static int APP_REQUEST_CODE = 1;
    @Bind(R.id.phone_login_button) Button mPhone;
    @Bind(R.id.title) TextView mTitle;
    @Bind(R.id.email_login_button) Button mLogin;
    @Bind(R.id.anonymous_login_button) Button mAnony;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_login);
        //check for an access token
        AccessToken accessToken = AccountKit.getCurrentAccessToken();


        if (accessToken != null)
        {
            //if user was logged in it will not be null hence log in into application
            loginSuccess();
        }
    }

    @Override
    protected void onActivityResult (final int requestCode, final int resultCode, final Intent data){
        super.onActivityResult(requestCode, resultCode ,data);

        //confirm that this response matches your request
        if (requestCode == APP_REQUEST_CODE){
            AccountKitLoginResult loginResult = data.getParcelableExtra(AccountKitLoginResult.RESULT_KEY);
            if (loginResult.getError() != null ){
                //display a login error
                String toastMessage = loginResult.getError().getErrorType().getMessage();
                Toast.makeText(this, toastMessage, Toast.LENGTH_SHORT).show();
            }else if (loginResult.getAccessToken() != null){
                //on succesfull login, proceed
                loginSuccess();
            }
        }
    }



    private void onLogin(final LoginType loginType){
        //acount kit activity
        final Intent accountKit = new Intent(this,AccountKitActivity.class);

        //configure login type and response type
        AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder=
                new AccountKitConfiguration.AccountKitConfigurationBuilder(
                        loginType,AccountKitActivity.ResponseType.TOKEN
                );
        final AccountKitConfiguration configuration = configurationBuilder.build();

        //launch account kit activity
        accountKit.putExtra(AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,configuration);
        startActivityForResult(accountKit,APP_REQUEST_CODE);

    }

    public void onPhoneLogin(View view){
        onLogin(LoginType.PHONE);
    }

    public void onEmailLogin(View view){
        onLogin(LoginType.EMAIL);
    }



    private void loginSuccess() {

        Intent mainActivity = new Intent(this,MainActivity.class);
        startActivity(mainActivity);
        finish();
    }

    public void onAnonymousLogin(View view) {
        AccessToken accessToken = null;
        loginSuccess();
    }
}

Upvotes: 1

Views: 570

Answers (2)

Agus Mahasadhu
Agus Mahasadhu

Reputation: 1

I fixed it by adding exclude group to facebook sdk and account kit.

compile ('com.facebook.android:facebook-android-sdk:4.+'){
    exclude group: 'com.google.android.gms'
}
compile ('com.facebook.android:account-kit-sdk:4.+'){
    exclude group: 'com.google.android.gms'
}

in my project, the error actually is caused by version difference. So you also have to force add some dependencies with version that you wish to use in your project. For example

compile("com.google.android.gms:play-services-gcm:*whateverVersionThatYouWish*") {
    force = true
}
compile("com.google.android.gms:play-services-location:*whateverVersionThatYouWish*") {
    force = true
}

Upvotes: 0

Pouya Larjani
Pouya Larjani

Reputation: 408

This seems to be an issue with your local version of com.google.android.gms using a synchronized block inside of a try-catch

Update your version of google play services (and everything else around it) and make sure the right versions are referenced in your gradle script

If it still doesn't work, try disabling instant run, but that's kind of a long shot.

If none of those work, downgrade both your google services and fb/accountkit libraries to an older version from when you knew it worked fine and see if it unbreaks, then upgrade one by one to diagnose which new version is causing this validation failure

Upvotes: 1

Related Questions