我正在使用这个例子 -
serach by keyword - youtube api
当app尝试执行以下行时崩溃:
SearchListResponse searchResponse = search.execute();
这是一个例外:
10-23 22:32:17.186:I / Adreno-EGL(14500):: EGL 1.4 QUALCOMM Build:I0404c4692afb8623f95c43aeb6d5e13ed4b30ddb日期:11/06/13 10-23 22:32:17.226:D / OpenGLRenderer(14500):启用调试模式0 10-23 22:32:18.167:I / System.out(14500):搜索 10-23 22:32:19.169:D / dalvikvm(14500):GC_FOR_ALLOC释放189K,3%免费9309K / 9532K,暂停21ms,总计22ms 10-23 22:32:20.840:I / System.out(14500):查询!!! GHH 10-23 22:32:21.111:D / dalvikvm(14500):GC_FOR_ALLOC释放184K,3%释放9638K / 9856K,暂停16ms,总计16ms 10-23 22:32:21.121:W / ContextImpl(14500):使用startService的隐式意图不安全:Intent {act = com.google.android.youtube.api.service.START} android.content.ContextWrapper.bindService: 517 com.google.android.youtube.player.internal.re:-1 com.google.android.youtube.player.YouTubePlayerView.a:-1 10-23 22:32:21.161:I / System.out(14500):******************************** ******************* 10-23 22:32:21.241:D / dalvikvm(14500):GC_FOR_ALLOC释放374K,5%免费9776K / 10184K,暂停19ms,总计19ms 10-23 22:32:21.271:W / System.err(14500):android.os.NetworkOnMainThreadException 10-23 22:32:21.271:W / System.err(14500):在android.os.StrictMode $ AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145) 10-23 22:32:21.271:W / System.err(14500):at java.net.InetAddress.lookupHostByName(InetAddress.java:385) 10-23 22:32:21.271:W / System.err(14500):at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) 10-23 22:32:21.271:W / System.err(14500):at java.net.InetAddress.getAllByName(InetAddress.java:214) 10-23 22:32:21.271:W / System.err(14500):at com.android.okhttp.internal.Dns $ 1.getAllByName(Dns.java:28) 10-23 22:32:21.271:W / System.err(14500):at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216) 10-23 22:32:21.281:W / System.err(14500):at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122) 10-23 22:32:21.281:W / System.err(14500):at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292) 10-23 22:32:21.281:W / System.err(14500):at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) 10-23 22:32:21.281:W / System.err(14500):at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) 10-23 22:32:21.281:W / System.err(14500):at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) 10-23 22:32:21.281:W / System.err(14500):at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) 10-23 22:32:21.281:W / System.err(14500):at com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) 10-23 22:32:21.281:W / System.err(14500):at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:93) 10-23 22:32:21.281:W / System.err(14500):at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:965) 10-23 22:32:21.281:W / System.err(14500):at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410) 10-23 22:32:21.281:W / System.err(14500):at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) 10-23 22:32:21.281:W / System.err(14500):at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) 10-23 22:32:21.281:W / System.err(14500):at com.android.wetago.service.YoutubeService.getSearchResultList(YoutubeService.java:62) 10-23 22:32:21.281:W / System.err(14500):at com.android.wetago.YoutubeResultListActivity $ VideoListFragment.initVideoList(YoutubeResultListActivity.java:178) 10-23 22:32:21.281:W / System.err(14500):at com.android.wetago.YoutubeResultListActivity.onCreate(YoutubeResultListActivity.java:75) 10-23 22:32:21.281:W / System.err(14500):在android.app.Activity.performCreate(Activity.java:5231) 10-23 22:32:21.281:W / System.err(14500):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 10-23 22:32:21.281:W / System.err(14500):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 10-23 22:32:21.281:W / System.err(14500):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 10-23 22:32:21.281:W / System.err(14500):在android.app.ActivityThread.access $ 800(ActivityThread.java:135) 10-23 22:32:21.281:W / System.err(14500):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1196) 10-23 22:32:21.281:W / System.err(14500):在android.os.Handler.dispatchMessage(Handler.java:102) 10-23 22:32:21.281:W / System.err(14500):在android.os.Looper.loop(Looper.java:136) 10-23 22:32:21.281:W / System.err(14500):在android.app.ActivityThread.main(ActivityThread.java:5001) 10-23 22:32:21.281:W / System.err(14500):at java.lang.reflect.Method.invokeNative(Native Method) 10-23 22:32:21.281:W / System.err(14500):at java.lang.reflect.Method.invoke(Method.java:515) 10-23 22:32:21.281:W / System.err(14500):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:785) 10-23 22:32:21.281:W / System.err(14500):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 10-23 22:32:21.281:W / System.err(14500):at dalvik.system.NativeStart.main(Native Method) 10-23 22:32:21.281:D / AndroidRuntime(14500):关闭VM 10-23 22:32:21.281:W / dalvikvm(14500):threadid = 1:线程退出,未捕获异常(group = 0x4158aba8) 10-23 22:32:21.281:E / AndroidRuntime(14500):致命异常:主要 10-23 22:32:21.281:E / AndroidRuntime(14500):进程:com.android.wetago,PID:14500 10-23 22:32:21.281:E / AndroidRuntime(14500):java.lang.RuntimeException:无法启动活动ComponentInfo {com.android.wetago / com.android.wetago.YoutubeResultListActivity}:java.lang.NullPointerException:list == null 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.app.ActivityThread.access $ 800(ActivityThread.java:135) 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1196) 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.os.Handler.dispatchMessage(Handler.java:102) 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.os.Looper.loop(Looper.java:136) 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.app.ActivityThread.main(ActivityThread.java:5001) 10-23 22:32:21.281:E / AndroidRuntime(14500):at java.lang.reflect.Method.invokeNative(Native Method) 10-23 22:32:21.281:E / AndroidRuntime(14500):at java.lang.reflect.Method.invoke(Method.java:515) 10-23 22:32:21.281:E / AndroidRuntime(14500):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:785) 10-23 22:32:21.281:E / AndroidRuntime(14500):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 10-23 22:32:21.281:E / AndroidRuntime(14500):at dalvik.system.NativeStart.main(Native Method) 10-23 22:32:21.281:E / AndroidRuntime(14500):引起:java.lang.NullPointerException:list == null 10-23 22:32:21.281:E / AndroidRuntime(14500):at java.util.Collections.unmodifiableList(Collections.java:2283) 10-23 22:32:21.281:E / AndroidRuntime(14500):at com.android.wetago.YoutubeResultListActivity $ VideoListFragment.initVideoList(YoutubeResultListActivity.java:179) 10-23 22:32:21.281:E / AndroidRuntime(14500):at com.android.wetago.YoutubeResultListActivity.onCreate(YoutubeResultListActivity.java:75) 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.app.Activity.performCreate(Activity.java:5231) 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 10-23 22:32:21.281:E / AndroidRuntime(14500):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 10-23 22:32:21.281:E / AndroidRuntime(14500):... 11 more