I have made made 2 xml files that have identical widgets. First file (main) the widgets are arranged in a Relative layout and the second (testgrid2) the widgets are in a TableLayout. The first xml file works fine and app runs. The second xml file I created so I can test before I replace it with the original (main). when I test the second (testgrids)it crashes but I cannot understand the log cat errors it is generating.
The only changes I make to test is in the set Content view.
setContentView(R.layout.main);
and testing
setContentView(R.layout.testgrid2);
Logcat
01-05 13:14:38.790: D/dalvikvm(8152): GC_FOR_ALLOC freed 63K, 1% free 8906K/8992K, paused 16ms, total 16ms
01-05 13:14:38.790: I/dalvikvm-heap(8152): Grow heap (frag case) to 9.428MB for 746512-byte allocation
01-05 13:14:38.810: D/dalvikvm(8152): GC_FOR_ALLOC freed <1K, 1% free 9635K/9724K, paused 15ms, total 15ms
01-05 13:14:38.830: D/dalvikvm(8152): GC_FOR_ALLOC freed <1K, 1% free 9635K/9724K, paused 11ms, total 11ms
01-05 13:14:38.840: I/dalvikvm-heap(8152): Grow heap (frag case) to 12.276MB for 2986000-byte allocation
01-05 13:14:38.850: D/dalvikvm(8152): GC_FOR_ALLOC freed 0K, 1% free 12551K/12644K, paused 11ms, total 11ms
01-05 13:14:38.931: D/TAG(8152): Size Pre 600
01-05 13:14:38.941: D/TAG(8152): File SET 600
01-05 13:14:38.941: D/TAG(8152): BT true
01-05 13:14:38.941: D/TAG(8152): CON true
01-05 13:14:38.941: W/BluetoothAdapter(8152): getBluetoothService() called with no BluetoothManagerCallback
01-05 13:14:38.941: D/BluetoothSocket(8152): connect(), SocketState: INIT, mPfd: {ParcelFileDescriptor: FileDescriptor[41]}
01-05 13:14:39.411: D/AndroidRuntime(8152): Shutting down VM
01-05 13:14:39.411: W/dalvikvm(8152): threadid=1: thread exiting with uncaught exception (group=0x4159a700)
01-05 13:14:39.421: E/AndroidRuntime(8152): FATAL EXCEPTION: main
01-05 13:14:39.421: E/AndroidRuntime(8152): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.simplergb/com.example.simplergb.SimpleRGB_Main}: java.lang.NullPointerException
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.os.Handler.dispatchMessage(Handler.java:99)
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.os.Looper.loop(Looper.java:137)
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.app.ActivityThread.main(ActivityThread.java:5103)
01-05 13:14:39.421: E/AndroidRuntime(8152): at java.lang.reflect.Method.invokeNative(Native Method)
01-05 13:14:39.421: E/AndroidRuntime(8152): at java.lang.reflect.Method.invoke(Method.java:525)
01-05 13:14:39.421: E/AndroidRuntime(8152): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
01-05 13:14:39.421: E/AndroidRuntime(8152): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-05 13:14:39.421: E/AndroidRuntime(8152): at dalvik.system.NativeStart.main(Native Method)
01-05 13:14:39.421: E/AndroidRuntime(8152): Caused by: java.lang.NullPointerException
01-05 13:14:39.421: E/AndroidRuntime(8152): at com.example.simplergb.SimpleRGB_Main.onCreate(SimpleRGB_Main.java:1429)
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.app.Activity.performCreate(Activity.java:5133)
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
01-05 13:14:39.421: E/AndroidRuntime(8152): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
01-05 13:14:39.421: E/AndroidRuntime(8152): ... 11 more
Here:
Caused by: java.lang.NullPointerException
at com.example.simplergb.SimpleRGB_Main.onCreate(SimpleRGB_Main.java:1429)
So fix your NPE in SimpleRGB_Main.java line 1429
Related
I downloaded a library called Android Maps Extensions from Github.
I can run the demo of this library in debugging mode, on my Samsung Note (GT-N7000) which runs Android 4.0.4.
If I click a button inside app, the app will stop and the screen will become black and after several seconds, and a dialog appears saying:
Unfortunately, Android Maps Extensions has stopped.
I am not sure what is happening. The logcat output can be seen below:
01-05 01:09:17.118: I/Process(24896): Sending signal. PID: 24896 SIG: 9
01-05 01:26:43.328: D/CLIPBOARD(27226): Hide Clipboard dialog at Starting input: finished by someone else... !
01-05 01:27:09.043: D/dalvikvm(27226): GC_CONCURRENT freed 56K, 2% free 14452K/14663K, paused 2ms+3ms
01-05 01:27:09.053: W/GooglePlayServicesUtil(27226): Certificate is not yet valid.
01-05 01:27:09.053: W/GooglePlayServicesUtil(27226): Google Play Store signature invalid.
01-05 01:27:09.053: W/GooglePlayServicesUtil(27226): Certificate is not yet valid.
01-05 01:27:09.053: W/GooglePlayServicesUtil(27226): Google Play Store signature invalid.
01-05 01:27:09.058: W/GooglePlayServicesUtil(27226): Certificate is not yet valid.
01-05 01:27:09.058: W/GooglePlayServicesUtil(27226): Google Play Store signature invalid.
01-05 01:27:09.058: W/GooglePlayServicesUtil(27226): Certificate is not yet valid.
01-05 01:27:09.058: W/GooglePlayServicesUtil(27226): Google Play Store signature invalid.
01-05 01:27:09.063: W/GooglePlayServicesUtil(27226): Certificate is not yet valid.
01-05 01:27:09.063: W/GooglePlayServicesUtil(27226): Google Play Store signature invalid.
01-05 01:27:09.078: W/GooglePlayServicesUtil(27226): Certificate is not yet valid.
01-05 01:27:09.078: W/GooglePlayServicesUtil(27226): Google Play Store signature invalid.
01-05 01:27:09.078: D/AndroidRuntime(27226): Shutting down VM
01-05 01:27:09.078: W/dalvikvm(27226): threadid=1: thread exiting with uncaught exception (group=0x40c4f1f8)
01-05 01:27:09.083: E/AndroidRuntime(27226): FATAL EXCEPTION: main
01-05 01:27:09.083: E/AndroidRuntime(27226): java.lang.RuntimeException: Unable to start activity ComponentInfo{pl.mg6.android.maps.extensions.demo/pl.mg6.android.maps.extensions.demo.DemoActivity}: java.lang.NullPointerException
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.os.Handler.dispatchMessage(Handler.java:99)
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.os.Looper.loop(Looper.java:137)
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.app.ActivityThread.main(ActivityThread.java:4511)
01-05 01:27:09.083: E/AndroidRuntime(27226): at java.lang.reflect.Method.invokeNative(Native Method)
01-05 01:27:09.083: E/AndroidRuntime(27226): at java.lang.reflect.Method.invoke(Method.java:511)
01-05 01:27:09.083: E/AndroidRuntime(27226): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
01-05 01:27:09.083: E/AndroidRuntime(27226): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
01-05 01:27:09.083: E/AndroidRuntime(27226): at dalvik.system.NativeStart.main(Native Method)
01-05 01:27:09.083: E/AndroidRuntime(27226): Caused by: java.lang.NullPointerException
01-05 01:27:09.083: E/AndroidRuntime(27226): at pl.mg6.android.maps.extensions.demo.DemoActivity.addCircles(DemoActivity.java:220)
01-05 01:27:09.083: E/AndroidRuntime(27226): at pl.mg6.android.maps.extensions.demo.DemoActivity.onCreate(DemoActivity.java:84)
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.app.Activity.performCreate(Activity.java:4470)
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
01-05 01:27:09.083: E/AndroidRuntime(27226): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-05 01:27:09.083: E/AndroidRuntime(27226): ... 11 more
Ok below here is what my log generates when I try to run my application . The application fails unexpectedly and does not even start
09-02 04:28:51.856: D/dalvikvm(781): GC_FOR_ALLOC freed 66K, 7% free 2542K/2728K, paused 51ms, total 66ms
09-02 04:28:51.866: I/dalvikvm-heap(781): Grow heap (frag case) to 3.181MB for 614500-byte allocation
09-02 04:28:51.936: D/dalvikvm(781): GC_FOR_ALLOC freed <1K, 6% free 3142K/3332K, paused 67ms, total 67ms
09-02 04:28:52.406: W/SoundPool(781): sample 1 not READY
09-02 04:28:53.116: D/gralloc_goldfish(781): Emulator without GPU emulation detected.
09-02 04:28:53.376: I/Choreographer(781): Skipped 33 frames! The application may be doing too much work on its main thread.
09-02 04:29:22.606: E/AudioTrack(781): Could not get audio output for stream type 3
09-02 04:29:22.606: E/SoundPool(781): Error creating AudioTrack
09-02 04:29:22.756: D/dalvikvm(781): GC_FOR_ALLOC freed 30K, 5% free 3523K/3672K, paused 19ms, total 21ms
09-02 04:29:22.756: I/dalvikvm-heap(781): Grow heap (frag case) to 4.159MB for 635812-byte allocation
09-02 04:29:22.856: D/dalvikvm(781): GC_FOR_ALLOC freed 1K, 4% free 4143K/4296K, paused 97ms, total 97ms
09-02 04:29:22.966: I/Choreographer(781): Skipped 91 frames! The application may be doing too much work on its main thread.
09-02 04:29:23.206: I/Choreographer(781): Skipped 55 frames! The application may be doing too much work on its main thread.
09-02 04:29:23.375: I/Choreographer(781): Skipped 35 frames! The application may be doing too much work on its main thread.
09-02 04:29:23.776: I/Choreographer(781): Skipped 79 frames! The application may be doing too much work on its main thread.
09-02 04:29:28.016: D/dalvikvm(781): GC_FOR_ALLOC freed 108K, 5% free 4436K/4664K, paused 111ms, total 133ms
09-02 04:29:28.045: I/dalvikvm-heap(781): Grow heap (frag case) to 5.030MB for 614500-byte allocation
09-02 04:29:28.096: D/dalvikvm(781): GC_FOR_ALLOC freed 1K, 5% free 5034K/5268K, paused 55ms, total 56ms
09-02 04:29:28.235: W/SoundPool(781): sample 1 not READY
09-02 04:29:28.785: I/Choreographer(781): Skipped 50 frames! The application may be doing too much work on its main thread.
09-02 04:29:31.626: E/AudioTrack(781): Could not get audio output for stream type 3
09-02 04:29:31.626: E/SoundPool(781): Error creating AudioTrack
09-02 04:29:31.746: E/SlaveBlueTooth(781): +++ ON CREATE +++
09-02 04:29:31.766: W/System.err(781): java.io.IOException: open failed: EROFS (Read-only file system)
09-02 04:29:31.776: W/System.err(781): at java.io.File.createNewFile(File.java:948)
09-02 04:29:31.785: W/System.err(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:118)
09-02 04:29:31.796: W/System.err(781): at android.app.Activity.performCreate(Activity.java:5133)
09-02 04:29:31.796: W/System.err(781): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-02 04:29:31.796: W/System.err(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-02 04:29:31.816: W/System.err(781): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-02 04:29:31.816: W/System.err(781): at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-02 04:29:31.816: W/System.err(781): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-02 04:29:31.826: W/System.err(781): at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 04:29:31.826: W/System.err(781): at android.os.Looper.loop(Looper.java:137)
09-02 04:29:31.826: W/System.err(781): at android.app.ActivityThread.main(ActivityThread.java:5103)
09-02 04:29:31.836: W/System.err(781): at java.lang.reflect.Method.invokeNative(Native Method)
09-02 04:29:31.836: W/System.err(781): at java.lang.reflect.Method.invoke(Method.java:525)
09-02 04:29:31.846: W/System.err(781): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-02 04:29:31.846: W/System.err(781): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-02 04:29:31.856: W/System.err(781): at dalvik.system.NativeStart.main(Native Method)
09-02 04:29:31.856: W/System.err(781): Caused by: libcore.io.ErrnoException: open failed: EROFS (Read-only file system)
09-02 04:29:31.876: W/System.err(781): at libcore.io.Posix.open(Native Method)
09-02 04:29:31.886: W/System.err(781): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
09-02 04:29:31.886: W/System.err(781): at java.io.File.createNewFile(File.java:941)
09-02 04:29:31.896: W/System.err(781): ... 15 more
09-02 04:29:32.016: D/AndroidRuntime(781): Shutting down VM
09-02 04:29:32.016: W/dalvikvm(781): threadid=1: thread exiting with uncaught exception (group=0x41465700)
09-02 04:29:32.066: E/AndroidRuntime(781): FATAL EXCEPTION: main
09-02 04:29:32.066: E/AndroidRuntime(781): java.lang.RuntimeException: Unable to start activity ComponentInfo{hellog.diwesh.NugaBest/helog.diwesh.NugaBest.BTSmartSlavemodule}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.os.Looper.loop(Looper.java:137)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.main(ActivityThread.java:5103)
09-02 04:29:32.066: E/AndroidRuntime(781): at java.lang.reflect.Method.invokeNative(Native Method)
09-02 04:29:32.066: E/AndroidRuntime(781): at java.lang.reflect.Method.invoke(Method.java:525)
09-02 04:29:32.066: E/AndroidRuntime(781): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-02 04:29:32.066: E/AndroidRuntime(781): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-02 04:29:32.066: E/AndroidRuntime(781): at dalvik.system.NativeStart.main(Native Method)
09-02 04:29:32.066: E/AndroidRuntime(781): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
09-02 04:29:32.066: E/AndroidRuntime(781): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:226)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.Activity.requestWindowFeature(Activity.java:3264)
09-02 04:29:32.066: E/AndroidRuntime(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:141)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.Activity.performCreate(Activity.java:5133)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-02 04:29:32.066: E/AndroidRuntime(781): ... 11 more
This is the error from your LogCat :
FATAL EXCEPTION: main
09-02 04:29:32.066: E/AndroidRuntime(781): java.lang.RuntimeException: Unable to start activity ComponentInfo{hellog.diwesh.NugaBest/helog.diwesh.NugaBest.BTSmartSlavemodule}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
Multiple issues here:
09-02 04:29:31.766: W/System.err(781): java.io.IOException: open failed: EROFS (Read-only file system)
09-02 04:29:31.776: W/System.err(781): at java.io.File.createNewFile(File.java:948)
09-02 04:29:31.785: W/System.err(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:118)
In BTSmartSlavemodule.java line 118 you're trying to create a new file on a read-only file system.
09-02 04:29:32.066: E/AndroidRuntime(781): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
09-02 04:29:32.066: E/AndroidRuntime(781): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:226)
09-02 04:29:32.066: E/AndroidRuntime(781): at android.app.Activity.requestWindowFeature(Activity.java:3264)
09-02 04:29:32.066: E/AndroidRuntime(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:141)
On line 141 of the same file you're trying to call requestWindowFeature() after calling setContentView(). You need to set window features before setContentView().
You call requestFeature() not in right place... try to call this method before setContentView(R.layout.activity)
The cause of this error is :
09-02 04:29:32.066: E/AndroidRuntime(781): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
And this cause happened at :
09-02 04:29:31.785: W/System.err(781): at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:118)
Where you put code .requestWindowFeature(). To avoid this cause you must put this code before setContentView(R.layout.your_layout);
I think you are trying to create file on sdcard but you don't have specified permission to write external storage in manifest file
Add this line to manifest.xml file
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
My app was working well but suddenly in emulator my app is crashed but i didn't made any changes in the code
for reference
04-12 09:41:05.079: W/ActivityManager(879): Activity destroy timeout for ActivityRecord{b5aaca48 com.bostonmediatech.gayatrimantra/.Main}
04-12 09:41:05.079: W/ActivityManager(879): Activity destroy timeout for ActivityRecord{b5c6ea90 com.bostonmediatech.gayatrimantra/.Home}
04-12 09:41:06.449: I/ActivityManager(879): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.bostonmediatech.gayatrimantra/.Main} from pid 1008
04-12 09:41:06.449: W/WindowManager(879): Failure taking screenshot for (180x300) to layer 21005
04-12 09:41:06.459: D/dalvikvm(1466): Not late-enabling CheckJNI (already on)
04-12 09:41:06.459: D/dalvikvm(786): GC_EXPLICIT freed 35K, 4% free 8982K/9283K, paused 0ms+4ms
04-12 09:41:06.470: D/dalvikvm(786): GC_EXPLICIT freed <1K, 4% free 8982K/9283K, paused 1ms+0ms
04-12 09:41:06.470: D/dalvikvm(786): GC_EXPLICIT freed <1K, 4% free 8982K/9283K, paused 0ms+0ms
04-12 09:41:06.470: I/ActivityManager(879): Start proc com.bostonmediatech.gayatrimantra for activity com.bostonmediatech.gayatrimantra/.Main: pid=1466 uid=10039 gids={}
04-12 09:41:06.479: W/NetworkManagementSocketTagger(879): setKernelCountSet(10039, 1) failed with errno -2
04-12 09:41:06.479: D/dalvikvm(1466): GC_FOR_ALLOC freed 67K, 3% free 9021K/9283K, paused 0ms
04-12 09:41:06.479: I/dalvikvm-heap(1466): Grow heap (frag case) to 9.450MB for 614412-byte allocation
04-12 09:41:06.509: D/dalvikvm(1466): GC_CONCURRENT freed 0K, 4% free 9621K/9927K, paused 0ms+1ms
04-12 09:41:06.571: D/gralloc_goldfish(1466): Emulator without GPU emulation detected.
04-12 09:41:06.619: I/ActivityManager(879): Displayed com.bostonmediatech.gayatrimantra/.Main: +170ms (total +12s176ms)
04-12 09:41:06.629: W/InputManagerService(879): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#b5c2dfa0 (uid=10012 pid=1008)
04-12 09:41:07.207: W/NetworkManagementSocketTagger(879): setKernelCountSet(10012, 0) failed with errno -2
04-12 09:41:07.789: W/ThrottleService(879): unable to find stats for iface rmnet0
04-12 09:41:07.789: E/ThrottleService(879): Error reading data file
04-12 09:41:08.689: I/ActivityManager(879): START {act=com.bostonmediatech.gayatrimantra.CLEARSCREEN cmp=com.bostonmediatech.gayatrimantra/.Home} from pid 1466
04-12 09:41:08.689: W/WindowManager(879): Failure taking screenshot for (180x300) to layer 21010
04-12 09:41:08.699: D/dalvikvm(1466): GC_FOR_ALLOC freed 4K, 3% free 9640K/9927K, paused 3ms
04-12 09:41:08.699: I/dalvikvm-heap(1466): Grow heap (frag case) to 10.054MB for 614412-byte allocation
04-12 09:41:08.719: D/dalvikvm(1466): GC_CONCURRENT freed <1K, 4% free 10240K/10567K, paused 0ms+0ms
04-12 09:41:08.731: D/AndroidRuntime(1466): Shutting down VM
04-12 09:41:08.731: W/dalvikvm(1466): threadid=1: thread exiting with uncaught exception (group=0xb508f180)
04-12 09:41:08.731: E/AndroidRuntime(1466): FATAL EXCEPTION: main
04-12 09:41:08.731: E/AndroidRuntime(1466): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bostonmediatech.gayatrimantra/com.bostonmediatech.gayatrimantra.Home}: android.view.InflateException: Binary XML file line #8: Error inflating class android.widget.ListView
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.app.ActivityThread.access$600(ActivityThread.java:123)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.os.Handler.dispatchMessage(Handler.java:99)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.os.Looper.loop(Looper.java:137)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-12 09:41:08.731: E/AndroidRuntime(1466): at java.lang.reflect.Method.invokeNative(Native Method)
04-12 09:41:08.731: E/AndroidRuntime(1466): at java.lang.reflect.Method.invoke(Method.java:511)
04-12 09:41:08.731: E/AndroidRuntime(1466): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-12 09:41:08.731: E/AndroidRuntime(1466): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-12 09:41:08.731: E/AndroidRuntime(1466): at dalvik.system.NativeStart.main(Native Method)
04-12 09:41:08.731: E/AndroidRuntime(1466): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class android.widget.ListView
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
04-12 09:41:08.731: E/AndroidRuntime(1466): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
04-12 09:41:08.731: E/AndroidRuntime(1466): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.app.Activity.setContentView(Activity.java:1835)
04-12 09:41:08.731: E/AndroidRuntime(1466): at com.bostonmediatech.gayatrimantra.Home.onCreate(Home.java:26)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.app.Activity.performCreate(Activity.java:4465)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
04-12 09:41:08.731: E/AndroidRuntime(1466): ... 11 more
04-12 09:41:08.731: E/AndroidRuntime(1466): Caused by: java.lang.reflect.InvocationTargetException
04-12 09:41:08.731: E/AndroidRuntime(1466): at java.lang.reflect.Constructor.constructNative(Native Method)
04-12 09:41:08.731: E/AndroidRuntime(1466): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
04-12 09:41:08.731: E/AndroidRuntime(1466): ... 24 more
04-12 09:41:08.731: E/AndroidRuntime(1466): Caused by: java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.widget.AdapterView.setOnClickListener(AdapterView.java:761)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.View.<init>(View.java:3018)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.view.ViewGroup.<init>(ViewGroup.java:385)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.widget.AdapterView.<init>(AdapterView.java:234)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.widget.AbsListView.<init>(AbsListView.java:734)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.widget.ListView.<init>(ListView.java:141)
04-12 09:41:08.731: E/AndroidRuntime(1466): at android.widget.ListView.<init>(ListView.java:137)
04-12 09:41:08.731: E/AndroidRuntime(1466): ... 27 more
04-12 09:41:08.731: W/ActivityManager(879): Force finishing activity com.bostonmediatech.gayatrimantra/.Home
04-12 09:41:08.759: D/dalvikvm(879): GC_CONCURRENT freed 347K, 12% free 11209K/12615K, paused 0ms+1ms
04-12 09:41:09.199: I/Process(879): Sending signal. PID: 1466 SIG: 3
04-12 09:41:09.199: I/dalvikvm(1466): threadid=3: reacting to signal 3
04-12 09:41:09.199: I/dalvikvm(1466): Wrote stack traces to '/data/anr/traces.txt'
04-12 09:41:09.239: W/ActivityManager(879): Activity pause timeout for ActivityRecord{b5c736d0 com.bostonmediatech.gayatrimantra/.Home}
04-12 09:41:09.239: I/Process(879): Sending signal. PID: 1466 SIG: 3
04-12 09:41:09.239: I/dalvikvm(1466): threadid=3: reacting to signal 3
04-12 09:41:09.239: I/dalvikvm(1466): Wrote stack traces to '/data/anr/traces.txt'
04-12 09:41:09.249: W/NetworkManagementSocketTagger(879): setKernelCountSet(10012, 1) failed with errno -2
04-12 09:41:09.301: W/NetworkManagementSocketTagger(879): setKernelCountSet(10039, 0) failed with errno -2
04-12 09:41:09.323: D/dalvikvm(1008): GC_FOR_ALLOC freed 2466K, 29% free 17654K/24647K, paused 5ms
04-12 09:41:09.499: D/dalvikvm(1008): GC_CONCURRENT freed 1766K, 28% free 17895K/24647K, paused 0ms+0ms
04-12 09:41:09.529: D/dalvikvm(1008): GC_FOR_ALLOC freed 1568K, 26% free 18277K/24647K, paused 17ms
04-12 09:41:09.531: D/dalvikvm(1008): GC_CONCURRENT freed 310K, 26% free 18312K/24647K, paused 1ms+1ms
04-12 09:41:10.199: I/Process(1466): Sending signal. PID: 1466 SIG: 9
04-12 09:41:10.199: I/WindowManager(879): WIN DEATH: Window{b5be9ae0 com.bostonmediatech.gayatrimantra/com.bostonmediatech.gayatrimantra.Main paused=true}
04-12 09:41:10.199: I/ActivityManager(879): Process com.bostonmediatech.gayatrimantra (pid 1466) has died.
04-12 09:41:10.269: W/InputManagerService(879): Got RemoteException sending setActive(false) notification to pid 1466 uid 10039
04-12 09:41:19.301: W/ActivityManager(879): Activity destroy timeout for ActivityRecord{b5c0f358 com.bostonmediatech.gayatrimantra/.Main}
04-12 09:41:19.301: W/ActivityManager(879): Activity destroy timeout for ActivityRecord{b5c736d0 com.bostonmediatech.gayatrimantra/.Home}
java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead
This is the exception, occured because you have set onClickListener for ListView but you should set onItemClickListener.
And also post your code to identify other issues.
And also make sure that it is of AdapterView.OnItemClickListener()
Remove onClick or onItemClick from layout
My app runs fine on phone crashes on start up on tablets. It runs fine on my phone running 2.3.7 and my sister's phone running 4.0.3. But it crashes on my 10.1" tablet running 4.0.4. I tried it on a Nexus 7 AVD running 4.2 and it crashes there too.
This is the Log
12-26 23:11:55.350: E/Trace(845): error opening trace file: No such file or directory (2)
12-26 23:11:55.350: W/Trace(845): Unexpected value from nativeGetEnabledTags: 0
12-26 23:11:55.350: W/Trace(845): Unexpected value from nativeGetEnabledTags: 0
12-26 23:11:55.350: W/Trace(845): Unexpected value from nativeGetEnabledTags: 0
12-26 23:11:55.560: W/Trace(845): Unexpected value from nativeGetEnabledTags: 0
12-26 23:11:55.560: W/Trace(845): Unexpected value from nativeGetEnabledTags: 0
12-26 23:11:56.741: D/dalvikvm(845): GC_CONCURRENT freed 217K, 12% free 2635K/2984K, paused 70ms+14ms, total 139ms
12-26 23:11:56.751: D/dalvikvm(845): WAIT_FOR_CONCURRENT_GC blocked 4ms
12-26 23:11:56.813: D/dalvikvm(845): GC_FOR_ALLOC freed 68K, 14% free 2666K/3084K, paused 52ms, total 53ms
12-26 23:11:56.821: I/dalvikvm-heap(845): Grow heap (frag case) to 3.333MB for 635812-byte allocation
12-26 23:11:56.881: D/dalvikvm(845): GC_FOR_ALLOC freed <1K, 12% free 3286K/3708K, paused 57ms, total 57ms
12-26 23:11:56.931: D/dalvikvm(845): GC_CONCURRENT freed <1K, 12% free 3287K/3708K, paused 9ms+3ms, total 52ms
12-26 23:11:56.931: D/dalvikvm(845): WAIT_FOR_CONCURRENT_GC blocked 12ms
12-26 23:11:56.931: I/dalvikvm-heap(845): Grow heap (frag case) to 3.811MB for 500416-byte allocation
12-26 23:11:57.011: D/dalvikvm(845): GC_FOR_ALLOC freed <1K, 11% free 3775K/4200K, paused 49ms, total 49ms
12-26 23:11:57.223: D/AndroidRuntime(845): Shutting down VM
12-26 23:11:57.223: W/dalvikvm(845): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
12-26 23:11:57.231: E/AndroidRuntime(845): FATAL EXCEPTION: main
12-26 23:11:57.231: E/AndroidRuntime(845): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.brandsonicinc.brandsonic.web.mobile/com.brandsonicinc.brandsonic.web.mobile.MainActivity}: java.lang.NullPointerException
12-26 23:11:57.231: E/AndroidRuntime(845): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
12-26 23:11:57.231: E/AndroidRuntime(845): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-26 23:11:57.231: E/AndroidRuntime(845): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-26 23:11:57.231: E/AndroidRuntime(845): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
12-26 23:11:57.231: E/AndroidRuntime(845): at android.os.Handler.dispatchMessage(Handler.java:99)
12-26 23:11:57.231: E/AndroidRuntime(845): at android.os.Looper.loop(Looper.java:137)
12-26 23:11:57.231: E/AndroidRuntime(845): at android.app.ActivityThread.main(ActivityThread.java:5039)
12-26 23:11:57.231: E/AndroidRuntime(845): at java.lang.reflect.Method.invokeNative(Native Method)
12-26 23:11:57.231: E/AndroidRuntime(845): at java.lang.reflect.Method.invoke(Method.java:511)
12-26 23:11:57.231: E/AndroidRuntime(845): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-26 23:11:57.231: E/AndroidRuntime(845): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-26 23:11:57.231: E/AndroidRuntime(845): at dalvik.system.NativeStart.main(Native Method)
12-26 23:11:57.231: E/AndroidRuntime(845): Caused by: java.lang.NullPointerException
12-26 23:11:57.231: E/AndroidRuntime(845): at com.brandsonicinc.brandsonic.web.mobile.MainActivity.onCreate(MainActivity.java:84)
12-26 23:11:57.231: E/AndroidRuntime(845): at android.app.Activity.performCreate(Activity.java:5104)
12-26 23:11:57.231: E/AndroidRuntime(845): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
12-26 23:11:57.231: E/AndroidRuntime(845): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
12-26 23:11:57.231: E/AndroidRuntime(845): ... 11 more
12-26 23:12:02.487: W/chromium(845): external/chromium/net/disk_cache/backend_impl.cc:1835: [1226/231202:WARNING:backend_impl.cc(1835)] Destroying invalid entry.
12-26 23:12:02.500: E/chromium(845): external/chromium/net/disk_cache/backend_impl.cc:1107: [1226/231202:ERROR:backend_impl.cc(1107)] Critical error found -8
12-26 23:12:02.820: W/chromium(845): external/chromium/net/disk_cache/storage_block-inl.h:119: [1226/231202:WARNING:storage_block-inl.h(119)] Failed data load.
12-26 23:12:02.820: W/chromium(845): external/chromium/net/disk_cache/storage_block-inl.h:119: [1226/231202:WARNING:storage_block-inl.h(119)] Failed data load.
12-26 23:12:02.840: W/chromium(845): external/chromium/net/disk_cache/storage_block-inl.h:119: [1226/231202:WARNING:storage_block-inl.h(119)] Failed data load.
12-26 23:12:02.881: W/chromium(845): external/chromium/net/disk_cache/storage_block-inl.h:119: [1226/231202:WARNING:storage_block-inl.h(119)] Failed data load.
12-26 23:12:02.966: E/chromium(845): external/chromium/net/disk_cache/entry_impl.cc:904: [1226/231202:ERROR:entry_impl.cc(904)] Failed to save user data
12-26 23:12:02.971: E/chromium(845): external/chromium/net/disk_cache/entry_impl.cc:904: [1226/231202:ERROR:entry_impl.cc(904)] Failed to save user data
12-26 23:12:04.361: I/Process(845): Sending signal. PID: 845 SIG: 9
Please help this is very frustrating. It used to run fine on tablets. Could it have something to do with the layouts?
try to put all your xml files in layout folder and no need to remove it from other if it already there.
If xml files are in folders like layout-sw600dp then the device will fail to load the specified xml file if screen width is less than 600dp. this is just example in your case it may be different
I have read your log, there is a bug on finding directory, have you use some directory method, to retrieve file from a particular location, tablet have internal storage instead of sd card might be problem in that.
But I can better understand if you post the code.
I coded a Dialog that shows up with 2 textviews and 2 buttons.
I googled for that Problem as well but I didn't find anything that mathced my issue.
Here is some Code:
case R.id.open:
openDialog=new Dialog(this);
openDialog.setContentView(R.layout.open_dialog);
openDialog.setTitle(head);
openDialog.setCancelable(true);
Button open_cancel=(Button)findViewById(R.id.open_cancel);
open_cancel.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
openDialog.cancel();
}
});
but I can't show the dialog up with the buttons.
If I call it without these Lines there is no Problem:
Button open_cancel=(Button)findViewById(R.id.open_cancel);
open_cancel.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
openDialog.cancel();
}
});
This is the XML File:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/open_dialog"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
>
<EditText android:id="#+id/open_head"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="ojfpojew ojr pojr"
/>
<EditText android:id="#+id/open_note"
android:layout_width="fill_parent"
android:text="oijpojepojpotjpotejpe ojtpojtpo ewpoj tpojt pp jpojtpoj etpoj poj poj t"
android:layout_height="150dp"
/>
<Button android:id="#+id/open_edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="edit"
/>
<Button android:id="#+id/open_cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="cancel"
/>
</LinearLayout>
I really do not understand why this not works...
here is the error log, if it helps:
01-05 16:43:51.004: D/dalvikvm(2336): GC freed 1010 objects / 70136 bytes in 75ms
01-05 16:43:51.204: D/dalvikvm(2336): GC freed 91 objects / 3664 bytes in 53ms
01-05 16:43:51.494: D/dalvikvm(2336): GC freed 132 objects / 6240 bytes in 62ms
01-05 16:43:51.674: D/dalvikvm(2336): GC freed 58 objects / 2312 bytes in 56ms
01-05 16:43:51.944: D/dalvikvm(2336): GC freed 147 objects / 9128 bytes in 63ms
01-05 16:43:52.383: D/ViewFlipper(2336): updateRunning() mVisible=true, mStarted=false, mUserPresent=true, mRunning=false
01-05 16:44:00.973: D/dalvikvm(2336): GC freed 25495 objects / 1393728 bytes in 88ms
01-05 16:44:02.644: D/dalvikvm(2336): GC freed 45722 objects / 2044568 bytes in 102ms
01-05 16:44:04.424: I/Resources(2336): Loaded time zone names for en in 1591ms.
01-05 16:44:06.834: D/dalvikvm(2336): GC freed 36788 objects / 1674624 bytes in 102ms
01-05 16:44:11.243: D/AndroidRuntime(2336): Shutting down VM
01-05 16:44:11.263: W/dalvikvm(2336): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
01-05 16:44:11.263: E/AndroidRuntime(2336): Uncaught handler: thread main exiting due to uncaught exception
01-05 16:44:11.273: E/AndroidRuntime(2336): java.lang.NullPointerException
01-05 16:44:11.273: E/AndroidRuntime(2336): at producteev.push.Producteev_pushActivity.onContextItemSelected(Producteev_pushActivity.java:247)
01-05 16:44:11.273: E/AndroidRuntime(2336): at android.app.Activity.onMenuItemSelected(Activity.java:2174)
01-05 16:44:11.273: E/AndroidRuntime(2336): at com.android.internal.policy.impl.PhoneWindow$ContextMenuCallback.onMenuItemSelected(PhoneWindow.java:2731)
01-05 16:44:11.273: E/AndroidRuntime(2336): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:139)
01-05 16:44:11.273: E/AndroidRuntime(2336): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
01-05 16:44:11.273: E/AndroidRuntime(2336): at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:129)
01-05 16:44:11.273: E/AndroidRuntime(2336): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:884)
01-05 16:44:11.273: E/AndroidRuntime(2336): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
01-05 16:44:11.273: E/AndroidRuntime(2336): at android.widget.ListView.performItemClick(ListView.java)
01-05 16:44:11.273: E/AndroidRuntime(2336): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1640)
01-05 16:44:11.273: E/AndroidRuntime(2336): at android.os.Handler.handleCallback(Handler.java:587)
01-05 16:44:11.273: E/AndroidRuntime(2336): at android.os.Handler.dispatchMessage(Handler.java:92)
01-05 16:44:11.273: E/AndroidRuntime(2336): at android.os.Looper.loop(Looper.java:123)
01-05 16:44:11.273: E/AndroidRuntime(2336): at android.app.ActivityThread.main(ActivityThread.java:4363)
01-05 16:44:11.273: E/AndroidRuntime(2336): at java.lang.reflect.Method.invokeNative(Native Method)
01-05 16:44:11.273: E/AndroidRuntime(2336): at java.lang.reflect.Method.invoke(Method.java:521)
01-05 16:44:11.273: E/AndroidRuntime(2336): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-05 16:44:11.273: E/AndroidRuntime(2336): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-05 16:44:11.273: E/AndroidRuntime(2336): at dalvik.system.NativeStart.main(Native Method)
01-05 16:44:11.293: I/dalvikvm(2336): threadid=7: reacting to signal 3
01-05 16:44:11.323: I/dalvikvm(2336): Wrote stack trace to '/data/anr/traces.txt'
01-05 16:44:13.383: I/Process(2336): Sending signal. PID: 2336 SIG: 9
Try this,
Button open_cancel=(Button)openDialog.findViewById(R.id.open_cancel);