I am just trying out the "TouchPaint" sample provided by Google Android examples at:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.html
Created my own AndroidManifest.xml, and I figured that "GraphicsActivity.java" and "PictureLayout.java" are two other java files before I could compiled and create the apk successfully.
After I load into my Android phone, it displayed a blank screen. At this point nothing happened yet, but once I touch the screen, the apps died, and generated the following trace in logcat output:
D/dalvikvm( 4939): GC_CONCURRENT freed 44K, 49% free 2779K/5379K, external 3286K/4104K, paused 4ms+2ms
D/dalvikvm( 365): GC_CONCURRENT freed 1102K, 54% free 3271K/7047K, external 2612K/3262K, paused 4ms+4ms
I/ActivityManager( 266): Displayed com.example.android.apis.graphics/.TouchPaint: +382ms
D/AndroidRuntime( 4939): Shutting down VM
W/dalvikvm( 4939): threadid=1: thread exiting with uncaught exception (group=0x2aac8578)
E/AndroidRuntime( 4939): FATAL EXCEPTION: main
E/AndroidRuntime( 4939): java.lang.NoSuchMethodError: android.view.MotionEvent.getButtonState
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchOrHoverEvent(TouchPaint.java:346)
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchEvent(TouchPaint.java:337)
E/AndroidRuntime( 4939): at android.view.View.dispatchTouchEvent(View.java:3952)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1711)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1145)
E/AndroidRuntime( 4939): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1695)
E/AndroidRuntime( 4939): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2217)
E/AndroidRuntime( 4939): at android.view.ViewRoot.handleMessage(ViewRoot.java:1901)
E/AndroidRuntime( 4939): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4939): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 4939): at android.app.ActivityThread.main(ActivityThread.java:3701)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
E/AndroidRuntime( 4939): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 266): Force finishing activity com.example.android.apis.graphics/.TouchPaint
W/ActivityManager( 266): Activity pause timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
I/InputDispatcher( 266): Application is not responding: Window{2b3f4d00 com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint paused=false}. 5002.0ms since event, 5001.8ms since wait started
I/InputDispatcher( 266): Dropping event because the pointer is not down.
I/WindowManager( 266): Input event dispatching timed out sending to com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint
W/ActivityManager( 266): Activity destroy timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
D/lights ( 266): set_light_backlight: brightness=20
I/ActivityManager( 266): No longer want com.facebook.katana (pid 4319): hidden #16
W/ActivityManager( 266): Scheduling restart of crashed service com.facebook.katana/.service.UploadManager in 5000ms
I am puzzled over what is the possible cause of crashing?
This method is only available since API Level 14, set minSdkVersion to 14 in the Manifest
public final int getButtonState ()
Since: API Level 14
Gets the state of all buttons that are pressed such as a mouse or stylus button.
Returns
The button state.
I found the answer:
http://developer.android.com/resources/dashboard/platform-versions.html
http://developer.android.com/guide/appendix/api-levels.html
From the web page's table, since I know my phone is using Android 2.3.4, so that max target API for SDK should be 10. So instead of using the TouchPaint.java sample from android-14, I copied the TouchPaint.java from android-10,change the minSDK version to 10 inside my AndroidManifest.xml file:
<uses-sdk android:minSdkVersion="10"/>
Everything works!! Thanks to Rajdeep Dua too!!!
Related
I have an Android app which I want to use to set the APN settings. This requires the android.permission.WRITE_APN_SETTINGS permission, which is only granted to System apps or apps signed with the same private key as the OS itself. I'm only going to be using this on an emulator (or maybe a rooted device), so being able to actually deploy it to devices outside of my control isn't a concern. I'm building against and pushing to API 19.
Despite pushing my APK to the /system/app/ directory and setting chmod 0644, I still get java.lang.SecurityException: No permission to write APN settings: Neither user 10052 nor current process has android.permission.WRITE_APN_SETTINGS. in adb logcat when I try to run the app.
I've also tried running the app using db shell "su -c am start -n com.example.proxysetter/.MainActivity" with no luck.
Any suggestions other than compiling and signing my own Android image from source? (Not ideal.) I'm pretty sure I don't need to provide a .odex file even though everything else in /system/app/ has it.
Here are the steps I've been following so far when pushing the APK to the emulator:
ant debug
adb remount
adb push bin/MainActivity-debug.apk /system/app/
adb shell chmod 0644 /system/app/MainActivity-debug.apk
I don't reboot the emulator using adb reboot because it doesn't work for emulators, and if I manually kill the emulator and relaunch it, the app doesn't appear in my app list.
And my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exampld.proxysetter"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_APN_SETTINGS"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And the stack trace:
I/ActivityManager( 384): Start proc com.example.proxysetter for activity com.example.proxysetter/.MainActivity: pid=1082 uid=10052 gids={50052}
D/dalvikvm( 1082): Not late-enabling CheckJNI (already on)
D/dalvikvm( 384): GC_FOR_ALLOC freed 340K, 15% free 6420K/7468K, paused 91ms, total 93ms
D/dalvikvm( 1082): GC_FOR_ALLOC freed 70K, 10% free 3571K/3968K, paused 30ms, total 32ms
E/DatabaseUtils( 535): Writing exception to parcel
E/DatabaseUtils( 535): java.lang.SecurityException: No permission to write APN settings: Neither user 10052 nor current process has android.permission.WRITE_APN_SETTINGS.
E/DatabaseUtils( 535): at android.app.ContextImpl.enforce(ContextImpl.java:1685)
E/DatabaseUtils( 535): at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1714)
E/DatabaseUtils( 535): at com.android.providers.telephony.TelephonyProvider.checkPermission(TelephonyProvider.java:735)
E/DatabaseUtils( 535): at com.android.providers.telephony.TelephonyProvider.query(TelephonyProvider.java:462)
E/DatabaseUtils( 535): at android.content.ContentProvider.query(ContentProvider.java:857)
E/DatabaseUtils( 535): at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
E/DatabaseUtils( 535): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
E/DatabaseUtils( 535): at android.os.Binder.execTransact(Binder.java:404)
E/DatabaseUtils( 535): at dalvik.system.NativeStart.run(Native Method)
D/AndroidRuntime( 1082): Shutting down VM
W/dalvikvm( 1082): threadid=1: thread exiting with uncaught exception (group=0xb1a41ba8)
E/AndroidRuntime( 1082): FATAL EXCEPTION: main
E/AndroidRuntime( 1082): Process: com.example.proxysetter, PID: 1082
E/AndroidRuntime( 1082): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.proxysetter/com.example.proxysetter.MainActivity}: java.lang.SecurityException: No permission to write APN settings: Neither user 10052 nor current process has android.permission.WRITE_APN_SETTINGS.
E/AndroidRuntime( 1082): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
E/AndroidRuntime( 1082): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
E/AndroidRuntime( 1082): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 1082): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 1082): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 1082): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 1082): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 1082): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1082): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 1082): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 1082): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 1082): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1082): Caused by: java.lang.SecurityException: No permission to write APN settings: Neither user 10052 nor current process has android.permission.WRITE_APN_SETTINGS.
E/AndroidRuntime( 1082): at android.os.Parcel.readException(Parcel.java:1465)
E/AndroidRuntime( 1082): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
E/AndroidRuntime( 1082): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
E/AndroidRuntime( 1082): at android.content.ContentProviderProxy.query(ContentProviderNative.java:413)
E/AndroidRuntime( 1082): at android.content.ContentResolver.query(ContentResolver.java:461)
E/AndroidRuntime( 1082): at android.content.ContentResolver.query(ContentResolver.java:404)
E/AndroidRuntime( 1082): at com.example.proxysetter.MainActivity.setAPN(MainActivity.java:28)
E/AndroidRuntime( 1082): at com.example.proxysetter.MainActivity.onCreate(MainActivity.java:19)
E/AndroidRuntime( 1082): at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime( 1082): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 1082): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
E/AndroidRuntime( 1082): ... 11 more
W/ActivityManager( 384): Force finishing activity com.example.proxysetter/.MainActivity
For those wondering:
a) I made a typo; for API 19+ you want to push to /system/priv-app.
b) I was able to install the app by mounting system.img as ext4 and installing the app on the system image. I copied the system image directory into a new location, modified system.img and then edited foo.avd/config.ini to point to my modified system image directory.
I am trying to run my application that uses LibGDX on Andriod using the NetBeans IDE.
However the game crashes for some reason, I just got the "This application have stopped to work" message when I try to run the application. Everything works great on PC, so apparently I have missed something in the andriod set up. Setting up an andriod project on NetBeans is not an documented area and things seem to be different on Eclipse.
If someone have manged to run LibGDX on andriod by setting up the project in Netbeans, please share the steps you did.
Some code, I doubt that would help through:
public class Game extends AndroidApplication {
public void onCreate (android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initialize((ApplicationListener) new game.GameSystem(new Size2i(100, 100)), false);
}
}
The debug output I get is the following:
D/dalvikvm( 478): Trying to load lib /data/data/com.RPGGame/lib/libgdx.so 0x40515708
D/dalvikvm( 478): Added shared lib /data/data/com.RPGGame/lib/libgdx.so 0x40515708
D/dalvikvm( 478): No JNI_OnLoad found in /data/data/com.RPGGame/lib/libgdx.so 0x40515708, skipping init
D/AndroidRuntime( 478): Shutting down VM
W/dalvikvm( 478): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 478): FATAL EXCEPTION: main
E/AndroidRuntime( 478): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.RPGGame/com.RPGGame.MainActivity}: java.lang.ClassCastException: game.GameSystem
E/AndroidRuntime( 478): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
E/AndroidRuntime( 478): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 478): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 478): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 478): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 478): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 478): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 478): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 478): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 478): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 478): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 478): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 478): Caused by: java.lang.ClassCastException: game.GameSystem
E/AndroidRuntime( 478): at com.RPGGame.MainActivity.onCreate(MainActivity.java:11)
E/AndroidRuntime( 478): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 478): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime( 478): ... 11 more
W/ActivityManager( 104): Force finishing activity com.RPGGame/.MainActivity
W/ActivityManager( 104): Activity pause timeout for HistoryRecord{40512238 com.RPGGame/.MainActivity}
D/dalvikvm( 408): GC_EXPLICIT freed 8K, 54% free 2537K/5511K, external 1625K/2137K, paused 102ms
W/ActivityManager( 104): Activity destroy timeout for HistoryRecord{40512238 com.RPGGame/.MainActivity}
D/dalvikvm( 420): GC_EXPLICIT freed 324K, 55% free 2532K/5511K, external 1625K/2137K, paused 183ms
D/dalvikvm( 322): GC_EXPLICIT freed 9K, 55% free 2589K/5703K, external 1625K/2137K, paused 72ms
So basically I cannot cast game.GameSystem to ApplicationListener. Even if GameSystem implements ApplicationListener.
GameSystem works as intended on PC, all I did for the Andriod project was to put that code in the main file.
Okay, I solved it now, turned out I used the wrong version of game.GameSystem.
I'm trying to run the example from NDK package on a AT91SAM9M10-EKES board running Android 2.1
The activity fails.
This is what I get in the logcat, Can someone please guide me with this ?
D/AndroidRuntime( 1153): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1153): CheckJNI is ON
D/AndroidRuntime( 1153): --- registering native functions ---
D/ddm-heap( 1153): Got feature list request
D/AndroidRuntime( 1153): Shutting down VM
D/dalvikvm( 1153): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 1153): DestroyJavaVM shutting VM down
D/dalvikvm( 1153): HeapWorker thread shutting down
D/dalvikvm( 1153): HeapWorker thread has shut down
D/jdwp ( 1153): JDWP shutting down net...
I/dalvikvm( 1153): Debugger has detached; object registry had 1 entries
D/dalvikvm( 1153): VM cleaning up
E/AndroidRuntime( 1153): ERROR: thread attach failed
D/dalvikvm( 1153): LinearAlloc 0x0 used 629532 of 5242880 (12%)
D/AndroidRuntime( 1161):
D/AndroidRuntime( 1161): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1161): CheckJNI is ON
D/AndroidRuntime( 1161): --- registering native functions ---
D/ddm-heap( 1161): Got feature list request
I/ActivityManager( 767): Starting activity: Intent { act=android.intent.action.MAIN cat=android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.hellojni/.HelloJni }
D/AndroidRuntime( 1161): Shutting down VM
D/dalvikvm( 1161): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 1161): DestroyJavaVM shutting VM down
D/dalvikvm( 1161): HeapWorker thread shutting down
D/dalvikvm( 1161): HeapWorker thread has shut down
D/jdwp ( 1161): JDWP shutting down net...
I/dalvikvm( 1161): Debugger has detached; object registry had 1 entries
D/dalvikvm( 1161): VM cleaning up
E/AndroidRuntime( 1161): ERROR: thread attach failed
D/dalvikvm( 1161): LinearAlloc 0x0 used 639500 of 5242880 (12%)
I/ActivityManager( 767): Start proc com.example.hellojni for activity com.example.hellojni/.HelloJni: pid=1168 uid=10018 gids={1015}
D/ddm-heap( 1168): Got feature list request
W/dalvikvm( 1168): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/example/hellojni/HelloJni;.<clinit>
W/dalvikvm( 1168): Class init failed in newInstance call (Lcom/example/hellojni/HelloJni;)
D/AndroidRuntime( 1168): Shutting down VM
W/dalvikvm( 1168): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 1168): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 1168): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1168): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 1168): at java.lang.Class.newInstance(Class.java:1479)
E/AndroidRuntime( 1168): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 1168): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
E/AndroidRuntime( 1168): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime( 1168): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime( 1168): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime( 1168): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1168): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1168): at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 1168): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1168): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1168): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 1168): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 1168): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1168): Caused by: java.lang.UnsatisfiedLinkError: Library hello-jni not found
E/AndroidRuntime( 1168): at java.lang.Runtime.loadLibrary(Runtime.java:489)
E/AndroidRuntime( 1168): at java.lang.System.loadLibrary(System.java:557)
E/AndroidRuntime( 1168): at com.example.hellojni.HelloJni.<clinit>(HelloJni.java:64)
E/AndroidRuntime( 1168): ... 15 more
I/Process ( 767): Sending signal. PID: 1168 SIG: 3
I/dalvikvm( 1168): threadid=7: reacting to signal 3
E/dalvikvm( 1168): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
W/ActivityManager( 767): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 767): Activity idle timeout for HistoryRecord{43d5c310 com.example.hellojni/.HelloJni}
D/dalvikvm( 813): GC freed 301 objects / 14832 bytes in 91ms
I/power ( 767): *** set_screen_state 0
E/power ( 767): Failed setting last user activity: g_error=0
W/ActivityManager( 767): Activity pause timeout for HistoryRecord{43d5c310 com.example.hellojni/.HelloJni}
D/dalvikvm( 873): GC freed 165 objects / 6624 bytes in 81ms
you hadnt built the library(.so) file of the project thats why you are getting this error, try to build the project with help of android-ndk http://developer.android.com/sdk/ndk/index.html and cygwin http://www.cygwin.com/
I am having a weird problem.
I am developing a program to log GPS and sensor readings periodically. My friend runs the code on his machine using Eclipse Galileo 3.6 and it works perfectly fine for her.
When I run the code on my machine which has Eclipse Galileo 3.5.2 it shows service stopped unexpectedly.
We have the same JDK version. I am not able to figure out what may be the exact problem.
Please let me know what else information I need to give in order to fix the problem.
logcat
I/ActivityManager( 1104): Start proc com.sensor.test for service com.sensor.test/.SensorReadings: pid=3539 uid=10057 gids={3003, 1015}
D/AndroidRuntime( 3539): Shutting down VM
W/dalvikvm( 3539): threadid=1: thread exiting with uncaught exception (group=0x4001d7e0)
E/AndroidRuntime( 3539): FATAL EXCEPTION: main
E/AndroidRuntime( 3539): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.BATTERY_CHANGED flg=0x60000000 (has extras) } in com.sensor.test.SensorReadings$2#44770958
E/AndroidRuntime( 3539): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:905)
E/AndroidRuntime( 3539): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 3539): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 3539): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 3539): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 3539): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3539): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 3539): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 3539): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 3539): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3539): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 3539): at com.sensor.test.SensorReadings$2.onReceive(SensorReadings.java:327)
E/AndroidRuntime( 3539): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
E/AndroidRuntime( 3539): ... 9 more
W/ActivityManager( 1104): Activity destroy timeout for HistoryRecord{44b38508 com.sensor.test/.MainScreen}
D/WifiService( 1104): acquireWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder#44963d80}
D/LocationMasfClient( 1104): getNetworkLocation(): Location not found in cache, making network request
D/LocationMasfClient( 1104): getNetworkLocation(): Number of prefetched entries 10
E/LocationMasfClient( 1104): getNetworkLocation(): Returning *server* computed location with accuracy 28
D/libgps ( 1104): GpsInterface_inject_location( 35.772249, -78.673950, 28.000 )
D/WifiService( 1104): releaseWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder#44963d80}
D/WifiService( 1104): acquireWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder#44963d80}
D/WifiService( 1104): releaseWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder#44963d80}
D/NativeCrypto( 1104): Freeing OpenSSL session
D/dalvikvm( 1104): GC_FOR_MALLOC freed 22104 objects / 1169312 bytes in 128ms
D/NativeCrypto( 1104): Freeing OpenSSL session
I/Process ( 3539): Sending signal. PID: 3539 SIG: 9
W/InputManagerService( 1104): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#44b40dd0
I/ActivityManager( 1104): Process com.sensor.test (pid 3539) has died.
The pertinent code for line 88 with parsing going on:
public void startService(){
//startService(new Intent(MainScreen.this,SensorReadings.class));
Intent intent = new Intent(MainScreen.this, SensorReadings.class);
**intent.putExtra("lp", Integer.parseInt(""+longPeriod.getText()));// LINE 88**
intent.putExtra("gp", Integer.parseInt(""+gpsPeriod.getText()));
intent.putExtra("sp", Integer.parseInt(""+snrPeriod.getText()));
//startActivity(intent);
startService(intent);
}
Thanks.
AG
E/AndroidRuntime( 2934): java.lang.NumberFormatException: unable to parse '' as integer
E/AndroidRuntime( 2934): at java.lang.Integer.parseInt(Integer.java:412)
E/AndroidRuntime( 2934): at java.lang.Integer.parseInt(Integer.java:382)
E/AndroidRuntime( 2934): at com.sensor.test.MainScreen.startService(MainScreen.java:88)
Perhaps at line 88 in MainScreen.java, your startService method is calling Integer.parseInt with an empty string?
Can you show us the pertinent code?
I don't get why you are putting "".
So to be sure this is not the problem try either this:
intent.putExtra("lp", Integer.parseInt(longPeriod.getText()));
intent.putExtra("gp", Integer.parseInt(gpsPeriod.getText()));
intent.putExtra("sp", Integer.parseInt(snrPeriod.getText()));
or
String lp = longPeriod.getText();
String gp = gpsPeriod.getText();
String sp = snrPeriod.getText();
intent.putExtra("lp", Integer.parseInt(lp));
intent.putExtra("gp", Integer.parseInt(gp));
intent.putExtra("sp", Integer.parseInt(sp));
The second way is better for debugging... so you can see what is actually happening.
model : zt180
firmware : android 2.1-update1-20101030
kernel : 2.6.32.9 usbandroid #1608
build number zt180-eng 2.1-update1 20101030
google maps : 4.5.1
Various crashes occur when embedding the google maps component into an android application. I'm connecting to a router via Wi-Fi for internet access. The stand-alone google maps app seems to work fine. To re-produce, start the maps app and begin scrolling around.
Will fail within a couple of minutes, occasionally on start-up (in setContentView). Most of the errors are when drawing tiles in google code. Sometimes just an Android SEGV.
NOTE : I've tested the same app on the Android developer phone 2 (os 1.6), and it works fine.
My android app is as follows:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="043yBg1m9IiFNKXIhN5LsdeNndw2k7yrw4Ja3xQ"/>
</RelativeLayout>
import com.google.android.maps.MapActivity;
import android.os.Bundle;
public class Maps extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
protected boolean isRouteDisplayed() { return false; }
}
=========================
W/MapActivity( 2745): Recycling dispatcher com.google.googlenav.datarequest.DataRequestDispatcher#45ebcd30
V/MapActivity( 2745): Recycling map object.
I/ActivityManager( 2010): Displayed activity com.brta.android.lite/.Maps: 720 ms (total 720 ms)
I/MapActivity( 2745): Handling network change notification:CONNECTED
E/MapActivity( 2745): Couldn't get connection factory client
D/AndroidRuntime( 2745): Shutting down VM
W/dalvikvm( 2745): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 2745): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 2745): java.lang.IncompatibleClassChangeError: interface not implemented
E/AndroidRuntime( 2745): at com.google.googlenav.map.Map.checkPaintTimeExceeded(Unknown Source)
E/AndroidRuntime( 2745): at com.google.googlenav.map.Map.drawMapBackground(Unknown Source)
E/AndroidRuntime( 2745): at com.google.googlenav.map.Map.drawMap(Unknown Source)
E/AndroidRuntime( 2745): at com.google.android.maps.MapView.drawMap(MapView.java:1048)
E/AndroidRuntime( 2745): at com.google.android.maps.MapView.onDraw(MapView.java:486)
<snip>
I/Process ( 2745): Sending signal. PID: 2745 SIG: 9
I/ActivityManager( 2010): Process com.brta.android.lite (pid 2745) has died.
I/WindowManager( 2010): WIN DEATH: Window{46112878 com.brta.android.lite/com.brta.android.lite.Maps paused=false}
I/UsageStats( 2010): Unexpected resume of org.adw.launcher while already resumed in com.brta.android.lite`
======================================================================
I/MapActivity( 2863): Handling network change notification:CONNECTED
E/MapActivity( 2863): Couldn't get connection factory client
D/dalvikvm( 2863): GC freed 8114 objects / 577376 bytes in 86ms
D/dalvikvm( 2863): GC freed 685 objects / 444384 bytes in 85ms
D/dalvikvm( 2863): GC freed 3458 objects / 259456 bytes in 79ms
I/ActivityManager( 2010): Displayed activity com.brta.android.lite/.Maps: 4407 ms (total 4407 ms)
D/AndroidRuntime( 2863): Shutting down VM
W/dalvikvm( 2863): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 2863): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 2863): java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
E/AndroidRuntime( 2863): at java.util.Vector.elementAt(Vector.java:331)
E/AndroidRuntime( 2863): at com.google.googlenav.map.Map.drawTile(Unknown Source)
E/AndroidRuntime( 2863): at com.google.googlenav.map.Map.drawMapBackground(Unknown Source)
E/AndroidRuntime( 2863): at com.google.googlenav.map.Map.drawMap(Unknown Source)
E/AndroidRuntime( 2863): at com.google.android.maps.MapView.drawMap(MapView.java:1048)
E/AndroidRuntime( 2863): at com.google.android.maps.MapView.onDraw(MapView.java:486)
E/AndroidRuntime( 2863): at android.view.View.draw(View.java:6535)
E/AndroidRuntime( 2863): at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
E/AndroidRuntime( 2863): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
<snip>
E/AndroidRuntime( 2863): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 2010): Sending signal. PID: 2863 SIG: 3
I/dalvikvm( 2863): threadid=7: reacting to signal 3
I/dalvikvm( 2863): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 2863): Sending signal. PID: 2863 SIG: 9
I/WindowManager( 2010): WIN DEATH: Window{460ac708 com.brta.android.lite/com.brta.android.lite.Maps paused=false}
I/ActivityManager( 2010): Process com.brta.android.lite (pid 2863) has died.
I/UsageStats( 2010): Unexpected resume of org.adw.launcher while already resumed in com.brta.android.lite
W/InputManagerService( 2010): Got RemoteException sending setActive(false) notification to pid 2863 uid 10046
Basically, lots of bad things start happening...
The ZT-180 does not have Google Maps, AFAIK.