如何在android中使用Yahoo Weather API

时间:2014-12-16 11:34:10

标签: android yahoo-weather-api

我想使用Yahoo Weather API为Android开发应用程序。我想获得当前和预测的天气详情。

我已经尝试过不同的来源(例如:https://github.com/survivingwithandroid/WeatherLib},Getting error with Weatherlib API AndroidUnable to execute activity in android for weatherlib)并获得了我无法重新分析的不同错误。有什么我可以得到一个适当的教程或指南!

错误:

-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)

genymotion AVD showing up no result enter image description here

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.

谢谢!

1 个答案:

答案 0 :(得分:0)

该项目不适用于Eclipse,但您应该使用Android Studio。 无论如何,你可以在https://github.com/survivingwithandroid/WeatherLib/tree/master/lib/release下找到可以导入eclipse的罐子。 我建议你使用Android Studio