Okhttp 为什么在尝试匿名登录IBM AppID时会发生崩溃?
每当我尝试使用Android匿名登录时Okhttp 为什么在尝试匿名登录IBM AppID时会发生崩溃?,okhttp,ibm-appid,Okhttp,Ibm Appid,每当我尝试使用Android匿名登录时 appId = AppID.getInstance(); appId.initialize(this,tenantId, region); appId.signinAnonymously(this, new AuthorizationListener() { @Override public void onAuthorizationFailure(AuthorizationException exception) {
appId = AppID.getInstance();
appId.initialize(this,tenantId, region);
appId.signinAnonymously(this, new AuthorizationListener() {
@Override
public void onAuthorizationFailure(AuthorizationException exception) {
}
@Override
public void onAuthorizationSuccess(AccessToken accessToken, IdentityToken identityToken, RefreshToken refreshToken) {
}
@Override
public void onAuthorizationCanceled() {
}
});
我在启动时遇到此错误:
FATAL EXCEPTION: OkHttp Dispatcher
Process: com.watizit, PID: 9411
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at com.ibm.cloud.appid.android.internal.authorizationmanager.AuthorizationManager$5.onSuccess(AuthorizationManager.java:341)
at com.ibm.mobilefirstplatform.clientsdk.android.core.internal.BaseRequest$2.onResponse(BaseRequest.java:771)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:203)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:929)
当我移除这个同名的块时,它就不再崩溃了。
我怀疑回调+okhttp有问题,但我不知道具体是什么问题。
你知道怎么解决吗?多谢各位
以下是如何定义我的依赖项(默认):
}
我只加了一行:
实现'com.github.ibmcloudsecurity:appid clientsdk android:6.+'
dependencies {
implementation 'com.github.ibm-cloud-security:appid-clientsdk-android:6.+'
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}