我有几个项目,我正式转向ICS,并有一些奇怪的兼容性问题。这两个项目在Androdid 2.2和2.3中都运行良好。这两个项目最初在清单中都有以下内容:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10" />
连接到我的新ICS设备并运行后,我使用 java.net.Socket 和 java.io的一些Java API(作为jar文件包含在项目中)出错。* 等。当我从清单中删除 android:targetSdkVersion =“10”时,事情开始在ICS中重新开始工作。但是,存在一些性能问题,以下内容在Eclipse DDMS LogCat中显示了很多:
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
这是traces.txt输出:
----- pid 29070 at 2012-04-24 08:52:42 -----
Cmd line: com.COMPANY.MOBILEAPP
DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x40a4f460 self=0x705830
| sysTid=29070 nice=0 sched=0/0 cgrp=default handle=1075090568
| schedstat=( 0 0 0 ) utm=657 stm=52 core=0
at libcore.io.Posix.recvfromBytes(Native Method)
at libcore.io.Posix.recvfrom(Posix.java:131)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
at libcore.io.IoBridge.recvfrom(IoBridge.java:503)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
at java.io.InputStream.read(InputStream.java:163)
at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
at java.io.BufferedInputStream.read(BufferedInputStream.java:227)
at com.COMPANY.tools.Response.receive(Response.java:592)
at com.COMPANY.tools.Response.getResponse(Response.java:100)
at com.COMPANY.tools.Response.<init>(Response.java:73)
at com.COMPANY.PRODUCT.JAVAAPI.submit(JAVAAPI.java:267)
at com.COMPANY.PRODUCT.JAVAAPI.Logon(JAVAAPI.java:602)
at com.COMPANY.MOBILEAPP.PRODUCTAdapter.Connect(PRODUCTAdapter.java:50)
at com.COMPANY.MOBILEAPP.Browse.onResume(Browse.java:105)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1154)
at android.app.Activity.performResume(Activity.java:4539)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2434)
at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:169)
at android.app.LocalActivityManager.dispatchResume(LocalActivityManager.java:523)
at android.app.ActivityGroup.onResume(ActivityGroup.java:61)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1154)
at android.app.Activity.performResume(Activity.java:4539)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2434)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2472)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1173)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method)
"Binder Thread #2" prio=5 tid=10 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41346498 self=0x8dd648
| sysTid=29082 nice=0 sched=0/0 cgrp=default handle=9335880
| schedstat=( 0 0 0 ) utm=0 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)
"Binder Thread #1" prio=5 tid=9 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x413406b0 self=0x8e7a80
| sysTid=29081 nice=0 sched=0/0 cgrp=default handle=9062432
| schedstat=( 0 0 0 ) utm=0 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)
"FinalizerWatchdogDaemon" daemon prio=5 tid=8 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x4133bd60 self=0x8d50a8
| sysTid=29080 nice=0 sched=0/0 cgrp=default handle=9302200
| schedstat=( 0 0 0 ) utm=0 stm=0 core=0
at java.lang.VMThread.sleep(Native Method)
at java.lang.Thread.sleep(Thread.java:1031)
at java.lang.Thread.sleep(Thread.java:1013)
at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:213)
at java.lang.Thread.run(Thread.java:856)
"FinalizerDaemon" daemon prio=5 tid=7 WAIT
| group="main" sCount=1 dsCount=0 obj=0x4133bc08 self=0x8de4e0
| sysTid=29079 nice=0 sched=0/0 cgrp=default handle=9329168
| schedstat=( 0 0 0 ) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x40a455d0> (a java.lang.ref.ReferenceQueue)
at java.lang.Object.wait(Object.java:401)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:102)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:73)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168)
at java.lang.Thread.run(Thread.java:856)
"ReferenceQueueDaemon" daemon prio=5 tid=6 WAIT
| group="main" sCount=1 dsCount=0 obj=0x4133baa0 self=0x7983d8
| sysTid=29078 nice=0 sched=0/0 cgrp=default handle=9123568
| schedstat=( 0 0 0 ) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x40a454f8>
at java.lang.Object.wait(Object.java:364)
at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:128)
at java.lang.Thread.run(Thread.java:856)
"Compiler" daemon prio=5 tid=5 VMWAIT
| group="system" sCount=1 dsCount=0 obj=0x4133b9b0 self=0x8cc328
| sysTid=29077 nice=0 sched=0/0 cgrp=default handle=9055824
| schedstat=( 0 0 0 ) utm=32 stm=15 core=0
at dalvik.system.NativeStart.run(Native Method)
"JDWP" daemon prio=5 tid=4 VMWAIT
| group="system" sCount=1 dsCount=0 obj=0x4133b8c8 self=0x8d0a60
| sysTid=29076 nice=0 sched=0/0 cgrp=default handle=9122016
| schedstat=( 0 0 0 ) utm=0 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)
"Signal Catcher" daemon prio=5 tid=3 RUNNABLE
| group="system" sCount=0 dsCount=0 obj=0x4133b7d0 self=0x8ae310
| sysTid=29074 nice=0 sched=0/0 cgrp=default handle=9346264
| schedstat=( 0 0 0 ) utm=48 stm=37 core=0
at dalvik.system.NativeStart.run(Native Method)
"GC" daemon prio=5 tid=2 VMWAIT
| group="system" sCount=1 dsCount=0 obj=0x4133b6f0 self=0x890958
| sysTid=29072 nice=0 sched=0/0 cgrp=default handle=8971592
| schedstat=( 0 0 0 ) utm=14 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)
----- end 29070 -----
任何人都可以帮我指出正确的方向吗?
答案 0 :(得分:3)
签出android.os.NetworkOnMainThreadException您可能正在UI线程上执行网络操作,该线程在蜂窝前允许但现在抛出异常
答案 1 :(得分:0)
连接ADB logcat实用程序以查看会发生什么...这也是Eclipse插件的一部分,如果它没有显示在您的工作区中,那么只需通过Window-&gt; Show view-&gt;其他和在Android部分下找到LogCat