引起:java.lang.NullPointerException:lock == null

时间:2014-07-26 19:10:13

标签: java android eclipse android-studio

我通过Android Studio返回错误...我将此项目导入eclipse项目到android studio .. Log Cat:

7-26 13:51:07.008    1761-1761/...tutorial E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: ....tutorial, PID: 1761
java.lang.RuntimeException: Unable to start activity ComponentInfo{...tutorial/...tutorial.SimpleListActivity}: java.lang.NullPointerException: lock == null
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
        at android.app.ActivityThread.access$800(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        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:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.NullPointerException: lock == null
        at java.io.Reader.<init>(Reader.java:64)

任何想法?谢谢......

3 个答案:

答案 0 :(得分:4)

您正在使用null参数调用InputStreamReader(或某些此类函数)。

    is = new InputStreamReader(null);    // bang

答案 1 :(得分:0)

当您尝试在创建对象之前访问该对象时,通常会发生NULL指针异常,这就是为什么它返回NULL指针异常或者您将对象的值显式设置为null ...

答案 2 :(得分:0)

我遇到了这个问题。这是由于InputStream对象为null。