gpt4 book ai didi

android - 编译时验证失败(Account Kit Android)

转载 作者:行者123 更新时间:2023-11-30 00:24:41 26 4
gpt4 key购买 nike

我有一个 Android 应用程序,前段时间运行良好。我正在使用 Facebook 提供的帐户工具包进行用户身份验证,但遇到了困难。进行一些更改并再次测试应用程序后,登录不起作用。当启动电话或短信登录时,应用程序崩溃并编译时验证失败。老实说,我更喜欢 Web 而不是 Android,所以如果这是小事请原谅我的无知。

                                                                      --------- 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

这是 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();
}
}

最佳答案

这似乎是您本地版本的 com.google.android.gms 在 try-catch 中使用同步块(synchronized block)的问题

更新您的 google play 服务版本(以及它周围的所有其他内容)并确保在您的 gradle 脚本中引用正确的版本

如果它仍然不起作用,请尝试禁用即时运行,但这有点远。

如果这些都不起作用,请将您的 google 服务和 fb/accountkit 库降级到您知道它工作正常时的旧版本,看看它是否未损坏,然后一个一个地升级以诊断哪个新版本导致此验证失败

关于android - 编译时验证失败(Account Kit Android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45610647/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com