我试图运行 GCM 示例应用程序,但在我的 logcat 中遇到致命异常(我的应用程序被迫关闭)这表明服务器 URL 链接是无效的 URL。如果我运行我的 URL 链接,它会显示“未注册设备”。如果无效的 URL 表示它正确显示错误,但显示“未注册设备”。所以我很困惑。为什么我面临这个问题。
日志猫:
03-04 16:28:11.691: E/AndroidRuntime(770): FATAL EXCEPTION: AsyncTask #1
03-04 16:28:11.691: E/AndroidRuntime(770): java.lang.RuntimeException: An error occured while executing doInBackground()
03-04 16:28:11.691: E/AndroidRuntime(770): at android.os.AsyncTask$3.done(AsyncTask.java:299)
03-04 16:28:11.691: E/AndroidRuntime(770): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
03-04 16:28:11.691: E/AndroidRuntime(770): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
03-04 16:28:11.691: E/AndroidRuntime(770): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
03-04 16:28:11.691: E/AndroidRuntime(770): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
03-04 16:28:11.691: E/AndroidRuntime(770): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-04 16:28:11.691: E/AndroidRuntime(770): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
03-04 16:28:11.691: E/AndroidRuntime(770): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
03-04 16:28:11.691: E/AndroidRuntime(770): at java.lang.Thread.run(Thread.java:856)
03-04 16:28:11.691: E/AndroidRuntime(770): Caused by: java.lang.IllegalArgumentException: invalid url: 192.168.1.2:8080/home/register
03-04 16:28:11.691: E/AndroidRuntime(770): at com.google.android.gcm.demo.app.ServerUtilities.post(ServerUtilities.java:138)
03-04 16:28:11.691: E/AndroidRuntime(770): at com.google.android.gcm.demo.app.ServerUtilities.register(ServerUtilities.java:66)
03-04 16:28:11.691: E/AndroidRuntime(770): at com.google.android.gcm.demo.app.DemoActivity$2.doInBackground(DemoActivity.java:88)
03-04 16:28:11.691: E/AndroidRuntime(770): at com.google.android.gcm.demo.app.DemoActivity$2.doInBackground(DemoActivity.java:1)
03-04 16:28:11.691: E/AndroidRuntime(770): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-04 16:28:11.691: E/AndroidRuntime(770): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
03-04 16:28:11.691: E/AndroidRuntime(770): ... 5 more
代码: http: //paste.org/62112