I'm learning the basics of Android development and I've ran into some issues with setting up the programming environment. Now I've created a new Android Application Project and I'm running it using my phone. When I do, I get an error message on my phone: "Unfortunately, HelloWorld has stopped." and I'm not sure if it's supposed to or not, considering that I've done absolutely nothing to the project files. Here is the LogCat output in its entirety:
03-10 18:34:16.264: D/dalvikvm(2673): Late-enabling CheckJNI
03-10 18:34:16.361: W/dalvikvm(2673): VFY: unable to resolve static field 1559 (ActionBarWindow) in Landroid/support/v7/appcompat/R$styleable;
03-10 18:34:16.361: D/dalvikvm(2673): VFY: replacing opcode 0x62 at 0x0004
03-10 18:34:16.364: D/AndroidRuntime(2673): Shutting down VM
03-10 18:34:16.364: W/dalvikvm(2673): threadid=1: thread exiting with uncaught exception (group=0x416d7d40)
03-10 18:34:16.368: E/AndroidRuntime(2673): FATAL EXCEPTION: main
03-10 18:34:16.368: E/AndroidRuntime(2673): Process: com.example.helloworld, PID: 2673
03-10 18:34:16.368: E/AndroidRuntime(2673): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
03-10 18:34:16.368: E/AndroidRuntime(2673): at com.example.helloworld.MainActivity.onCreate(MainActivity.java:18)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.Activity.performCreate(Activity.java:5248)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread.access$800(ActivityThread.java:139)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.os.Handler.dispatchMessage(Handler.java:102)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.os.Looper.loop(Looper.java:136)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread.main(ActivityThread.java:5102)
03-10 18:34:16.368: E/AndroidRuntime(2673): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 18:34:16.368: E/AndroidRuntime(2673): at java.lang.reflect.Method.invoke(Method.java:515)
03-10 18:34:16.368: E/AndroidRuntime(2673): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-10 18:34:16.368: E/AndroidRuntime(2673): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-10 18:34:16.368: E/AndroidRuntime(2673): at dalvik.system.NativeStart.main(Native Method)
03-10 18:34:18.259: I/Process(2673): Sending signal. PID: 2673 SIG: 9
03-10 18:36:57.062: W/dalvikvm(2984): VFY: unable to resolve static field 1559 (ActionBarWindow) in Landroid/support/v7/appcompat/R$styleable;
03-10 18:36:57.063: D/dalvikvm(2984): VFY: replacing opcode 0x62 at 0x0004
03-10 18:36:57.064: D/AndroidRuntime(2984): Shutting down VM
03-10 18:36:57.064: W/dalvikvm(2984): threadid=1: thread exiting with uncaught exception (group=0x416d7d40)
03-10 18:36:57.066: E/AndroidRuntime(2984): FATAL EXCEPTION: main
03-10 18:36:57.066: E/AndroidRuntime(2984): Process: com.example.helloworld, PID: 2984
03-10 18:36:57.066: E/AndroidRuntime(2984): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
03-10 18:36:57.066: E/AndroidRuntime(2984): at com.example.helloworld.MainActivity.onCreate(MainActivity.java:18)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.Activity.performCreate(Activity.java:5248)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread.access$800(ActivityThread.java:139)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.os.Handler.dispatchMessage(Handler.java:102)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.os.Looper.loop(Looper.java:136)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread.main(ActivityThread.java:5102)
03-10 18:36:57.066: E/AndroidRuntime(2984): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 18:36:57.066: E/AndroidRuntime(2984): at java.lang.reflect.Method.invoke(Method.java:515)
03-10 18:36:57.066: E/AndroidRuntime(2984): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-10 18:36:57.066: E/AndroidRuntime(2984): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-10 18:3
6:57.066: E/AndroidRuntime(2984): at dalvik.system.NativeStart.main(Native Method)
So, is this normal behavior or have I done something wrong while setting up Eclipse, etc?
It looks like the Android compatibility library is not correctly configured for your project. In Eclipse, right click on the project in the package explorer and select Android Tools > Add Support Library. After setting up the support library, clean and rebuild your project.
This is normal behavior when reporting an error with your application.
I am developing an android application to show all call logs in the list and when user taps on any call log, i need to open native app's call details screen for that tapped call log.
I have tried following code snippet and it works fine in Emulator (Pure android OS.)
Intent mDetailsIntent = new Intent(Intent.ACTION_VIEW); mDetailsIntent.setType(android.provider.CallLog.Calls.CONTENT_TYPE);
Uri mUri = Uri.withAppendedPath(android.provider.CallLog.Calls.CONTENT_URI, String.valueOf(mCallLog.getId()));
mDetailsIntent.setData(mUri);
startActivity(mDetailsIntent);
But when I run it on Samsung device, it shown the last recent call log's details screen each time regardless of call log id.
And for HTC devices, it throws ActivityNotFoundException.
Following log cat is for HTC device.
**03-10 14:19:00.772: D/LogsFragment(20947): Call log details uri==>content://call_log/calls/62
03-10 14:19:00.782: W/System.err(20947): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://call_log/calls/62 }
03-10 14:19:00.792: W/System.err(20947): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1638)
03-10 14:19:00.792: W/System.err(20947): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1510)
03-10 14:19:00.792: W/System.err(20947): at android.app.Activity.startActivityForResult(Activity.java:3258)
03-10 14:19:00.792: W/System.err(20947): at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:833)
03-10 14:19:00.792: W/System.err(20947): at android.support.v4.app.Fragment.startActivity(Fragment.java:856)
03-10 14:19:00.792: W/System.err(20947): at com.cwiker.fragments.LogsFragment.onItemClick(LogsFragment.java:219)
03-10 14:19:00.792: W/System.err(20947): at android.widget.AdapterView.performItemClick(AdapterView.java:292)
03-10 14:19:00.792: W/System.err(20947): at android.widget.AbsListView.performItemClick(AbsListView.java:1099)
03-10 14:19:00.792: W/System.err(20947): at android.widget.ListView.performItemClick(ListView.java:4758)
03-10 14:19:00.792: W/System.err(20947): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2556)
03-10 14:19:00.792: W/System.err(20947): at android.widget.AbsListView$1.run(AbsListView.java:3223)
03-10 14:19:00.792: W/System.err(20947): at android.os.Handler.handleCallback(Handler.java:608)
03-10 14:19:00.802: W/System.err(20947): at android.os.Handler.dispatchMessage(Handler.java:92)
03-10 14:19:00.802: W/System.err(20947): at android.os.Looper.loop(Looper.java:156)
03-10 14:19:00.802: W/System.err(20947): at android.app.ActivityThread.main(ActivityThread.java:4987)
03-10 14:19:00.802: W/System.err(20947): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 14:19:00.802: W/System.err(20947): at java.lang.reflect.Method.invoke(Method.java:511)
03-10 14:19:00.802: W/System.err(20947): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-10 14:19:00.802: W/System.err(20947): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-10 14:19:00.802: W/System.err(20947): at dalvik.system.NativeStart.main(Native Method)**
Please help me to solve this problem.
Thanks.
I reference and imitates the Android Sample at android-sdks\samples\android-18\legacy\BluetoothLeGatt to developing an application.
I can scan the device.
But the app crash when I try to connect the bluetooth device.
This is the log that the app crash when I try to connect the bluetooth device.
D/BtGatt.btif( 2443): btif_gattc_scan
D/BtGatt.btif( 2443): btgattc_handle_event: Event 1003
D/BtGatt.GattService( 2443): unregisterClient() - clientIf=4
D/BtGatt.btif( 2443): btif_gattc_unregister_app
D/BtGatt.btif( 2443): btgattc_handle_event: Event 1001
D/BtGatt.btif( 2443): btif_gattc_upstreams_evt: Event 1
I/ActivityManager( 1766): START u0 {cmp=com.example.prevent_the_lost/.DeviceControl (has extras)} from pid 5526
W/WindowManager( 1766): Screenshot failure taking screenshot for (166x125) to layer 21015
I/bt-hci ( 2443): BLE HCI(id=62) event = 0x02)
I/bt-hci ( 2443): btu_ble_process_adv_pkt
D/BluetoothAdapter( 5526): stopLeScan()
I/bt-hci ( 2443): BLE HCI(id=62) event = 0x02)
I/bt-hci ( 2443): btu_ble_process_adv_pkt
D/dalvikvm( 5526): GC_CONCURRENT freed 165K, 5% free 4427K/4624K, paused 1ms+1ms, total 5ms
W/ActivityManager( 1766): Unable to start service Intent { cmp=com.example.prevent_the_lost/.BluetoothLeService } U=0: not found
I/ActivityManager( 1766): Displayed com.example.prevent_the_lost/.DeviceControl: +29ms
D/AndroidRuntime( 5526): Shutting down VM
W/dalvikvm( 5526): threadid=1: thread exiting with uncaught exception (group=0x94ee8648)
E/AndroidRuntime( 5526): FATAL EXCEPTION: main
E/AndroidRuntime( 5526): java.lang.NullPointerException
E/AndroidRuntime( 5526): at com.example.prevent_the_lost.DeviceControl.onOptionsItemSelected(DeviceControl.java:140)
E/AndroidRuntime( 5526): at android.app.Activity.onMenuItemSelected(Activity.java:2566)
E/AndroidRuntime( 5526): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:986)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:547)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:115)
E/AndroidRuntime( 5526): at android.view.View.performClick(View.java:4240)
E/AndroidRuntime( 5526): at android.view.View$PerformClick.run(View.java:17721)
E/AndroidRuntime( 5526): at android.os.Handler.handleCallback(Handler.java:730)
E/AndroidRuntime( 5526): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 5526): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 5526): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime( 5526): at java.lang.reflect.Method.invokeNative(NativeMethod)
E/AndroidRuntime( 5526): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime( 5526): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime( 5526): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 5526): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1766): Force finishing activity com.example.prevent_the_lost/.DeviceControl
W/WindowManager( 1766): Screenshot failure taking screenshot for (166x125) to layer 21020
W/ActivityManager( 1766): Activity pause timeout for ActivityRecord{4aad960c u0com.example.prevent_the_lost/.DeviceControl}
I/Process ( 5526): Sending signal. PID: 5526 SIG: 9
W/InputDispatcher( 1766): channel '4aaa49ec com.example.prevent_the_lost/com.example.prevent_the_lost.Device_List (server)' ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 1766): channel '4aaa49ec com.example.prevent_the_lost/com.example.prevent_the_lost.Device_List (server)' ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher( 1766): channel '4aa9c3e4 com.example.prevent_the_lost/com.example.prevent_the_lost.DeviceControl (server)' ~ Consumer closed input channel or an error occurred. events=0xd
E/InputDispatcher( 1766): channel '4aa9c3e4 com.example.prevent_the_lost/com.example.prevent_the_lost.DeviceControl (server)' ~ Channel is unrecoverably brokenand will be disposed!
W/InputDispatcher( 1766): Attempted to unregister already unregistered input channel '4aaa49ec com.example.prevent_the_lost/com.example.prevent_the_lost.Device_List (server)'
W/InputDispatcher( 1766): Attempted to unregister already unregistered input channel '4aa9c3e4 com.example.prevent_the_lost/com.example.prevent_the_lost.DeviceControl (server)'
I/ActivityManager( 1766): Process com.example.prevent_the_lost (pid 5526) has died.
I/WindowState( 1766): WIN DEATH: Window{4aaa49ec u0 com.example.prevent_the_lost/com.example.prevent_the_lost.Device_List}
I/WindowState( 1766): WIN DEATH: Window{4aa9c3e4 u0 com.example.prevent_the_lost/com.example.prevent_the_lost.DeviceControl}
I/ActivityManager( 1766): Start proc com.example.prevent_the_lost for activity com.example.prevent_the_lost/.Device_List: pid=5545 uid=10043 gids={50043, 3001,3002, 1028}
I/ActivityThread( 5545): Switching default density from 160 to 130
D/BluetoothManagerService( 1766): Message: 20
D/BluetoothManagerService( 1766): Added callback: android.bluetooth.IBluetoothManagerCallback$Stub$Proxy#4ab1fee8:true
W/InputMethodManagerService( 1766): Got RemoteException sending setActive(false) notification to pid 5526 uid 10043
I/ActivityManager( 1766): Displayed com.example.prevent_the_lost/.Device_List: +171ms
D/dalvikvm( 1766): GC_CONCURRENT freed 455K, 19% free 7301K/8980K, paused 1ms+1ms, total 12ms
I don't know what the error in this Log ??
Could somebody tell me the error and how to solve it ???
Thanks a lot!!!
I find the error is "Unable to start service Intent"
The solution is add the Service in Manifest -> Application.
I am going to use camera/gallery in my project. FOr this i have first taken picture and saved it in my folder(Suppose pictureworld) and also saved the imageuri in the localdatabase. Then when i am trying to get the picture to show it in the gridview i am getting a warning message. In the gridview there is no picture but it can view the picture name. I have checked that it is creating the picture and also the uri in the localdatabase is correct.I want to add that when i am trying to save the pic using the gallery ..there is no problem. I have used the same adapter for viewing the saved gallery and camera picture. I am attaching the warning here:
03-10 17:48:11.367: W/System.err(522): at libcore.io.IoBridge.open(IoBridge.java:406)
03-10 17:48:11.367: W/System.err(522): at java.io.FileInputStream.<init>(FileInputStream.java:78)
03-10 17:48:11.367: W/System.err(522): at java.io.FileInputStream.<init>(FileInputStream.java:105)
03-10 17:48:11.367: W/System.err(522): at android.content.ContentResolver.openInputStream(ContentResolver.java:369)
03-10 17:48:11.367: W/System.err(522): at android.provider.MediaStore$Images$Media.getBitmap(MediaStore.java:705)
03-10 17:48:11.367: W/System.err(522): at hr.s2is.ischool.admin.adapter.CommunityUserAdapter.getView(CommunityUserAdapter.java:71)
03-10 17:48:11.367: W/System.err(522): at android.widget.AbsListView.obtainView(AbsListView.java:2033)
03-10 17:48:11.367: W/System.err(522): at android.widget.GridView.makeAndAddView(GridView.java:1323)
03-10 17:48:11.377: W/System.err(522): at android.widget.GridView.makeRow(GridView.java:328)
03-10 17:48:11.377: W/System.err(522): at android.widget.GridView.fillDown(GridView.java:281)
03-10 17:48:11.377: W/System.err(522): at android.widget.GridView.fillFromTop(GridView.java:403)
03-10 17:48:11.377: W/System.err(522): at android.widget.GridView.layoutChildren(GridView.java:1215)
03-10 17:48:11.377: W/System.err(522): at android.widget.AbsListView.onLayout(AbsListView.java:1863)
03-10 17:48:11.377: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.377: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.377: W/System.err(522): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:925)
03-10 17:48:11.387: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.387: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.387: W/System.err(522): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
03-10 17:48:11.387: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.387: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.387: W/System.err(522): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
03-10 17:48:11.397: W/System.err(522): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
03-10 17:48:11.397: W/System.err(522): at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
03-10 17:48:11.397: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.397: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.397: W/System.err(522): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
03-10 17:48:11.397: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.397: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.407: W/System.err(522): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1489)
03-10 17:48:11.407: W/System.err(522): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
03-10 17:48:11.407: W/System.err(522): at android.os.Handler.dispatchMessage(Handler.java:99)
03-10 17:48:11.407: W/System.err(522): at android.os.Looper.loop(Looper.java:137)
03-10 17:48:11.407: W/System.err(522): at android.app.ActivityThread.main(ActivityThread.java:4424)
03-10 17:48:11.407: W/System.err(522): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 17:48:11.417: W/System.err(522): at java.lang.reflect.Method.invoke(Method.java:511)
03-10 17:48:11.417: W/System.err(522): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-10 17:48:11.417: W/System.err(522): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-10 17:48:11.417: W/System.err(522): at dalvik.system.NativeStart.main(Native Method)
03-10 17:48:11.417: W/System.err(522): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
03-10 17:48:11.427: W/System.err(522): at libcore.io.Posix.open(Native Method)
03-10 17:48:11.427: W/System.err(522): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
03-10 17:48:11.427: W/System.err(522): at libcore.io.IoBridge.open(IoBridge.java:390)
Have you given the permission to read the local storage? You should check if any permission is declared in Android Manifest regarding Writing and reading of Internal Storage.
did you add permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
One more thing:
With sdk, you can't write to the root of internal storage. This cause your error.Try something like this
final File dir = new File(context.getFilesDir() + "/nfs/guille/groce/users/nicholsk/workspace3/SQLTest");
dir.mkdirs(); //create folders where write files
final File file = new File(dir, "BlockForTest.txt");
When ANR occurs for Launcher,dialog pops up and the Launcher resume then.
Select OK to restart Launcher after the launcher resume to respond, the rest keys will be dropped.
The problem occurs in my developing environment and it's hard to reproduce.So I do a test for this:
Create a simple APK as Launcher, and sleep some time in onCreat or onResume to let the ANR occurs
Start the Launcher and press key to let ANR occurs
after sleep the view is normally shown behind the ANR dialog
select OK to restart launcher, then keys can't be received because the activity can't created
Dropping event because there is no focused window or focused application
The APK is used on Android4.0 and Android2.2
there is no problem in Android2.2, it looks like a problem on Android 4.03.
Log are suppled for the real test issue and the emulate issue in 2.2, 4.03.
Plus: I modify the original Launcher2 as well and sleep in onResume, It has no such issue
but I can't find any clue.
Any help is appreciated.
Android4.0
09-10 17:29:44.716 W/ActivityManager( 77): Force finishing activity com.example.testanr2/.MainActivity
09-10 17:29:44.716 W/WindowManager( 77): Failure taking screenshot for (180x300) to layer 21005
09-10 17:29:44.736 I/ActivityManager( 77): Clearing package preferred activities from com.example.testanr2
09-10 17:29:44.736 I/ActivityManager( 77): Killing ProcessRecord{415df8d8 2409:com.example.testanr2/10040}: user's request
09-10 17:29:44.756 I/WindowManager( 77): WIN DEATH: Window{41444c48 com.example.testanr2/com.example.testanr2.MainActivity paused=true}
09-10 17:29:44.765 I/ActivityManager( 77): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.example.testanr2/.MainActivity} from pid 0
09-10 17:29:44.786 W/ActivityManager( 77): Exception when starting activity com.example.testanr2/.MainActivity
09-10 17:29:44.786 W/ActivityManager( 77): android.os.DeadObjectException
09-10 17:29:44.786 W/ActivityManager( 77): at android.os.BinderProxy.transact(Native Method)
09-10 17:29:44.786 W/ActivityManager( 77): at android.app.ApplicationThreadProxy.scheduleLaunchActivity(ApplicationThreadNative.java:660)
09-10 17:29:44.786 W/ActivityManager( 77): at com.android.server.am.ActivityStack.realStartActivityLocked(ActivityStack.java:593)
09-10 17:29:44.786 W/ActivityManager( 77): at com.android.server.am.ActivityStack.startSpecificActivityLocked(ActivityStack.java:701)
09-10 17:29:44.786 W/ActivityManager( 77): at com.android.server.am.ActivityStack.resumeTopActivityLocked(ActivityStack.java:1571)
09-10 17:29:44.786 W/ActivityManager( 77): at com.android.server.am.ActivityStack.completePauseLocked(ActivityStack.java:1000)
09-10 17:29:44.786 W/ActivityManager( 77): at com.android.server.am.ActivityStack.activityPaused(ActivityStack.java:928)
09-10 17:29:44.786 W/ActivityManager( 77): at com.android.server.am.ActivityManagerService.activityPaused(ActivityManagerService.java:3957)
09-10 17:29:44.786 W/ActivityManager( 77): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:371)
09-10 17:29:44.786 W/ActivityManager( 77): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1496)
09-10 17:29:44.786 W/ActivityManager( 77): at android.os.Binder.execTransact(Binder.java:338)
09-10 17:29:44.786 W/ActivityManager( 77): at dalvik.system.NativeStart.run(Native Method)
09-10 17:29:44.786 W/ActivityManager( 77): Force removing ActivityRecord{414b0020 com.example.testanr2/.MainActivity}: app died, no saved state
09-10 17:29:44.836 D/dalvikvm( 2438): Not late-enabling CheckJNI (already on)
09-10 17:29:44.855 I/ActivityManager( 77): Start proc com.example.testanr2 for activity com.example.testanr2/.MainActivity: pid=2438 uid=10040 gids={}
09-10 17:29:44.855 I/ActivityManager( 77): Process com.example.testanr2 (pid 2409) has died and restarted (pid 2438).
09-10 17:29:44.855 W/NetworkManagementSocketTagger( 77): setKernelCountSet(10040, 0) failed with errno -2
09-10 17:29:47.562 I/InputDispatcher( 77): Dropping event because there is no touched window or focused application.
09-10 17:29:47.828 I/InputDispatcher( 77): Dropping event because there is no touched window or focused application.
09-10 17:29:47.965 D/dalvikvm( 161): GC_CONCURRENT freed 384K, 6% free 10331K/10951K, paused 7ms+3ms
09-10 17:29:48.135 I/InputDispatcher( 77): Dropping event because there is no touched window or focused application.
09-10 17:29:50.207 I/InputDispatcher( 77): Dropping event because there is no touched window or focused application.
09-10 17:29:50.708 I/InputDispatcher( 77): Dropping event because there is no touched window or focused application.
09-10 17:29:50.991 I/InputDispatcher( 77): Dropping event because there is no touched window or focused application.
09-10 17:29:51.205 I/InputDispatcher( 77): Dropping event because there is no touched window or focused application.
09-10 17:29:51.362 I/InputDispatcher( 77): Dropping event because there is no touched window or focused application.
09-10 17:29:54.746 W/ActivityManager( 77): Launch timeout has expired, giving up wake lock!
09-10 17:29:57.877 I/InputDispatcher( 77): Dropping event because there is no touched window or focused application.
Android2.2
09-10 16:40:32.254 D/PackageManager( 72): New package installed in /data/app/com.example.testanr2-1.apk
09-10 16:40:32.304 D/lixin ( 668): sleep~ in application10
09-10 16:40:32.394 I/ActivityManager( 72): Force stopping package com.example.testanr2 uid=10040
09-10 16:40:32.394 I/Process ( 72): Sending signal. PID: 668 SIG: 9
09-10 16:40:32.414 I/ActivityManager( 72): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.example.testanr2/.MainActivity }
09-10 16:40:32.484 D/dalvikvm( 72): GC_FOR_MALLOC freed 11945 objects / 732440 bytes in 67ms
09-10 16:40:32.484 I/ActivityManager( 72): Start proc com.example.testanr2 for activity com.example.testanr2/.MainActivity: pid=674 uid=10040 gids={}
09-10 16:40:32.604 D/dalvikvm( 198): GC_EXPLICIT freed 2644 objects / 128328 bytes in 105ms
09-10 16:40:32.734 D/dalvikvm( 72): GC_EXPLICIT freed 939 objects / 49752 bytes in 229ms
09-10 16:40:32.734 I/UsageStats( 72): Unexpected resume of com.example.testanr2 while already resumed in com.example.testanr2
09-10 16:40:32.834 W/RecognitionManagerService( 72): no available voice recognition services found
09-10 16:40:32.864 D/lixin ( 674): sleep~ in application10
09-10 16:40:32.915 D/dalvikvm( 72): GC_EXPLICIT freed 2356 objects / 116024 bytes in 77ms
09-10 16:40:32.954 I/installd( 34): unlink /data/dalvik-cache/data#app#com.example.testanr2-2.apk#classes.dex
09-10 16:40:32.984 D/AndroidRuntime( 654): Shutting down VM
09-10 16:40:32.984 D/dalvikvm( 654): Debugger has detached; object registry had 1 entries
09-10 16:40:33.245 D/AndroidRuntime( 684):
09-10 16:40:33.245 D/AndroidRuntime( 684): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
09-10 16:40:33.245 D/AndroidRuntime( 684): CheckJNI is ON
09-10 16:40:33.334 D/AndroidRuntime( 684): --- registering native functions ---
09-10 16:40:33.665 I/ActivityManager( 72): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.testanr2/.MainActivity }
09-10 16:40:33.665 D/AndroidRuntime( 684): Shutting down VM
09-10 16:40:33.665 D/dalvikvm( 684): Debugger has detached; object registry had 1 entries
09-10 16:40:33.674 I/AndroidRuntime( 684): NOTE: attach of thread 'Binder Thread #3' failed
09-10 16:40:34.169 W/ActivityManager( 72): Activity pause timeout for HistoryRecord{45060dd8 com.example.testanr2/.MainActivity}
09-10 16:40:40.057 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:40.074 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:40.275 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:40.314 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:40.445 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:40.484 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:40.528 W/ActivityManager( 72): Launch timeout has expired, giving up wake lock!
09-10 16:40:40.678 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:40.714 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:40.864 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:40.874 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:41.604 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:41.637 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:41.755 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:41.786 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:41.936 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:41.954 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:42.088 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:42.124 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:42.234 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:42.295 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:42.404 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:42.444 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:42.595 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:42.614 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:42.744 W/ActivityManager( 72): Activity idle timeout for HistoryRecord{45060dd8 com.example.testanr2/.MainActivity}
09-10 16:40:42.744 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:42.754 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:42.885 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:42.885 D/lixin ( 674): sleep~ in application10
09-10 16:40:42.926 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:44.181 W/ActivityManager( 72): Activity idle timeout for HistoryRecord{451b0480 com.example.testanr2/.MainActivity}
09-10 16:40:47.029 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:47.045 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:47.280 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:47.345 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:47.545 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:47.595 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:47.794 W/WindowManager( 72): No window to dispatch pointer action 0
09-10 16:40:47.865 W/WindowManager( 72): No window to dispatch pointer action 1
09-10 16:40:49.235 D/dalvikvm( 289): GC_EXPLICIT freed 353 objects / 19600 bytes in 56ms
09-10 16:40:52.924 W/InputManagerService( 72): Got RemoteException sending setActive(false) notification to pid 575 uid 10040
09-10 16:40:52.964 I/ActivityManager( 72): Displayed activity com.example.testanr2/.MainActivity: 18800 ms (total 22687 ms)
Launcher2
01-01 08:12:56.140 I/WindowManager( 1259): Handle special keys: 23
01-01 08:12:56.145 W/ActivityManager( 1259): Force finishing activity com.android.launcher/com.android.launcher2.Launcher
01-01 08:12:56.239 D/dalvikvm( 1259): GC_FOR_ALLOC freed 462K, 13% free 10871K/12423K, paused 48ms
01-01 08:12:56.242 D/UsageStats( 1259): UsageStats: broadcasting intent
01-01 08:12:56.244 I/ActivityManager( 1259): Clearing package preferred activities from com.android.launcher
01-01 08:12:56.244 I/ActivityManager( 1259): Killing ProcessRecord{40c2f498 2970:com.android.launcher/10032}: user's request
01-01 08:12:56.252 I/ActivityManager( 1259): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.android.launcher/com.android.launcher2.Launcher} from pid 0
01-01 08:12:56.303 E/JavaBinder( 1259): !!! FAILED BINDER TRANSACTION !!!
01-01 08:12:56.330 W/ActivityManager( 1259): Exception when starting activity com.android.launcher/com.android.launcher2.Launcher
01-01 08:12:56.330 W/ActivityManager( 1259): android.os.TransactionTooLargeException
01-01 08:12:56.330 W/ActivityManager( 1259): at android.os.BinderProxy.transact(Native Method)
01-01 08:12:56.330 W/ActivityManager( 1259): at android.app.ApplicationThreadProxy.scheduleLaunchActivity(ApplicationThreadNative.java:660)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityStack.realStartActivityLocked(ActivityStack.java:615)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityStack.startSpecificActivityLocked(ActivityStack.java:724)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityStack.resumeTopActivityLocked(ActivityStack.java:1614)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityStack.startActivityLocked(ActivityStack.java:1760)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityStack.startActivityUncheckedLocked(ActivityStack.java:2802)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityStack.startActivityLocked(ActivityStack.java:2422)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityManagerService.startHomeActivityLocked(ActivityManagerService.java:2063)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityStack.resumeTopActivityLocked(ActivityStack.java:1299)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityStack.completePauseLocked(ActivityStack.java:1040)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityStack.activityPaused(ActivityStack.java:952)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityManagerService.activityPaused(ActivityManagerService.java:4140)
01-01 08:12:56.330 W/ActivityManager( 1259): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:371)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1548)
01-01 08:12:56.330 W/ActivityManager( 1259): at android.os.Binder.execTransact(Binder.java:338)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.SystemServer.init1(Native Method)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.server.SystemServer.main(SystemServer.java:860)
01-01 08:12:56.330 W/ActivityManager( 1259): at java.lang.reflect.Method.invokeNative(Native Method)
01-01 08:12:56.330 W/ActivityManager( 1259): at java.lang.reflect.Method.invoke(Method.java:511)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
01-01 08:12:56.330 W/ActivityManager( 1259): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
01-01 08:12:56.330 W/ActivityManager( 1259): at dalvik.system.NativeStart.main(Native Method)
01-01 08:12:56.345 E/JavaBinder( 1259): !!! FAILED BINDER TRANSACTION !!!
01-01 08:12:56.408 I/ActivityManager( 1259): Start proc com.android.launcher for activity com.android.launcher/com.android.launcher2.Launcher: pid=3000 uid=10032 gids={}
01-01 08:12:56.484 D/UsageStats( 1259): UsageStats: broadcasting intent
01-01 08:12:56.613 I/ActivityThread( 3000): Pub com.android.launcher2.settings: com.android.launcher2.LauncherProvider
01-01 08:12:56.862 D/dalvikvm( 3000): GC_FOR_ALLOC freed 164K, 5% free 7837K/8199K, paused 21ms
01-01 08:12:56.986 I/Process ( 1259): Sending signal. PID: 3000 SIG: 3
01-01 08:12:56.986 I/dalvikvm( 3000): threadid=3: reacting to signal 3
01-01 08:12:57.007 W/WindowManager( 1259): Rebuild removed 2 windows but added 1
01-01 08:12:57.012 W/WindowManager( 1259): This window was lost: Window{40c51350 com.android.launcher/com.android.launcher2.Launcher paused=true}
01-01 08:12:57.012 W/WindowManager( 1259): mSession=Session{40bee818 uid 10032} mClient=android.os.BinderProxy#40bbecd8
01-01 08:12:57.012 W/WindowManager( 1259): mAttrs=WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=1 fl=#1810100 pfl=0x8 fmt=-2 wanim=0x1030292}
01-01 08:12:57.012 W/WindowManager( 1259): Requested w=1920 h=1080 mLayoutSeq=148
01-01 08:12:57.012 W/WindowManager( 1259): mBaseLayer=21000 mSubLayer=0 mAnimLayer=21000+0=21000 mLastLayer=21000
01-01 08:12:57.012 W/WindowManager( 1259): mSurface=Surface(name=com.android.launcher/com.android.launcher2.Launcher, identity=34)
01-01 08:12:57.012 W/WindowManager( 1259): Surface: shown=false layer=21000 alpha=1.0 rect=(0.0,0.0) 1920.0 x 1080.0
01-01 08:12:57.012 W/WindowManager( 1259): mToken=AppWindowToken{40cb7750 token=Token{40b37598 ActivityRecord{40b9c4c0 com.android.launcher/com.android.launcher2.Launcher}}}
01-01 08:12:57.012 W/WindowManager( 1259): mRootToken=AppWindowToken{40cb7750 token=Token{40b37598 ActivityRecord{40b9c4c0 com.android.launcher/com.android.launcher2.Launcher}}}
01-01 08:12:57.012 W/WindowManager( 1259): mAppToken=AppWindowToken{40cb7750 token=Token{40b37598 ActivityRecord{40b9c4c0 com.android.launcher/com.android.launcher2.Launcher}}}
01-01 08:12:57.012 W/WindowManager( 1259): mViewVisibility=0x0 mLastHidden=true mHaveFrame=true mObscured=false
01-01 08:12:57.012 W/WindowManager( 1259): mSeq=0 mSystemUiVisibility=0x0
01-01 08:12:57.012 W/WindowManager( 1259): mGivenContentInsets=[0,0][0,0] mGivenVisibleInsets=[0,0][0,0]
01-01 08:12:57.012 W/WindowManager( 1259): mConfiguration={1.0 0mcc0mnc zh_CN layoutdir=0 sw720dp w1280dp h720dp xlrg long land -touch -keyb/v/h dpad/v s.4}
01-01 08:12:57.012 W/WindowManager( 1259): mShownFrame=[0.0,0.0][1920.0,1080.0]
01-01 08:12:57.012 W/WindowManager( 1259): mFrame=[0,0][1920,1080] last=[0,0][1920,1080]
01-01 08:12:57.012 W/WindowManager( 1259): mContainingFrame=[0,0][1920,1080] mParentFrame=[0,0][1920,1080] mDisplayFrame=[0,0][1920,1080]
01-01 08:12:57.012 W/WindowManager( 1259): mContentFrame=[0,0][1920,1080] mVisibleFrame=[0,0][1920,1080]
01-01 08:12:57.012 W/WindowManager( 1259): mContentInsets=[0,0][0,0] last=[0,0][0,0] mVisibleInsets=[0,0][0,0] last=[0,0][0,0]
01-01 08:12:57.012 W/WindowManager( 1259): mDrawPending=false mCommitDrawPending=false mReadyToShow=false mHasDrawn=true
01-01 08:12:57.012 W/WindowManager( 1259): mWallpaperX=0.5 mWallpaperY=0.5
01-01 08:12:57.012 W/WindowManager( 1259): mWallpaperXStep=0.25 mWallpaperYStep=1.0
01-01 08:12:57.012 W/WindowManager( 1259): Current app token list:
01-01 08:12:57.012 V/WindowManager( 1259): #0: Token{40ba4ee8 ActivityRecord{40bb8cd8 com.android.launcher/com.android.launcher2.Launcher}}
01-01 08:12:57.012 W/WindowManager( 1259): Final window list:
01-01 08:12:57.012 V/WindowManager( 1259): #1: Window{40b78338 InputMethod paused=false}
01-01 08:12:57.012 V/WindowManager( 1259): #0: Window{40c6f7b8 Starting com.android.launcher paused=false}
01-01 08:12:57.035 I/WindowManager( 1259): WIN DEATH: Window{40c51350 com.android.launcher/com.android.launcher2.Launcher paused=true}
01-01 08:12:57.039 I/dalvikvm( 3000): Wrote stack traces to '/data/anr/traces.txt'
01-01 08:12:57.051 D/dalvikvm( 3000): GC_CONCURRENT freed 264K, 6% free 8034K/8519K, paused 5ms+1ms
01-01 08:12:57.251 D/dalvikvm( 3000): GC_FOR_ALLOC freed 168K, 5% free 8217K/8583K, paused 14ms
01-01 08:12:57.263 I/dalvikvm-heap( 3000): Grow heap (frag case) to 10.641MB for 2560016-byte allocation
01-01 08:12:57.278 D/dalvikvm( 3000): GC_CONCURRENT freed 13K, 4% free 10704K/11143K, paused 2ms+1ms
01-01 08:12:57.358 D/dalvikvm( 3000): GC_FOR_ALLOC freed 0K, 4% free 10704K/11143K, paused 10ms
01-01 08:12:57.370 D/KeyLayoutMap( 1259): mapKey: scanCode=106 ~ Result keyCode=22, flags=0x00000002.
01-01 08:12:57.370 D/InputReader( 1259): receive key event: device=6 type=0x0001 scancode=106(0x006a) keycode=22(0x0016) value=0x00000001 flags=0x00000002
01-01 08:12:57.370 I/WindowManager( 1259): Handle special keys: 22
01-01 08:12:57.372 I/dalvikvm-heap( 3000): Grow heap (frag case) to 12.001MB for 1440016-byte allocation
01-01 08:12:57.394 D/dalvikvm( 3000): GC_CONCURRENT freed 0K, 4% free 12110K/12551K, paused 1ms+2ms
01-01 08:12:57.453 D/Launcher( 3000): #### onCreate setBackgroundColor
01-01 08:12:57.454 D/Launcher( 3000): sleep~main10
I add the attributes to the main activity in Launcher manifest
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
The two attributes are in the original Launcher in Android which can solve this issue
But why it works is still unknown.