View Single Post
  #8 (permalink)  
Old November 29th, 2013, 07:28 AM
Markstar Markstar is offline
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2013
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts

Great to see that there is actually a reply on this subject. I'm currently struggling with the EXACT same issue.

I have tried two approaches:
1) Importing the code sample and adding
        android:targetSdkVersion="11" />
to the manifest, as well as changing
to the version in the book (with the thread). However, this results in the following error:
[Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[Chapter_6_Earthquake] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.

I tried googling the error and it was suggested to change the file so it matches the target (11 in this case). However, this didn't help.

2) I've tried manually creating the program (actually did this first) and followed the book. Since my usual targetSDK is 19, I encountered the error mentioned here in the thread and in the book. But again, changing minSdkVersion and targetSdkVersion to 11 didn't help either. At least here I get to the point where it tried to install the program on my AVD, but the application crashes ("Unfortunately, Earthquake has stopped") and I get plenty of error messages:
E/AndroidRuntime(519): FATAL EXCEPTION: Thread-69
E/AndroidRuntime(519): android.view.ViewRootImpl$CalledFromWrongThreadExc eption: Only the original thread that created a view hierarchy can touch its views.
E/AndroidRuntime(519): at android.view.ViewRootImpl.checkThread(ViewRootImpl .java:4039)
To be honest, I'm quite new to Java as well and I really struggle when encountering errors (since I don't know where to go to fix them).

So any help on this subject would be greatly appreciated, as this project (and understanding these issues) seems rather important when going forward.

Edit:While I was unable to fix the Earthquake example, I did get the same error (Dex Loader...) in a later example (Chapter_12_GForceMeter). There, changing the targetSdkVersion in the manifest and target in the did allow me to run the app successfully. So changing Earthquake to 19 in the manifest and results in a different error, though I'm not sure that this is due to the network issue... :
E/AndroidRuntime(1476): FATAL EXCEPTION: Thread-102
E/AndroidRuntime(1476): Process: com.paad.earthquake, PID: 1476
E/AndroidRuntime(1476): java.lang.NullPointerException
E/AndroidRuntime(1476): at com.paad.earthquake.EarthquakeListFragment.refresh Earthquakes(
E/AndroidRuntime(1476): at com.paad.earthquake.EarthquakeListFragment.access$ 0(
E/AndroidRuntime(1476): at com.paad.earthquake.EarthquakeListFragment$
E/AndroidRuntime(1476): at is the refreshEarthquakes() inside the Thread t, btw. Consider me thoroughly confused.

Last edited by Markstar; November 29th, 2013 at 08:17 AM..
Reply With Quote