out of memory on every other run, on Android - android

my app runs fine the first run, but if i restart it crashes and makes me force close. after i hit the force close button then i can start the app again. if i then try to restart after hitting the back button i have to force close. i lets me run it without error every other attempt. i thought android was supposed to take care of returning memory to the computer so we dont have to do that housekeeping: i do have a somewhat large array:
int worldgrid= new int[640][480][3];
in my constructor, i may have to shorten it. i does work the first attempt though. log cat messages:
05-08 19:09:46.035: E/dalvikvm-heap(420): Out of memory on a 28-byte
allocation.
05-08 19:09:46.195: I/dalvikvm(420): | group="main" sCount=0
dsCount=0 s=N obj=0x4001d8e0 self=0xccb0 05-08 19:09:46.195:
I/dalvikvm(420): | sysTid=420 nice=0 sched=0/0 cgrp=default
handle=-1345026008 05-08 19:09:46.205: I/dalvikvm(420): |
schedstat=( 52616400652 22917249866 1196 ) 05-08 19:09:46.205:
I/dalvikvm(420): at java.lang.reflect.Array.createMultiArray(Native
Method) 05-08 19:09:46.205: I/dalvikvm(420): at
java.lang.reflect.Array.newInstance(Array.java:444) 05-08
19:09:46.455: I/dalvikvm(420): at
com.gravedigger.MainGamePanel.(MainGamePanel.java:215) 05-08
19:09:46.455: I/dalvikvm(420): at
com.digger.DiggerActivity.onCreate(GravediggerActivity.java:116) 05-08
19:09:46.615: I/dalvikvm(420): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-08 19:09:46.625: I/dalvikvm(420): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-08 19:09:46.765: I/dalvikvm(420): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-08 19:09:46.765: I/dalvikvm(420): at
android.app.ActivityThread.access$2300(ActivityThread.java:125) 05-08
19:09:46.775: I/dalvikvm(420): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-08 19:09:46.775: I/dalvikvm(420): at
android.os.Handler.dispatchMessage(Handler.java:99) 05-08
19:09:46.785: I/dalvikvm(420): at
android.os.Looper.loop(Looper.java:123) 05-08 19:09:46.785:
I/dalvikvm(420): at
android.app.ActivityThread.main(ActivityThread.java:4627) 05-08
19:09:46.895: I/dalvikvm(420): at
java.lang.reflect.Method.invokeNative(Native Method) 05-08
19:09:46.895: I/dalvikvm(420): at
java.lang.reflect.Method.invoke(Method.java:521) 05-08 19:09:46.895:
I/dalvikvm(420): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-08 19:09:46.895: I/dalvikvm(420): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 05-08
19:09:46.905: I/dalvikvm(420): at
dalvik.system.NativeStart.main(Native Method) 05-08 19:09:47.038:
E/dalvikvm(420): HeapWorker is wedged: 11152ms spent inside
Lcom/android/internal/os/BinderInternal$GcWatcher;.finalize()V 05-08
19:09:47.038: I/dalvikvm(420): DALVIK THREADS: 05-08 19:09:47.045:
I/dalvikvm(420): "main" prio=5 tid=1 VMWAIT
05-08 19:09:47.045: I/dalvikvm(420): | group="main" sCount=1
dsCount=0 s=N obj=0x4001d8e0 self=0xccb0 05-08 19:09:47.045:
I/dalvikvm(420): | sysTid=420 nice=0 sched=0/0 cgrp=default
handle=-1345026008 05-08 19:09:47.045: I/dalvikvm(420): |
schedstat=( 52980087202 23270903160 1219 ) 05-08 19:09:47.045:
I/dalvikvm(420): at java.lang.reflect.Array.createMultiArray(Native
Method) 05-08 19:09:47.045: I/dalvikvm(420): at
java.lang.reflect.Array.newInstance(Array.java:444) 05-08
19:09:47.045: I/dalvikvm(420): at
com.digger.MainGamePanel.(MainGamePanel.java:215) 05-08
19:09:47.045: I/dalvikvm(420): at
com.digger.DiggerActivity.onCreate(GravediggerActivity.java:116) 05-08
19:09:47.045: I/dalvikvm(420): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-08 19:09:47.185: I/dalvikvm(420): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-08 19:09:47.185: I/dalvikvm(420): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-08 19:09:47.195: I/dalvikvm(420): at
android.app.ActivityThread.access$2300(ActivityThread.java:125) 05-08
19:09:47.195: I/dalvikvm(420): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-08 19:09:47.195: I/dalvikvm(420): at
android.os.Handler.dispatchMessage(Handler.java:99) 05-08
19:09:47.195: I/dalvikvm(420): at
android.os.Looper.loop(Looper.java:123) 05-08 19:09:47.195:
I/dalvikvm(420): at
android.app.ActivityThread.main(ActivityThread.java:4627) 05-08
19:09:47.195: I/dalvikvm(420): at
java.lang.reflect.Method.invokeNative(Native Method) 05-08
19:09:47.195: I/dalvikvm(420): at
java.lang.reflect.Method.invoke(Method.java:521) 05-08 19:09:47.195:
I/dalvikvm(420): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-08 19:09:47.195: I/dalvikvm(420): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 05-08
19:09:47.195: I/dalvikvm(420): at
dalvik.system.NativeStart.main(Native Method) 05-08 19:09:47.195:
I/dalvikvm(420): "Binder Thread #2" prio=5 tid=6 NATIVE 05-08
19:09:47.195: I/dalvikvm(420): | group="main" sCount=1 dsCount=0 s=N
obj=0x44f366b8 self=0x11d230 05-08 19:09:47.195: I/dalvikvm(420): |
sysTid=425 nice=0 sched=0/0 cgrp=default handle=1297528 05-08
19:09:47.195: I/dalvikvm(420): | schedstat=( 118912719 416670422 51
) 05-08 19:09:47.195: I/dalvikvm(420): at
dalvik.system.NativeStart.run(Native Method) 05-08 19:09:47.195:
I/dalvikvm(420): "Binder Thread #1" prio=5 tid=5 NATIVE 05-08
19:09:47.195: I/dalvikvm(420): | group="main" sCount=1 dsCount=0 s=N
obj=0x44f36480 self=0x11fd80 05-08 19:09:47.750: I/dalvikvm(420): |
sysTid=424 nice=0 sched=0/0 cgrp=default handle=1269616 05-08
19:09:47.750: I/dalvikvm(420): | schedstat=( 114332827 305656917 35
) 05-08 19:09:47.750: I/dalvikvm(420): at
dalvik.system.NativeStart.run(Native Method) 05-08 19:09:47.755:
I/dalvikvm(420): "JDWP" daemon prio=5 tid=4 VMWAIT 05-08 19:09:47.755:
I/dalvikvm(420): | group="system" sCount=1 dsCount=0 s=N
obj=0x44f352a0 self=0x135ad0 05-08 19:09:47.755: I/dalvikvm(420): |
sysTid=423 nice=0 sched=0/0 cgrp=default handle=1196352 05-08
19:09:47.765: I/dalvikvm(420): | schedstat=( 59551849 158373474 18 )
05-08 19:09:47.765: I/dalvikvm(420): at
dalvik.system.NativeStart.run(Native Method) 05-08 19:09:47.775:
I/dalvikvm(420): "Signal Catcher" daemon prio=5 tid=3 VMWAIT 05-08
19:09:47.886: I/dalvikvm(420): | group="system" sCount=1 dsCount=0
s=N obj=0x44f351e8 self=0x125550 05-08 19:09:47.886: I/dalvikvm(420):
| sysTid=422 nice=0 sched=0/0 cgrp=default handle=1240608 05-08
19:09:47.886: I/dalvikvm(420): | schedstat=( 2639901 40055709 3 )
05-08 19:09:47.886: I/dalvikvm(420): at
dalvik.system.NativeStart.run(Native Method) 05-08 19:09:47.886:
I/dalvikvm(420): "HeapWorker" daemon prio=5 tid=2 RUNNABLE 05-08
19:09:47.886: I/dalvikvm(420): | group="system" sCount=0 dsCount=0
s=N obj=0x438b8e50 self=0x12ece0 05-08 19:09:47.886: I/dalvikvm(420):
| sysTid=421 nice=0 sched=0/0 cgrp=default handle=1195896 05-08
19:09:47.906: I/dalvikvm(420): | schedstat=( 4477669539 2785983510
211 ) 05-08 19:09:47.906: I/dalvikvm(420): at
com.android.internal.os.BinderInternal$GcWatcher.finalize(BinderInternal.java:~48)
05-08 19:09:47.906: I/dalvikvm(420): at
dalvik.system.NativeStart.run(Native Method) 05-08 19:09:47.906:
D/dalvikvm(420): threadid=2: sending two SIGSTKFLTs to threadid=2
(tid=421) to cause debuggerd dump 05-08 19:09:57.895: D/dalvikvm(420):
Sent, pausing to let debuggerd run 05-08 19:10:05.956:
D/dalvikvm(420): Continuing 05-08 19:10:05.956: E/dalvikvm(420): VM
aborting

Probably, not good to have so pretty big arrays in memory.
But anyway, you can decrease memory usage by refactoring your array this way:
int worldgrid = new int[3][480][640];
This trick will reduce memory usage in several times. It's related with java memory overhead for arrays and each item, details can be found here.
http://www.javamex.com/tutorials/memory/array_memory_usage.shtml
Also check, that you don't keep any link to array, it will prevent removing it from memory. Also garbage collector doesn't remove from memory right after removing all links. So, if you don't make link to array equal to null, it's kept in memory and when you restart your app (there is no guaranty that activity was killed fully), and try to create array in onCreate (as I see from log) the old array can be not yet removed.

I can't tell you why you are getting the error every other time without seeing the rest of your code. Do you have static variables you are using?
However I can give you advice on lessening your memory consumption by a factor of 3. It looks like you are attempting to store an rgb image. The problem is each red, green, or blue pixel only needs one byte, but you are giving it an int which is 4 bytes. A better approach is to encode the red, green, and blue into a single int using: int color = Color.rgb(red, geen, blue)That way you only need to initialize your array to int[] worldgrid= new int[640][480] and you cut down the memory usage by a factor of 3.
In addition, you should probably not even store it as a multi-dimensional array at all, and just do int[] worldgrid = new int[640*480];and when indexing into array, just do: int result = worldgrid[row + col*640];

Related

Toast.makeText ANR

I'm getting an ANR that seems to be from Toast.makeText:
DALVIK THREADS: (mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0)
"main" prio=5 tid=1 SUSPENDED | group="main" sCount=1 dsCount=0
obj=0x40163600 self=0x12620 | sysTid=4197 nice=0 sched=0/0
cgrp=default handle=-1345338264 | schedstat=( 149532214000 43042125000
324000 ) utm=13923 stm=1030 core=0 at
android.graphics.Matrix.native_create(Native Method) at
android.graphics.Matrix.(Matrix.java:49) at
android.view.View.(View.java:1852) at
android.view.View.(View.java:2411) at
android.view.ViewGroup.(ViewGroup.java:365) at
android.widget.LinearLayout.(LinearLayout.java:156) at
android.widget.LinearLayout.(LinearLayout.java:152) at
java.lang.reflect.Constructor.constructNative(Native Method) at
java.lang.reflect.Constructor.newInstance(Constructor.java:416) at
android.view.LayoutInflater.createView(LayoutInflater.java:576) at
com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644)
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
at android.view.LayoutInflater.inflate(LayoutInflater.java:457) at
android.view.LayoutInflater.inflate(LayoutInflater.java:391) at
android.view.LayoutInflater.inflate(LayoutInflater.java:347) at
android.widget.Toast.makeText(Toast.java:230) at
android.widget.Toast.makeText(Toast.java:253) at
com.anthonymandra.framework.ViewerActivity.onActivityResult(ViewerActivity.java:802)
at android.app.Activity.dispatchActivityResult(Activity.java:4581) at
android.app.ActivityThread.deliverResults(ActivityThread.java:2814) at
android.app.ActivityThread.handleSendResult(ActivityThread.java:2861)
at android.app.ActivityThread.access$1000(ActivityThread.java:122) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
at android.os.Handler.dispatchMessage(Handler.java:99) at
android.os.Looper.loop(Looper.java:132) at
android.app.ActivityThread.main(ActivityThread.java:4123) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:491) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) at
dalvik.system.NativeStart.main(Native Method)
This is the line of code called from within onActivityResult:
Toast.makeText(this, R.string.save_success, Toast.LENGTH_SHORT).show();
Anyone know why a Toast might cause an ANR, or what might really be wrong if I'm misreading this? Thanks!
Instead of using direct call to R.string, you should use getResources() and then like below
String strSuccess = getString(R.string.save_success);
Toast.makeText(this, strSuccess, Toast.LENGTH_SHORT).show();
or
Toast.makeText(this, getString(R.string.save_success),Toast.LENGTH_SHORT).show();
Read more

Android PackageManger -- Exception

When getting the list of packages which is running in devices, i am getting the execption proxy stub exception from my logcat
This the code i used
List packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
This the exception which im am getting
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x40ab1478 self=0x112f910
| sysTid=1801 nice=0 sched=0/0 cgrp=default handle=1074439528
| schedstat=( 0 0 0 ) utm=465 stm=85 core=1
at android.os.BinderProxy.transact(Native Method)
at android.content.pm.IPackageManager$Stub$Proxy.getInstalledApplications(IPackageManager.java:1930)
at android.app.ApplicationPackageManager.getInstalledApplications(ApplicationPackageManager.java:414)
at com.informate.smnpd.DataUsageAppManager.processData1(DataUsageAppManager.java:237)
at com.informate.smnpd.DataUsageAppManager.processData(DataUsageAppManager.java:114)
at com.informate.smnpd.BackgroundService.getData(BackgroundService.java:667)
at com.informate.smnpd.ManualUpdate.onClick(ManualUpdate.java:221)
at android.view.View.performClick(View.java:3526)
at android.view.View$PerformClick.run(View.java:14133)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4697)
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)
Can anyone please guide me on why this exception will occures at the time of getting installed package name. Thanks in advance

App dies on startup

When I start my app, I start an AsyncTask to do some downloading. This can take a while.
When that thread is downloading the data, I am already listening for location updates. When I receive a new location, I start a new AsyncTask to do some processing. However, this class depends on the downloaded data, so it has to wait until the downloading is done:
public void setLocation(Location location) throws IOException {
Logger.log("New location - calculating nearest stations");
if (!initialStationsRead) {
Logger.log("Location update waiting for stations to be read");
while (!initialStationsRead)
;
Logger.log("Location update done waiting");
}
/* Do the processing */
}
The first thread sets initialStationsRead to true when it's done, so the second thread can pick up after that. This all works fine on my test devices.
However, I received an email from a user telling me that the app won't start. The loading screen appeared, and after 10-12 seconds disappeared without a warning. He uses a HTC One S.
This is the logcat he sent me:
07-05 22:11:04.938: W/dalvikvm(19961): threadid=2: spin on suspend #2 threadid=11 (pcf=1)
07-05 22:11:04.938: I/dalvikvm(19961): "GC" daemon prio=5 tid=2 RUNNABLE
07-05 22:11:04.938: I/dalvikvm(19961): | group="system" sCount=0 dsCount=0 obj=0x40d5c580 self=0x1669ae8
07-05 22:11:04.938: I/dalvikvm(19961): | sysTid=19965 nice=0 sched=0/0 cgrp=default handle=21931384
07-05 22:11:04.938: I/dalvikvm(19961): | schedstat=( 0 0 0 ) utm=2 stm=0 core=1
07-05 22:11:04.938: I/dalvikvm(19961): at dalvik.system.NativeStart.run(Native Method)
07-05 22:11:04.938: I/dalvikvm(19961): "AsyncTask #3" prio=5 tid=11 RUNNABLE JIT
07-05 22:11:04.938: I/dalvikvm(19961): | group="main" sCount=1 dsCount=0 obj=0x40f90588 self=0x1b35b00
07-05 22:11:04.938: I/dalvikvm(19961): | sysTid=19991 nice=0 sched=0/0 cgrp=default handle=29193008
07-05 22:11:04.938: I/dalvikvm(19961): | schedstat=( 0 0 0 ) utm=287 stm=1 core=1
07-05 22:11:04.938: I/dalvikvm(19961): at com.busybits.treinverkeer.data.Data.setLocation(Data.java:~102)
07-05 22:11:04.938: I/dalvikvm(19961): at com.busybits.treinverkeer.TreinVerkeer$SetLocationAsyncTask.doInBackground(TreinVerkeer.java:408)
07-05 22:11:04.938: I/dalvikvm(19961): at com.busybits.treinverkeer.TreinVerkeer$SetLocationAsyncTask.doInBackground(TreinVerkeer.java:1)
07-05 22:11:04.938: I/dalvikvm(19961): at android.os.AsyncTask$2.call(AsyncTask.java:264)
07-05 22:11:04.938: I/dalvikvm(19961): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-05 22:11:04.938: I/dalvikvm(19961): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-05 22:11:04.938: I/dalvikvm(19961): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-05 22:11:04.938: I/dalvikvm(19961): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-05 22:11:04.938: I/dalvikvm(19961): at java.lang.Thread.run(Thread.java:864)
07-05 22:11:05.629: D/WifiStateMachine(436): fetchRssiAndLinkSpeedNative RSSI = -32
07-05 22:11:05.689: W/dalvikvm(19961): threadid=2: spin on suspend #3 threadid=11 (pcf=1)
07-05 22:11:05.689: I/dalvikvm(19961): "GC" daemon prio=5 tid=2 RUNNABLE
07-05 22:11:05.689: I/dalvikvm(19961): | group="system" sCount=0 dsCount=0 obj=0x40d5c580 self=0x1669ae8
07-05 22:11:05.689: I/dalvikvm(19961): | sysTid=19965 nice=0 sched=0/0 cgrp=default handle=21931384
07-05 22:11:05.689: I/dalvikvm(19961): | schedstat=( 0 0 0 ) utm=2 stm=0 core=1
07-05 22:11:05.689: I/dalvikvm(19961): at dalvik.system.NativeStart.run(Native Method)
07-05 22:11:05.689: I/dalvikvm(19961): "AsyncTask #3" prio=5 tid=11 RUNNABLE JIT
07-05 22:11:05.689: I/dalvikvm(19961): | group="main" sCount=1 dsCount=0 obj=0x40f90588 self=0x1b35b00
07-05 22:11:05.689: I/dalvikvm(19961): | sysTid=19991 nice=0 sched=0/0 cgrp=default handle=29193008
07-05 22:11:05.689: I/dalvikvm(19961): | schedstat=( 0 0 0 ) utm=362 stm=1 core=1
07-05 22:11:05.689: I/dalvikvm(19961): at com.busybits.treinverkeer.data.Data.setLocation(Data.java:~102)
07-05 22:11:05.689: I/dalvikvm(19961): at com.busybits.treinverkeer.TreinVerkeer$SetLocationAsyncTask.doInBackground(TreinVerkeer.java:408)
07-05 22:11:05.689: I/dalvikvm(19961): at com.busybits.treinverkeer.TreinVerkeer$SetLocationAsyncTask.doInBackground(TreinVerkeer.java:1)
07-05 22:11:05.689: I/dalvikvm(19961): at android.os.AsyncTask$2.call(AsyncTask.java:264)
07-05 22:11:05.689: I/dalvikvm(19961): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-05 22:11:05.689: I/dalvikvm(19961): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-05 22:11:05.689: I/dalvikvm(19961): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-05 22:11:05.689: I/dalvikvm(19961): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-05 22:11:05.689: I/dalvikvm(19961): at java.lang.Thread.run(Thread.java:864)
07-05 22:11:05.719: D/skia(1004): AndroidImageRef[ 0x2438190 ] releasePixel fail as lockCount=1
07-05 22:11:06.439: W/dalvikvm(19961): threadid=2: spin on suspend #4 threadid=11 (pcf=1)
07-05 22:11:06.439: I/dalvikvm(19961): "GC" daemon prio=5 tid=2 RUNNABLE
07-05 22:11:06.439: I/dalvikvm(19961): | group="system" sCount=0 dsCount=0 obj=0x40d5c580 self=0x1669ae8
07-05 22:11:06.439: I/dalvikvm(19961): | sysTid=19965 nice=0 sched=0/0 cgrp=default handle=21931384
07-05 22:11:06.439: I/dalvikvm(19961): | schedstat=( 0 0 0 ) utm=2 stm=0 core=1
07-05 22:11:06.439: I/dalvikvm(19961): at dalvik.system.NativeStart.run(Native Method)
07-05 22:11:06.439: I/dalvikvm(19961): "AsyncTask #3" prio=5 tid=11 RUNNABLE JIT
07-05 22:11:06.439: I/dalvikvm(19961): | group="main" sCount=1 dsCount=0 obj=0x40f90588 self=0x1b35b00
07-05 22:11:06.439: I/dalvikvm(19961): | sysTid=19991 nice=0 sched=0/0 cgrp=default handle=29193008
07-05 22:11:06.439: I/dalvikvm(19961): | schedstat=( 0 0 0 ) utm=437 stm=1 core=1
07-05 22:11:06.439: I/dalvikvm(19961): at com.busybits.treinverkeer.data.Data.setLocation(Data.java:~102)
07-05 22:11:06.439: I/dalvikvm(19961): at com.busybits.treinverkeer.TreinVerkeer$SetLocationAsyncTask.doInBackground(TreinVerkeer.java:408)
07-05 22:11:06.439: I/dalvikvm(19961): at com.busybits.treinverkeer.TreinVerkeer$SetLocationAsyncTask.doInBackground(TreinVerkeer.java:1)
07-05 22:11:06.439: I/dalvikvm(19961): at android.os.AsyncTask$2.call(AsyncTask.java:264)
07-05 22:11:06.439: I/dalvikvm(19961): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-05 22:11:06.439: I/dalvikvm(19961): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-05 22:11:06.439: I/dalvikvm(19961): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-05 22:11:06.439: I/dalvikvm(19961): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-05 22:11:06.439: I/dalvikvm(19961): at java.lang.Thread.run(Thread.java:864)
This is repeated x times.
Now, Data.java:102 is the line while(!initialStationsRead), so there must be going something wrong there.
What is happening, and how can I solve this?
The first thread sets initialStationsRead to true when it's done, so the second thread can pick up after that.
Busy loops are evil incarnate. If I had holy water handy, you'd be rather wet right now. :-)
(that also implies that I have really good holy-water throwing aim over long distances, which probably isn't the case)
Java has plenty of options for thread synchronization, and has had them for a decade-plus, from the low-level wait() and notify() on Object to the java.util.concurrent constructs like Semaphore. Pick one and use it, getting rid of the busy loop.
Or, follow Jan-Henk's advice and do the work serially on the same thread, based on a flag.
Any idea though why this happens on his device and not on mine or devices of other people i know?
Well, for starters, the One S is dual-core, and so your threads may actually be running at the same time (one per core). Threading problems will be more likely to surface in multi-core environments.
Also, Angelo's answer -- posted while I was writing this -- is worth noting.
I don't know if that helps but keep in mind that after HoneyComb (Android 3.0) and before Donut (Android 1.6) only one AsyncTask can run simultaneously, since AsyncTask use a thread pool pattern and the default thread pool size on these versions is 1. If you want the AsyncTasks you are using to run simulteneously in these versions of Android, you can use this code executeOnExecutor(Executor, Params...) using the flag THREAD_POOL_EXECUTOR. See this answer of this previous post for more information. Seeing that the user that has an HTC One S device wich runs Android 4.0, maybe this is the source of your problem.

Android App not working when downloaded via App Store or Google Play - ANR

I have an OpenGL based application which is working fine when I compile and build from eclipse and install it on my android device, however, when I try to publish the same app and install over the Google-Play, the application seems to crash, without giving an ANR dialog. I even tried installing my signed .apk from USB and it all works fine there.
But the published Google-Play version is not working.
Is there any way that I can add some debug outputs on the published Google-play version?
I don't see any force-close or anything, it simply quits and following is the log.
It seems to be crashing at my native c++ functions:
06-20 12:27:36.859: D/SensorManager(14842): ====>>>>>Num Sensor: 1
06-20 12:27:36.859: D/SensorManager(14842): ====>>>>>Num Sensor: 2
06-20 12:27:36.869: D/SensorManager(14842): ====>>>>>Num Sensor: 3
06-20 12:27:36.869: D/SensorManager(14842): ====>>>>>Num Sensor: 4
06-20 12:27:36.869: D/SensorManager(14842): ====>>>>>Num Sensor: 5
06-20 12:27:36.869: D/SensorManager(14842): ====>>>>>Num Sensor: 6
06-20 12:27:36.869: D/SensorManager(14842): ====>>>>>Num Sensor: 0
06-20 12:27:36.889: I/GLThread(14842): noticed surfaceView surface lost tid=11
06-20 12:27:36.969: I/GLThread(14842): noticed surfaceView surface acquired tid=11
06-20 12:27:36.969: W/EglHelper(14842): start() tid=11
06-20 12:27:38.019: W/dalvikvm(14842): threadid=6: spin on suspend #1 threadid=9 (pcf=0)
06-20 12:27:38.769: W/dalvikvm(14842): threadid=6: spin on suspend #2 threadid=9 (pcf=0)
06-20 12:27:38.769: I/dalvikvm(14842): "Compiler" daemon prio=5 tid=6 VMWAIT
06-20 12:27:38.769: I/dalvikvm(14842): | group="system" sCount=0 dsCount=0 obj=0x40510ff0 self=0x1a7d20
06-20 12:27:38.769: I/dalvikvm(14842): | sysTid=14847 nice=0 sched=0/0 cgrp=default handle=619240
06-20 12:27:38.769: I/dalvikvm(14842): at dalvik.system.NativeStart.run(Native Method)
06-20 12:27:38.769: I/dalvikvm(14842): "Thread-10" prio=5 tid=9 RUNNABLE
06-20 12:27:38.769: I/dalvikvm(14842): | group="main" sCount=1 dsCount=0 obj=0x4052aa30 self=0x1e8c68
06-20 12:27:38.769: I/dalvikvm(14842): | sysTid=14850 nice=0 sched=0/0 cgrp=default handle=2001728
06-20 12:27:38.779: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.nativeInit(Native Method)
06-20 12:27:38.779: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.<init>((null):-1)
06-20 12:27:38.779: I/dalvikvm(14842): at surreal.quake3.engine.CameraVFP.<init>((null):-1)
06-20 12:27:38.779: I/dalvikvm(14842): at surreal.quake3.engine.c.run((null):-1)
06-20 12:27:39.529: W/dalvikvm(14842): threadid=6: spin on suspend #3 threadid=9 (pcf=0)
06-20 12:27:39.529: I/dalvikvm(14842): "Compiler" daemon prio=5 tid=6 VMWAIT
06-20 12:27:39.529: I/dalvikvm(14842): | group="system" sCount=0 dsCount=0 obj=0x40510ff0 self=0x1a7d20
06-20 12:27:39.529: I/dalvikvm(14842): | sysTid=14847 nice=0 sched=0/0 cgrp=default handle=619240
06-20 12:27:39.529: I/dalvikvm(14842): at dalvik.system.NativeStart.run(Native Method)
06-20 12:27:39.529: I/dalvikvm(14842): "Thread-10" prio=5 tid=9 RUNNABLE
06-20 12:27:39.529: I/dalvikvm(14842): | group="main" sCount=1 dsCount=0 obj=0x4052aa30 self=0x1e8c68
06-20 12:27:39.529: I/dalvikvm(14842): | sysTid=14850 nice=0 sched=0/0 cgrp=default handle=2001728
06-20 12:27:39.539: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.nativeInit(Native Method)
06-20 12:27:39.539: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.<init>((null):-1)
06-20 12:27:39.539: I/dalvikvm(14842): at surreal.quake3.engine.CameraVFP.<init>((null):-1)
06-20 12:27:39.539: I/dalvikvm(14842): at surreal.quake3.engine.c.run((null):-1)
06-20 12:27:40.299: W/dalvikvm(14842): threadid=6: spin on suspend #4 threadid=9 (pcf=0)
06-20 12:27:40.299: I/dalvikvm(14842): "Compiler" daemon prio=5 tid=6 VMWAIT
06-20 12:27:40.299: I/dalvikvm(14842): | group="system" sCount=0 dsCount=0 obj=0x40510ff0 self=0x1a7d20
06-20 12:27:40.299: I/dalvikvm(14842): | sysTid=14847 nice=0 sched=0/0 cgrp=default handle=619240
06-20 12:27:40.299: I/dalvikvm(14842): at dalvik.system.NativeStart.run(Native Method)
06-20 12:27:40.299: I/dalvikvm(14842): "Thread-10" prio=5 tid=9 RUNNABLE
06-20 12:27:40.299: I/dalvikvm(14842): | group="main" sCount=1 dsCount=0 obj=0x4052aa30 self=0x1e8c68
06-20 12:27:40.299: I/dalvikvm(14842): | sysTid=14850 nice=0 sched=0/0 cgrp=default handle=2001728
06-20 12:27:40.519: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.nativeInit(Native Method)
06-20 12:27:40.519: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.<init>((null):-1)
06-20 12:27:40.519: I/dalvikvm(14842): at surreal.quake3.engine.CameraVFP.<init>((null):-1)
06-20 12:27:40.519: I/dalvikvm(14842): at surreal.quake3.engine.c.run((null):-1)
06-20 12:27:41.269: W/dalvikvm(14842): threadid=6: spin on suspend #5 threadid=9 (pcf=0)
06-20 12:27:41.269: I/dalvikvm(14842): "Compiler" daemon prio=5 tid=6 VMWAIT
06-20 12:27:41.269: I/dalvikvm(14842): | group="system" sCount=0 dsCount=0 obj=0x40510ff0 self=0x1a7d20
06-20 12:27:41.269: I/dalvikvm(14842): | sysTid=14847 nice=0 sched=0/0 cgrp=default handle=619240
06-20 12:27:41.269: I/dalvikvm(14842): at dalvik.system.NativeStart.run(Native Method)
06-20 12:27:41.269: I/dalvikvm(14842): "Thread-10" prio=5 tid=9 RUNNABLE
06-20 12:27:41.269: I/dalvikvm(14842): | group="main" sCount=1 dsCount=0 obj=0x4052aa30 self=0x1e8c68
06-20 12:27:41.269: I/dalvikvm(14842): | sysTid=14850 nice=0 sched=0/0 cgrp=default handle=2001728
06-20 12:27:42.319: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.nativeInit(Native Method)
06-20 12:27:42.319: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.<init>((null):-1)
06-20 12:27:42.319: I/dalvikvm(14842): at surreal.quake3.engine.CameraVFP.<init>((null):-1)
06-20 12:27:42.319: I/dalvikvm(14842): at surreal.quake3.engine.c.run((null):-1)
06-20 12:27:43.069: W/dalvikvm(14842): threadid=6: spin on suspend #6 threadid=9 (pcf=0)
06-20 12:27:43.069: I/dalvikvm(14842): "Compiler" daemon prio=5 tid=6 VMWAIT
06-20 12:27:43.069: I/dalvikvm(14842): | group="system" sCount=0 dsCount=0 obj=0x40510ff0 self=0x1a7d20
06-20 12:27:43.069: I/dalvikvm(14842): | sysTid=14847 nice=0 sched=0/0 cgrp=default handle=619240
06-20 12:27:43.069: I/dalvikvm(14842): at dalvik.system.NativeStart.run(Native Method)
06-20 12:27:43.069: I/dalvikvm(14842): "Thread-10" prio=5 tid=9 RUNNABLE
06-20 12:27:43.069: I/dalvikvm(14842): | group="main" sCount=1 dsCount=0 obj=0x4052aa30 self=0x1e8c68
06-20 12:27:43.069: I/dalvikvm(14842): | sysTid=14850 nice=0 sched=0/0 cgrp=default handle=2001728
06-20 12:27:43.139: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.nativeInit(Native Method)
06-20 12:27:43.139: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.<init>((null):-1)
06-20 12:27:43.139: I/dalvikvm(14842): at surreal.quake3.engine.CameraVFP.<init>((null):-1)
06-20 12:27:43.139: I/dalvikvm(14842): at surreal.quake3.engine.c.run((null):-1)
06-20 12:27:43.899: W/dalvikvm(14842): threadid=6: spin on suspend #7 threadid=9 (pcf=0)
06-20 12:27:43.899: I/dalvikvm(14842): "Compiler" daemon prio=5 tid=6 VMWAIT
06-20 12:27:43.899: I/dalvikvm(14842): | group="system" sCount=0 dsCount=0 obj=0x40510ff0 self=0x1a7d20
06-20 12:27:43.899: I/dalvikvm(14842): | sysTid=14847 nice=0 sched=0/0 cgrp=default handle=619240
06-20 12:27:43.899: I/dalvikvm(14842): at dalvik.system.NativeStart.run(Native Method)
06-20 12:27:43.899: I/dalvikvm(14842): "Thread-10" prio=5 tid=9 RUNNABLE
06-20 12:27:43.899: I/dalvikvm(14842): | group="main" sCount=1 dsCount=0 obj=0x4052aa30 self=0x1e8c68
06-20 12:27:43.899: I/dalvikvm(14842): | sysTid=14850 nice=0 sched=0/0 cgrp=default handle=2001728
06-20 12:27:43.899: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.nativeInit(Native Method)
06-20 12:27:43.899: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.<init>((null):-1)
06-20 12:27:43.899: I/dalvikvm(14842): at surreal.quake3.engine.CameraVFP.<init>((null):-1)
06-20 12:27:43.899: I/dalvikvm(14842): at surreal.quake3.engine.c.run((null):-1)
06-20 12:27:44.649: W/dalvikvm(14842): threadid=6: spin on suspend #8 threadid=9 (pcf=0)
06-20 12:27:44.649: I/dalvikvm(14842): "Compiler" daemon prio=5 tid=6 VMWAIT
06-20 12:27:44.649: I/dalvikvm(14842): | group="system" sCount=0 dsCount=0 obj=0x40510ff0 self=0x1a7d20
06-20 12:27:44.649: I/dalvikvm(14842): | sysTid=14847 nice=0 sched=0/0 cgrp=default handle=619240
06-20 12:27:44.649: I/dalvikvm(14842): at dalvik.system.NativeStart.run(Native Method)
06-20 12:27:44.649: I/dalvikvm(14842): "Thread-10" prio=5 tid=9 RUNNABLE
06-20 12:27:44.649: I/dalvikvm(14842): | group="main" sCount=1 dsCount=0 obj=0x4052aa30 self=0x1e8c68
06-20 12:27:44.649: I/dalvikvm(14842): | sysTid=14850 nice=0 sched=0/0 cgrp=default handle=2001728
06-20 12:27:44.679: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.nativeInit(Native Method)
06-20 12:27:44.679: I/dalvikvm(14842): at surreal.quake3.engine.Camera9.<init>((null):-1)
06-20 12:27:44.679: I/dalvikvm(14842): at surreal.quake3.engine.CameraVFP.<init>((null):-1)
06-20 12:27:44.679: I/dalvikvm(14842): at surreal.quake3.engine.c.run((null):-1)
wow, this is a quite typical situation of native C code where you usually test the application compiling in debug mode and deliver in release mode.
Usually it changes a lot the optimization flags used by the compiler and the application becomes sensible to wrong memory pointers, NULL initialization and so on.
I advice to:
Check if the android.mk file used for debugging and production, to compile your library has the same optimization settings. Check for the optimization level (i.e. LOCAL_CFLAGS += -O3)
take the apk you upload on the market and install the application from the apk. IN this way you can safely exclude any alteration (if any) done by the market itself
If using OpenGL, it did happen to me once that the application crashes due to an OpenGL driver crash. In this case it is very hard to check the root causes of the problem. In my case it was due to a wrong VBO Identifier pointing to a dirty memory location. In my case, no ANR was generated too.
Check for any "out of memory" situation. Again, sometimes, in C you have variables init to zero when you are in debugging and you use them to malloc memory. If you did not init them yourself, when you go and use it whit a compiled for release library, you will get a lot of surprises. One of them could be your crash type.
Check for any other elements triggered by the "release" version. In one of my previous application, the application crashed due to an admob (advertisement) error which was not present in the test mode of the admob SDK. This could explain your behavior too.
I hope this helps in some way.
Cheers
Maurizio

ZXing integrated in Android App (incl. PhoneGap)

I want to use ZXing to decode a barcode in my Android App. I am using Phonegap to construct the app. Now I want to integrate ZXing to scan a barcode and handle the result in my app. I am using the Android 2.1 - update1 SDK.
First, I integrated the following classes in my app:
IntentIntegrator.java
IntentResult.java
Then I created an Activity called "Scanactivity" with the following content:
import android.app.Activity;
import android.content.Intent;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
public class ScanActivity extends Activity {
public void scanCode() {
IntentIntegrator.initiateScan(ScanActivity.this);
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
// handle scan result
}
// else continue with any other code you need in the method
}
}
In the view I placed a button, which calls the scanCode() method by pressing.
$("#button_scan").click(function(e) {
ScanActivity.scanCode();
});
I installed the app "Barcode Scanner (ZXing)" on the target device to use the intent function. If I press the Scan-Button in my app, the app crashes and closes. What is my mistake?
Here is the logcat:
04-13 10:20:46.636: WARN/dalvikvm(2525): JNI WARNING: DeleteLocalRef(0x44caf3c0) failed to find entry (valid=1)
04-13 10:20:46.636: WARN/dalvikvm(2525): JNI WARNING: DeleteLocalRef(0x44caf3c0) failed to find entry (valid=1)
04-13 10:20:46.636: ERROR/dalvikvm(2525): Class lookup Landroid/webkit/WebHistoryItem; attemped while exception Ljava/lang/NullPointerException; pending
04-13 10:20:46.636: INFO/dalvikvm(2525): DALVIK THREADS:
04-13 10:20:46.636: INFO/dalvikvm(2525): "main" prio=5 tid=3 WAIT
04-13 10:20:46.636: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x4001e250 self=0xbe30
04-13 10:20:46.636: INFO/dalvikvm(2525): | sysTid=2525 nice=0 sched=0/0 cgrp=unknown handle=-1344001356
04-13 10:20:46.636: INFO/dalvikvm(2525): at java.lang.Object.wait(Native Method)
04-13 10:20:46.636: INFO/dalvikvm(2525): - waiting on <0x2488a8> (a android.os.MessageQueue)
04-13 10:20:46.636: INFO/dalvikvm(2525): at java.lang.Object.wait(Object.java:288)
04-13 10:20:46.636: INFO/dalvikvm(2525): at android.os.MessageQueue.next(MessageQueue.java:148)
04-13 10:20:46.636: INFO/dalvikvm(2525): at android.os.Looper.loop(Looper.java:110)
04-13 10:20:46.636: INFO/dalvikvm(2525): at android.app.ActivityThread.main(ActivityThread.java:4363)
04-13 10:20:46.636: INFO/dalvikvm(2525): at java.lang.reflect.Method.invokeNative(Native Method)
04-13 10:20:46.636: INFO/dalvikvm(2525): at java.lang.reflect.Method.invoke(Method.java:521)
04-13 10:20:46.636: INFO/dalvikvm(2525): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-13 10:20:46.636: INFO/dalvikvm(2525): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-13 10:20:46.636: INFO/dalvikvm(2525): at dalvik.system.NativeStart.main(Native Method)
04-13 10:20:46.646: INFO/dalvikvm(2525): "http3" prio=5 tid=31 WAIT
04-13 10:20:46.646: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c970a8 self=0x296f40
04-13 10:20:46.646: INFO/dalvikvm(2525): | sysTid=2544 nice=1 sched=0/0 cgrp=unknown handle=2715736
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Native Method)
04-13 10:20:46.646: INFO/dalvikvm(2525): - waiting on <0x28cff0> (a android.net.http.RequestQueue)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Object.java:288)
04-13 10:20:46.646: INFO/dalvikvm(2525): at android.net.http.ConnectionThread.run(ConnectionThread.java:98)
04-13 10:20:46.646: INFO/dalvikvm(2525): "http2" prio=5 tid=29 WAIT
04-13 10:20:46.646: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c96e58 self=0x294f00
04-13 10:20:46.646: INFO/dalvikvm(2525): | sysTid=2543 nice=1 sched=0/0 cgrp=unknown handle=2707480
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Native Method)
04-13 10:20:46.646: INFO/dalvikvm(2525): - waiting on <0x28cff0> (a android.net.http.RequestQueue)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Object.java:288)
04-13 10:20:46.646: INFO/dalvikvm(2525): at android.net.http.ConnectionThread.run(ConnectionThread.java:98)
04-13 10:20:46.646: INFO/dalvikvm(2525): "http1" prio=5 tid=27 WAIT
04-13 10:20:46.646: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c96ba0 self=0x294cf8
04-13 10:20:46.646: INFO/dalvikvm(2525): | sysTid=2542 nice=1 sched=0/0 cgrp=unknown handle=2706960
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Native Method)
04-13 10:20:46.646: INFO/dalvikvm(2525): - waiting on <0x28cff0> (a android.net.http.RequestQueue)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Object.java:288)
04-13 10:20:46.646: INFO/dalvikvm(2525): at android.net.http.ConnectionThread.run(ConnectionThread.java:98)
04-13 10:20:46.646: INFO/dalvikvm(2525): "http0" prio=5 tid=25 WAIT
04-13 10:20:46.646: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c96990 self=0x294be0
04-13 10:20:46.646: INFO/dalvikvm(2525): | sysTid=2541 nice=1 sched=0/0 cgrp=unknown handle=2667208
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Native Method)
04-13 10:20:46.646: INFO/dalvikvm(2525): - waiting on <0x28cff0> (a android.net.http.RequestQueue)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Object.java:288)
04-13 10:20:46.646: INFO/dalvikvm(2525): at android.net.http.ConnectionThread.run(ConnectionThread.java:98)
04-13 10:20:46.646: INFO/dalvikvm(2525): "Thread-12" prio=5 tid=23 TIMED_WAIT
04-13 10:20:46.646: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c7b460 self=0x261498
04-13 10:20:46.646: INFO/dalvikvm(2525): | sysTid=2540 nice=0 sched=0/0 cgrp=unknown handle=2375456
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Native Method)
04-13 10:20:46.646: INFO/dalvikvm(2525): - waiting on <0x2444b0> (a com.phonegap.DroidGap$1$1)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Object.java:326)
04-13 10:20:46.646: INFO/dalvikvm(2525): at com.phonegap.DroidGap$1$1.run(DroidGap.java:387)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Thread.run(Thread.java:1096)
04-13 10:20:46.646: INFO/dalvikvm(2525): "Thread-11" prio=5 tid=21 NATIVE
04-13 10:20:46.646: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c7af48 self=0x262998
04-13 10:20:46.646: INFO/dalvikvm(2525): | sysTid=2539 nice=0 sched=0/0 cgrp=unknown handle=2333912
04-13 10:20:46.646: INFO/dalvikvm(2525): at org.apache.harmony.luni.platform.OSNetworkSystem.acceptSocketImpl(Native Method)
04-13 10:20:46.646: INFO/dalvikvm(2525): at org.apache.harmony.luni.platform.OSNetworkSystem.accept(OSNetworkSystem.java:69)
04-13 10:20:46.646: INFO/dalvikvm(2525): at org.apache.harmony.luni.net.PlainSocketImpl.accept(PlainSocketImpl.java:126)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.net.ServerSocket.implAccept(ServerSocket.java:285)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.net.ServerSocket.accept(ServerSocket.java:164)
04-13 10:20:46.646: INFO/dalvikvm(2525): at com.phonegap.CallbackServer.run(CallbackServer.java:185)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Thread.run(Thread.java:1096)
04-13 10:20:46.646: INFO/dalvikvm(2525): "CookieSyncManager" prio=5 tid=19 TIMED_WAIT
04-13 10:20:46.646: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c68588 self=0x127408
04-13 10:20:46.646: INFO/dalvikvm(2525): | sysTid=2538 nice=10 sched=0/0 cgrp=unknown handle=1220392
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Native Method)
04-13 10:20:46.646: INFO/dalvikvm(2525): - waiting on <0x23b538> (a android.os.MessageQueue)
04-13 10:20:46.646: INFO/dalvikvm(2525): at java.lang.Object.wait(Object.java:326)
04-13 10:20:46.646: INFO/dalvikvm(2525): at android.os.MessageQueue.next(MessageQueue.java:144)
04-13 10:20:46.646: INFO/dalvikvm(2525): at android.os.Looper.loop(Looper.java:110)
04-13 10:20:46.656: INFO/dalvikvm(2525): at android.webkit.WebSyncManager.run(WebSyncManager.java:90)
04-13 10:20:46.656: INFO/dalvikvm(2525): at java.lang.Thread.run(Thread.java:1096)
04-13 10:20:46.656: INFO/dalvikvm(2525): "WebViewCoreThread" prio=5 tid=17 RUNNABLE
04-13 10:20:46.656: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c63210 self=0x136478
04-13 10:20:46.656: INFO/dalvikvm(2525): | sysTid=2535 nice=0 sched=0/0 cgrp=unknown handle=1339552
04-13 10:20:46.656: INFO/dalvikvm(2525): at android.webkit.WebViewCore.nativeTouchUp(Native Method)
04-13 10:20:46.656: INFO/dalvikvm(2525): at android.webkit.WebViewCore.access$3400(WebViewCore.java:48)
04-13 10:20:46.656: INFO/dalvikvm(2525): at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1094)
04-13 10:20:46.656: INFO/dalvikvm(2525): at android.os.Handler.dispatchMessage(Handler.java:99)
04-13 10:20:46.656: INFO/dalvikvm(2525): at android.os.Looper.loop(Looper.java:123)
04-13 10:20:46.656: INFO/dalvikvm(2525): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:611)
04-13 10:20:46.656: INFO/dalvikvm(2525): at java.lang.Thread.run(Thread.java:1096)
04-13 10:20:46.656: INFO/dalvikvm(2525): "Binder Thread #3" prio=5 tid=15 NATIVE
04-13 10:20:46.656: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c530e8 self=0x130c70
04-13 10:20:46.656: INFO/dalvikvm(2525): | sysTid=2534 nice=0 sched=0/0 cgrp=unknown handle=1354864
04-13 10:20:46.656: INFO/dalvikvm(2525): at dalvik.system.NativeStart.run(Native Method)
04-13 10:20:46.656: INFO/dalvikvm(2525): "Binder Thread #2" prio=5 tid=13 NATIVE
04-13 10:20:46.656: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c53028 self=0x1269e0
04-13 10:20:46.656: INFO/dalvikvm(2525): | sysTid=2533 nice=0 sched=0/0 cgrp=unknown handle=1383744
04-13 10:20:46.656: INFO/dalvikvm(2525): at dalvik.system.NativeStart.run(Native Method)
04-13 10:20:46.656: INFO/dalvikvm(2525): "Binder Thread #1" prio=5 tid=11 NATIVE
04-13 10:20:46.656: INFO/dalvikvm(2525): | group="main" sCount=0 dsCount=0 s=N obj=0x44c4dc50 self=0x132840
04-13 10:20:46.656: INFO/dalvikvm(2525): | sysTid=2532 nice=0 sched=0/0 cgrp=unknown handle=1354576
04-13 10:20:46.656: INFO/dalvikvm(2525): at dalvik.system.NativeStart.run(Native Method)
04-13 10:20:46.656: INFO/dalvikvm(2525): "JDWP" daemon prio=5 tid=9 VMWAIT
04-13 10:20:46.656: INFO/dalvikvm(2525): | group="system" sCount=0 dsCount=0 s=N obj=0x44c4c2a0 self=0x14e0f0
04-13 10:20:46.656: INFO/dalvikvm(2525): | sysTid=2529 nice=0 sched=0/0 cgrp=unknown handle=1135864
04-13 10:20:46.656: INFO/dalvikvm(2525): at dalvik.system.NativeStart.run(Native Method)
04-13 10:20:46.656: INFO/dalvikvm(2525): "Signal Catcher" daemon prio=5 tid=7 VMWAIT
04-13 10:20:46.656: INFO/dalvikvm(2525): | group="system" sCount=0 dsCount=0 s=N obj=0x44c4c1e8 self=0x1127b0
04-13 10:20:46.656: INFO/dalvikvm(2525): | sysTid=2528 nice=0 sched=0/0 cgrp=unknown handle=1338232
04-13 10:20:46.656: INFO/dalvikvm(2525): at dalvik.system.NativeStart.run(Native Method)
04-13 10:20:46.656: INFO/dalvikvm(2525): "HeapWorker" daemon prio=5 tid=5 VMWAIT
04-13 10:20:46.656: INFO/dalvikvm(2525): | group="system" sCount=0 dsCount=0 s=N obj=0x43562ed8 self=0x12b268
04-13 10:20:46.656: INFO/dalvikvm(2525): | sysTid=2526 nice=0 sched=0/0 cgrp=unknown handle=1355192
04-13 10:20:46.656: INFO/dalvikvm(2525): at dalvik.system.NativeStart.run(Native Method)
04-13 10:20:46.656: ERROR/dalvikvm(2525): VM aborting
This is the stack:
ScanActivity.scanCode() line: 12
IntentIntegrator.initiateScan(ScanActivity.this);
Activity.class:
ScanActivity(Activity).startActivityForResult(Intent, int) line: 2749
Reference.class:
WeakReference(Reference).get() line: 147
Then the app terminates.
Check out the PhoneGap barcode tutorial here. It will take you step by step to creating a sample app with zxing via the PhoneGap plugin from purplecabbage.

Categories

Resources