升级反应原生从0.12到0.15得到空指针错误

时间:2015-12-04 03:09:50

标签: react-native

我尝试将android上的native native从0.12升级到0.15,但是当我启动应用程序时出现了nullpointerException。

是否有任何分手变化?我需要更改我的代码吗?

java.lang.NullPointerException: java.lang.NullPointerException
        at android.widget.TextView.checkForRelayout(TextView.java:7074)
        at android.widget.TextView.setText(TextView.java:3976)
        at android.widget.TextView.setText(TextView.java:3813)
        at android.widget.TextView.setText(TextView.java:3788)
        at com.facebook.react.views.text.ReactTextViewManager.updateExtraData(ReactTextViewManager.java:85)
        at com.facebook.react.views.text.ReactTextViewManager.updateExtraData(ReactTextViewManager.java:37)
        at com.facebook.react.uimanager.NativeViewHierarchyManager.updateViewExtraData(NativeViewHierarchyManager.java:110)
        at com.facebook.react.uimanager.UIViewOperationQueue$UpdateViewExtraData.execute(UIViewOperationQueue.java:183)
        at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:574)
        at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:622)
        at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
        at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:120)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:786)
        at android.view.Choreographer.doCallbacks(Choreographer.java:591)
        at android.view.Choreographer.doFrame(Choreographer.java:559)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774)
        at android.os.Handler.handleCallback(Handler.java:808)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:5348)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)

解决这个问题的任何想法?

1 个答案:

答案 0 :(得分:0)

在您的项目中,打开android/gradle/wrapper/gradle-wrapper.properties文件,更改最后一行distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

当我将gradle版本更改为gradle-2.2.1-all.zip时,一切正常。

如果gradle-2.4-all.zip不起作用,您可以尝试替换其他版本click here以获取更多信息。