2

当我尝试通过意图打开帐户工具包时,我从用户那里收到了这个 logcat。

java.lang.NullPointerException 1 在 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 在 android.os.AsyncTask.access$600(AsyncTask.java:177) 8 在 android.os.AsyncTask$InternalHandler。 handleMessage(AsyncTask.java:644) 9 在 android.os.Handler.dispatchMessage(Handler.java:99) 10 在 android.os。Looper.loop(Looper.java:137) 11 在 android.app.ActivityThread.main(ActivityThread.java:5041) 12 在 java.lang.reflect.Method.invokeNative(Native Method) 13 在 java.lang.reflect.Method .invoke(Method.java:511) 14 在 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 15 在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560 ) 16 在 dalvik.system.NativeStart.main(Native Metho主要(本机方法主要(本机方法

d)

React Native Account Kit 版本:4+

平台(iOS、Android 或两者兼有?):Android

需要你的一些反馈,拜托!

非常感谢!

4

2 回答 2

0

这看起来类似于这个错误

https://developers.facebook.com/bugs/296907867375696/

它表示将在下一个版本中推出修复程序。

于 2016-11-17T00:29:32.340 回答
0

编辑:现在 facebook 团队已经在 account-kit-sdk 4.18.0 中修复了这个错误

我在 account-kit-sdk 4.17.0 中多次发现这个 bug

之后阅读了关于AccountKitGraphResponseAppEventsLogger

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);,在某些情况下,responsenull会导致 NullPointerException 的对象

我建议这个改变

if(this.callback != null && result != null) {
   this.callback.onCompleted(result);
}
于 2016-11-28T04:09:38.710 回答