0

我已经开发了 phonegap android 应用程序。当使用 android 服务单击按钮并显示通知和警报时,我一直在后台运行该应用程序。我还将使用 javascript 显示广告(inmobi)。后台进程和广告都工作正常.但是突然我在logcat中遇到错误(有时)并且我的应用程序被强制关闭。在后台进程中,我正在使用Web服务从服务器获取值

这是我的 Logcat 错误:

java.net.UnknownHostException: Host is unresolved:Mypath
at java.net.Socket.connect(Socket.java:1038)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.
<init>(HttpConnection.java:62)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.
get(HttpConnectionPool.java:88)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.
getHTTPConnection(HttpURLConnectionImpl.java:927)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.
connect(HttpURLConnectionImpl.java:909)
at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:75)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:136)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:90)
at com.app.myactivity.MyService$1.handleMessage(MyService.java:123)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
DEBUG/AndroidRuntime(2881): Shutting down VM
WARN/dalvikvm(2881): threadid=1: thread exiting with uncaught 
exception(group=0x4001d800)
ERROR/AndroidRuntime(2881): FATAL EXCEPTION: main
ERROR/AndroidRuntime(2881): java.lang.NullPointerException
at com.app.mobilyzer.newly.MyService$1.handleMessage(MyService.java:194)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)

请指导我。请告诉我问题出在哪里。是因为广告还是在后台进程中。提前致谢。

4

1 回答 1

0

我认为问题在于,有时您在代码、网站或广告端都得到空值。

于 2012-06-04T14:25:05.913 回答