我想开发一个使用 Yahoo Weather API for android 的应用程序。我想获取当前和预报的天气详细信息。
我已经从不同的来源(例如:https ://github.com/survivingwithandroid/WeatherLib ,使用 Weatherlib API Android和Unable to execute activity in android for weatherlib)并得到不同的错误,IM 无法响应。有什么我可以得到适当的教程或指南的!
错误:
-17 08:50:48.961 3168-3168/com.survivingwithandroid.weather E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.survivingwithandroid.weather, PID: 3168
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.survivingwithandroid.weather/com.survivingwithandroid.weather.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.isEmpty()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.isEmpty()' on a null object reference
at com.survivingwithandroid.weather.billing.util.IabHelper.startSetup(IabHelper.java:267)
at com.survivingwithandroid.weather.MainActivity.onCreate(MainActivity.java:95)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
LogCat 消息:
12-18 09:37:40.866 1648-1648/com.survivingwithandroid.weather D/SwA﹕ onCreate
12-18 09:37:41.721 1648-1663/com.survivingwithandroid.weather I/art﹕ Background sticky concurrent mark sweep GC freed 1784(95KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 2MB/2MB, paused 16.214ms total 80.155ms
12-18 09:37:41.965 1648-1663/com.survivingwithandroid.weather I/art﹕ Background partial concurrent mark sweep GC freed 79(16KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 2MB/3MB, paused 3.978ms total 238.766ms
12-18 09:37:42.494 1648-1648/com.survivingwithandroid.weather D/IabHelper﹕ Starting in-app billing setup.
12-18 09:37:42.698 1648-1672/com.survivingwithandroid.weather D/OpenGLRenderer﹕ Render dirty regions requested: true
12-18 09:37:42.772 1648-1648/com.survivingwithandroid.weather D/﹕ HostConnection::get() New Host Connection established 0xb04630c0, tid 1648
12-18 09:37:43.000 1648-1648/com.survivingwithandroid.weather D/Atlas﹕ Validating map...
12-18 09:37:43.240 1648-1672/com.survivingwithandroid.weather D/libEGL﹕ loaded /system/lib/egl/libEGL_emulation.so
12-18 09:37:43.451 1648-1672/com.survivingwithandroid.weather D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_emulation.so
12-18 09:37:43.473 1648-1672/com.survivingwithandroid.weather D/libEGL﹕ loaded /system/lib/egl/libGLESv2_emulation.so
12-18 09:37:43.502 1648-1672/com.survivingwithandroid.weather D/﹕ HostConnection::get() New Host Connection established 0xafc1b770, tid 1672
12-18 09:37:43.548 1648-1672/com.survivingwithandroid.weather I/OpenGLRenderer﹕ Initialized EGL, version 1.4
12-18 09:37:43.643 1648-1672/com.survivingwithandroid.weather D/OpenGLRenderer﹕ Enabling debug mode 0
12-18 09:37:43.663 1648-1672/com.survivingwithandroid.weather W/EGL_emulation﹕ eglSurfaceAttrib not implemented
12-18 09:37:43.663 1648-1672/com.survivingwithandroid.weather W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xafc07ee0, error=EGL_SUCCESS
12-18 09:37:43.939 1648-1672/com.survivingwithandroid.weather W/EGL_emulation﹕ eglSurfaceAttrib not implemented
12-18 09:37:43.939 1648-1672/com.survivingwithandroid.weather W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xafc07f00, error=EGL_SUCCESS
12-18 09:37:43.973 1648-1648/com.survivingwithandroid.weather I/Choreographer﹕ Skipped 35 frames! The application may be doing too much work on its main thread.
谢谢!