当我尝试通过意图打开帐户套件时,我从用户那里收到了这个logcat。
java.lang.NullPointerException 1 at com.facebook.accountkit.internal.AppEventsLogger.handleResponse(AppEventsLogger.java:526) 2点 com.facebook.accountkit.internal.AppEventsLogger.access $ 600(AppEventsLogger.java:57) 3点 com.facebook.accountkit.internal.AppEventsLogger $ 4.onCompleted(AppEventsLogger.java:510) 4点 com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(AccountKitGraphRequestAsyncTask.java:188) 5点 com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(AccountKitGraphRequestAsyncTask.java:42) 6在android.os.AsyncTask.finish(AsyncTask.java:631)7 at android.os.AsyncTask.access $ 600(AsyncTask.java:177)8 at android.os.AsyncTask $ InternalHandler.handleMessage(AsyncTask.java:644) 9在android.os.Handler.dispatchMessage(Handler.java:99)10 at android.os.Looper.loop(Looper.java:137)11 at android.app.ActivityThread.main(ActivityThread.java:5041)12 at java.lang.reflect.Method.invokeNative(Native Method)13 at java.lang.reflect.Method.invoke(Method.java:511)14 at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:793) 15在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 16 at dalvik.system.NativeStart.main(Native Metho
d)
React Native Account Kit版本:4 +
平台(iOS,Android或两者兼而有之?):Android
请您提供一些反馈意见!
非常感谢!
答案 0 :(得分:0)
答案 1 :(得分:0)
编辑:现在facebook团队已在account-kit-sdk 4.18.0修复此错误
我在account-kit-sdk 4.17.0
中多次发现此错误 afater阅读关于AccountKitGraphResponse
和AppEventsLogger
protected void onPostExecute(AccountKitGraphResponse result) {
super.onPostExecute(result);
if(result != null && result.getError() != null && result.getError().getException().getError().getErrorType() == Type.NETWORK_CONNECTION_ERROR && result.getError().getException().getError().getDetailErrorCode() != 101 && this.numRetries < 4) {
Handler mainHandler = new Handler(AccountKitController.getApplicationContext().getMainLooper());
mainHandler.post(new Runnable() {
public void run() {
int newNumRetries = AccountKitGraphRequestAsyncTask.this.numRetries + 1;
final AccountKitGraphRequestAsyncTask asyncTask = new AccountKitGraphRequestAsyncTask((HttpURLConnection)null, AccountKitGraphRequestAsyncTask.this.request, AccountKitGraphRequestAsyncTask.this.callback, newNumRetries, null);
Utility.getBackgroundExecutor().schedule(new Runnable() {
public void run() {
if(!AccountKitGraphRequestAsyncTask.this.isCancelled() && !asyncTask.isCancelled()) {
asyncTask.executeOnExecutor(Utility.getThreadPoolExecutor(), new Void[0]);
}
}
}, (long)(5 * newNumRetries), TimeUnit.SECONDS);
if(AccountKitGraphRequestAsyncTask.this.request.isLoginRequest()) {
AccountKitGraphRequestAsyncTask.currentAsyncTask = asyncTask;
}
}
});
} else {
if(this.callback != null) {
this.callback.onCompleted(result);
}
if(this.exception != null) {
Log.d(TAG, String.format("onPostExecute: exception encountered during request: %s", new Object[]{this.exception.getMessage()}));
}
}
}
private void handleResponse(AppEventsLogger.SessionEventsStateKey stateKey, AccountKitGraphRequest request, AccountKitGraphResponse response, AppEventsLogger.SessionEventsState sessionEventsState, AppEventsLogger.FlushStatistics flushState) {
AccountKitRequestError error = response.getError();
String resultDescription = "Success";
...
}
调用的this.callback.onCompleted(result);
方法将运行AppEventsLogger.this.handleResponse(stateKey, postRequest, response, sessionEventsState, flushState);
,在某些情况下,response
为null
个对象
这将导致NullPointerException
我建议这个改变
if(this.callback != null && result != null) {
this.callback.onCompleted(result);
}