请求单个位置更新,AVD 崩溃

Posted

技术标签:

【中文标题】请求单个位置更新,AVD 崩溃【英文标题】:Requesting single location update, AVD crashes 【发布时间】:2011-06-16 21:26:36 【问题描述】:

我正在尝试使用新的 LocationManager.requestSingleUpdate() 方法请求单个位置更新,但是一旦设备从 GPS 获得更新,操作系统就会崩溃并且似乎试图重新启动。至少我得到了通常的 android 启动屏幕,但它永远不会完成启动。

我尝试在 2.3、2.3.1、2.3.3 和 2.2 AVD 上运行代码,结果都相同。

***** 更新 *****

我尝试了一个我制作的基于位置的旧应用程序,该应用程序在几百个单元上运行良好,这也会在发送位置更新时使 AVD 崩溃。我想这更多的是理解 AVD 的位置更新出了什么问题,而不是在我的代码中发现错误..?

下面是我认为有问题的代码,以防它可能相关:

***** 结束更新 *****

public class LocationHelper 

    public static void getLocation(Context context) 

        LocationListener locationListener = new LocationListener() 

            @Override
            public void onStatusChanged(String provider, int status, Bundle extras) 
                Log.v("LocationListener", "onStatusChanged");
                

            @Override
            public void onProviderEnabled(String provider) 
                Log.v("LocationListener", "onProviderEnabled");                
            

            @Override
            public void onProviderDisabled(String provider) 
                Log.v("LocationListener", "onProviderDisabled");
            

            @Override
            public void onLocationChanged(Location location) 
                Log.v("LocationListener", "onLocationChanged");
            
        ;

        LocationManager locationManager = (LocationManager)context.getSystemService(Service.LOCATION_SERVICE);

        Criteria criteria = new Criteria();
        criteria.setAccuracy(Criteria.ACCURACY_FINE);
        String provider = locationManager.getBestProvider(criteria, true);

        Log.v("Provider", provider);

        // FIXME: Something crashes the emulator when a GPS fix is sent through DDMS
        locationManager.requestSingleUpdate(provider, locationListener, Looper.myLooper());
    

根据日志,我还可能提到provider 变量被设置为“gps”。 LocationListener 中的任何日志语句都不会被触发。

以下是 logcat 的输出。第一行显示我的 getLocation() 函数被调用。然后我通过 DDMS 提交 gps 修复,然后手机继续重启。我把日志剪短了一点,因为我超过了 30k 个字符的边界,但我想第一行是最相关的。

V/Provider(  430): gps

I/DEBUG   (   31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

I/DEBUG   (   31): Build fingerprint: 'generic/google_sdk/generic:2.3/GRH55/79397:eng/test-keys'

I/DEBUG   (   31): pid: 68, tid: 163  >>> system_server <<<

I/DEBUG   (   31): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000

I/DEBUG   (   31):  r0 00000000  r1 40685948  r2 4128fcbc  r3 459e1c74

I/DEBUG   (   31):  r4 0000012d  r5 00000000  r6 40685948  r7 4128fcbc

I/DEBUG   (   31):  r8 84301321  r9 84302240  10 00100000  fp 00000001

I/DEBUG   (   31):  ip 82f0e7d4  sp 459e1c60  lr 82f0ab37  pc 82f07d0e  cpsr 00000030

I/DEBUG   (   31):          #00  pc 00007d0e  /system/lib/libandroid_servers.so

I/DEBUG   (   31):          #01  pc 0000ab32  /system/lib/libandroid_servers.so

I/DEBUG   (   31):          #02  pc 000012ca  /system/lib/hw/gps.goldfish.so

I/DEBUG   (   31):          #03  pc 000014ae  /system/lib/hw/gps.goldfish.so

I/DEBUG   (   31):          #04  pc 00011a7c  /system/lib/libc.so

I/DEBUG   (   31):          #05  pc 00011640  /system/lib/libc.so

I/DEBUG   (   31): 

I/DEBUG   (   31): code around pc:

I/DEBUG   (   31): 82f07cec ab04b082 9301cb04 6f646804 b00247a0 

I/DEBUG   (   31): 82f07cfc bc08bc10 4718b002 b510b40c ab04b082 

I/DEBUG   (   31): 82f07d0c 6804cb04 34f89301 47a06824 bc10b002 

I/DEBUG   (   31): 82f07d1c b002bc08 46c04718 b510b40c ab04b082 

I/DEBUG   (   31): 82f07d2c 9301cb04 34986804 47a06824 bc10b002 

I/DEBUG   (   31): 

I/DEBUG   (   31): code around lr:

I/DEBUG   (   31): 82f0ab14 91099008 f7fb6aa0 900aeb14 1c3a910b 

I/DEBUG   (   31): 82f0ab24 6b646b23 930c1c28 1c31940d f7fd9b0f 

I/DEBUG   (   31): 82f0ab34 4906f8e7 44791c28 f7ff3150 b011fe1d 

I/DEBUG   (   31): 82f0ab44 46c0bdf0 0000454c 000042c8 00000786 

I/DEBUG   (   31): 82f0ab54 f7fbb510 bd10ec7c 4802b510 f7fb4478 

I/DEBUG   (   31): 

I/DEBUG   (   31): stack:

I/DEBUG   (   31):     459e1c20  ac710cb3  

I/DEBUG   (   31):     459e1c24  40b38d0b  

I/DEBUG   (   31):     459e1c28  00000009  

I/DEBUG   (   31):     459e1c2c  00000000  

I/DEBUG   (   31):     459e1c30  0000ab90  [heap]

I/DEBUG   (   31):     459e1c34  81d48bd3  /system/lib/libdvm.so

I/DEBUG   (   31):     459e1c38  0000ab90  [heap]

I/DEBUG   (   31):     459e1c3c  459e1c6c  

I/DEBUG   (   31):     459e1c40  00010004  [heap]

I/DEBUG   (   31):     459e1c44  81d3761b  /system/lib/libdvm.so

I/DEBUG   (   31):     459e1c48  00000000  

I/DEBUG   (   31):     459e1c4c  afd0dcc4  /system/lib/libc.so

I/DEBUG   (   31):     459e1c50  00000000  

I/DEBUG   (   31):     459e1c54  459e1e00  

I/DEBUG   (   31):     459e1c58  df002777  

I/DEBUG   (   31):     459e1c5c  e3a070ad  

I/DEBUG   (   31): #00 459e1c60  00000001  

I/DEBUG   (   31):     459e1c64  8053bf25  /system/lib/libandroid_runtime.so

I/DEBUG   (   31):     459e1c68  0000012d  

I/DEBUG   (   31):     459e1c6c  82f0ab37  /system/lib/libandroid_servers.so

I/DEBUG   (   31):     459e1c70  4128fcbc  /dev/ashmem/dalvik-LinearAlloc (deleted)

I/DEBUG   (   31):     459e1c74  00000003  

I/DEBUG   (   31): #01 459e1c78  4284dfce  /system/usr/icu/icudt44l.dat

I/DEBUG   (   31):     459e1c7c  4042b604  /dev/ashmem/dalvik-heap (deleted)

I/DEBUG   (   31):     459e1c80  92023d3a  

I/DEBUG   (   31):     459e1c84  40490ac3  /dev/ashmem/dalvik-heap (deleted)

I/DEBUG   (   31):     459e1c88  00000000  

I/DEBUG   (   31):     459e1c8c  00000000  

I/DEBUG   (   31):     459e1c90  00000000  

I/DEBUG   (   31):     459e1c94  00000000  

I/DEBUG   (   31):     459e1c98  00000000  

I/DEBUG   (   31):     459e1c9c  00000000  

I/DEBUG   (   31):     459e1ca0  00000000  

I/DEBUG   (   31):     459e1ca4  00000000  

I/DEBUG   (   31):     459e1ca8  c4571f00  

I/DEBUG   (   31):     459e1cac  0000012d  

I/DEBUG   (   31):     459e1cb0  459e1e56  

I/DEBUG   (   31):     459e1cb4  00000003  

I/DEBUG   (   31):     459e1cb8  0000000a  

I/DEBUG   (   31):     459e1cbc  459e1de8  

I/DEBUG   (   31):     459e1cc0  00000000  

I/DEBUG   (   31):     459e1cc4  459e1e6b  

I/DEBUG   (   31):     459e1cc8  00000001  

I/DEBUG   (   31):     459e1ccc  843012cd  /system/lib/hw/gps.goldfish.so

I/StatusBarManagerService(   68): registerStatusBar bar=com.android.internal.statusbar.IStatusBar$Stub$Proxy@40692170

D/VoldCmdListener(   29): share status ums

D/StorageNotification(  278): Startup with UMS connection false (media state mounted)

I/StorageNotification(  278): UMS connection changed to false (media state mounted)

D/dalvikvm(  278): GC_CONCURRENT freed 501K, 55% free 2668K/5831K, external 897K/1038K, paused 9ms+6ms

I/ActivityManager(   68): Process com.android.defcontainer (pid 218) has died.

D/Zygote  (   33): Process 68 terminated by signal (11)

I/Zygote  (   33): Exit zygote because system server (68) has terminated

I/ActivityThread(  415): Removing dead content provider: settings

I/ServiceManager(   28): service 'batteryinfo' died

I/ServiceManager(   28): service 'usagestats' died

I/ServiceManager(   28): service 'SurfaceFlinger' died

I/ServiceManager(   28): service 'package' died

I/ServiceManager(   28): service 'sensorservice' died

I/ServiceManager(   28): service 'cpuinfo' died

I/ServiceManager(   28): service 'entropy' died

I/ServiceManager(   28): service 'power' died

I/ServiceManager(   28): service 'account' died

I/ServiceManager(   28): service 'telephony.registry' died

I/ServiceManager(   28): service 'appwidget' died

I/ServiceManager(   28): service 'backup' died

I/ServiceManager(   28): service 'permission' died

I/ServiceManager(   28): service 'activity' died

I/ServiceManager(   28): service 'meminfo' died

I/ServiceManager(   28): service 'diskstats' died

I/ServiceManager(   28): service 'content' died

I/ServiceManager(   28): service 'battery' died

I/ServiceManager(   28): service 'hardware' died

I/ServiceManager(   28): service 'vibrator' died

I/ServiceManager(   28): service 'alarm' died

I/ServiceManager(   28): service 'window' died

I/ServiceManager(   28): service 'device_policy' died

I/ActivityThread(  278): Removing dead content provider: settings

I/ActivityThread(  125): Removing dead content provider: settings

I/ActivityThread(  122): Removing dead content provider: settings

I/ActivityThread(  430): Removing dead content provider: settings

E/installd(   35): eof

E/installd(   35): failed to read size

I/installd(   35): closing connection

D/qemud   (   38): fdhandler_event: disconnect on fd 11

I/ServiceManager(   28): service 'statusbar' died

I/ServiceManager(   28): service 'clipboard' died

I/ServiceManager(   28): service 'network_management' died

I/ServiceManager(   28): service 'input_method' died

I/ServiceManager(   28): service 'netstat' died

I/ServiceManager(   28): service 'wifi' died

I/ServiceManager(   28): service 'connectivity' died

I/ServiceManager(   28): service 'throttle' died

I/ServiceManager(   28): service 'accessibility' died

I/ServiceManager(   28): service 'mount' died

I/ServiceManager(   28): service 'notification' died

I/ServiceManager(   28): service 'devicestoragemonitor' died

I/ServiceManager(   28): service 'location' died

I/ServiceManager(   28): service 'search' died

I/ServiceManager(   28): service 'dropbox' died

I/ServiceManager(   28): service 'wallpaper' died

I/ServiceManager(   28): service 'audio' died

I/ServiceManager(   28): service 'uimode' died

I/ServiceManager(   28): service 'isms' died

I/ServiceManager(   28): service 'simphonebook' died

I/ServiceManager(   28): service 'iphonesubinfo' died

I/ServiceManager(   28): service 'phone' died

I/ServiceManager(   28): service 'media.audio_flinger' died

I/ServiceManager(   28): service 'media.audio_policy' died

I/ServiceManager(   28): service 'media.player' died

I/ServiceManager(   28): service 'media.camera' died

I/Netd    (  445): Netd 1.0 starting

D/AndroidRuntime(  446): 

D/AndroidRuntime(  446): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<

D/AndroidRuntime(  446): CheckJNI is ON

I/        (  444): ServiceManager: 0xad50

D/AudioHardwareInterface(  444): setMode(NORMAL)

I/CameraService(  444): CameraService started (pid=444)

I/AudioFlinger(  444): AudioFlinger's thread 0xc650 ready to run

I/SamplingProfilerIntegration(  446): Profiler is disabled.

I/Zygote  (  446): Preloading classes...

D/dalvikvm(  446): GC_EXPLICIT freed 47K, 78% free 232K/1024K, external 0K/0K, paused 33ms

D/dalvikvm(  446): GC_EXPLICIT freed 1K, 73% free 282K/1024K, external 0K/0K, paused 17ms

D/dalvikvm(  446): GC_EXPLICIT freed 22K, 70% free 316K/1024K, external 0K/0K, paused 19ms

D/dalvikvm(  446): GC_EXPLICIT freed 17K, 66% free 353K/1024K, external 0K/0K, paused 8ms

D/dalvikvm(  446): GC_EXPLICIT freed 26K, 63% free 382K/1024K, external 0K/0K, paused 19ms

D/dalvikvm(  446): GC_EXPLICIT freed 20K, 58% free 439K/1024K, external 0K/0K, paused 20ms

W/MediaProfiles(  446): could not find media config xml file

D/dalvikvm(  446): GC_EXPLICIT freed 99K, 47% free 545K/1024K, external 0K/0K, paused 24ms

D/dalvikvm(  446): GC_EXPLICIT freed 272K, 28% free 884K/1219K, external 0K/0K, paused 45ms

D/dalvikvm(  446): GC_EXPLICIT freed 21K, 24% free 931K/1219K, external 0K/0K, paused 41ms

D/RenderScript_jni(  446): RenderScript JNI library not found!

D/dalvikvm(  446): GC_EXPLICIT freed 25K, 19% free 998K/1219K, external 0K/0K, paused 51ms

D/dalvikvm(  446): GC_EXPLICIT freed 47K, 5% free 1281K/1347K, external 0K/0K, paused 64ms

D/dalvikvm(  446): GC_EXPLICIT freed 24K, 3% free 1310K/1347K, external 0K/0K, paused 72ms

D/dalvikvm(  446): GC_EXPLICIT freed 28K, 6% free 1336K/1411K, external 0K/0K, paused 63ms

D/dalvikvm(  446): GC_EXPLICIT freed 14K, 3% free 1376K/1411K, external 0K/0K, paused 75ms

D/dalvikvm(  446): GC_EXPLICIT freed 28K, 5% free 1402K/1475K, external 0K/0K, paused 64ms

D/dalvikvm(  446): GC_EXPLICIT freed 28K, 3% free 1439K/1475K, external 0K/0K, paused 78ms

D/dalvikvm(  446): GC_EXPLICIT freed 38K, 6% free 1456K/1539K, external 0K/0K, paused 77ms

D/dalvikvm(  446): GC_EXPLICIT freed 40K, 5% free 1471K/1539K, external 0K/0K, paused 76ms

D/dalvikvm(  446): GC_EXPLICIT freed 55K, 8% free 1485K/1603K, external 0K/0K, paused 75ms

D/dalvikvm(  446): GC_FOR_MALLOC freed 2956K, 58% free 2166K/5123K, external 0K/0K, paused 273ms

D/dalvikvm(  446): GC_EXPLICIT freed 1401K, 55% free 2309K/5123K, external 0K/0K, paused 162ms

D/dalvikvm(  446): GC_EXPLICIT freed 141K, 55% free 2355K/5123K, external 0K/0K, paused 146ms

D/dalvikvm(  446): GC_EXPLICIT freed 73K, 54% free 2380K/5123K, external 0K/0K, paused 162ms

D/dalvikvm(  446): GC_EXPLICIT freed 36K, 54% free 2398K/5123K, external 0K/0K, paused 139ms

D/dalvikvm(  446): GC_EXPLICIT freed 30K, 53% free 2421K/5123K, external 0K/0K, paused 140ms

D/dalvikvm(  446): GC_EXPLICIT freed 38K, 53% free 2444K/5123K, external 0K/0K, paused 141ms

I/Zygote  (  446): ...preloaded 1830 classes in 23652ms.

E/Zygote  (  446): setreuid() failed. errno: 17

D/dalvikvm(  446): GC_EXPLICIT freed 18K, 53% free 2442K/5123K, external 0K/0K, paused 153ms

I/Zygote  (  446): Preloading resources...

D/dalvikvm(  446): GC_EXTERNAL_ALLOC freed <1K, 53% free 2444K/5123K, external 0K/0K, paused 141ms

W/Zygote  (  446): Preloaded drawable resource #0x1080093 (res/drawable-mdpi/sym_def_app_icon.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080002 (res/drawable-mdpi/arrow_down_float.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x10800b4 (res/drawable/btn_check.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x10800b7 (res/drawable-mdpi/btn_check_label_background.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x10800b8 (res/drawable-mdpi/btn_check_off.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x10800bd (res/drawable-mdpi/btn_check_on.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080004 (res/drawable/btn_default.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080005 (res/drawable/btn_default_small.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080006 (res/drawable/btn_dropdown.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080008 (res/drawable/btn_plus.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080007 (res/drawable/btn_minus.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080009 (res/drawable/btn_radio.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x108000a (res/drawable/btn_star.xml) that varies with configuration!!

D/dalvikvm(  446): GC_EXPLICIT freed 25K, 52% free 2481K/5123K, external 408K/521K, paused 128ms

W/Zygote  (  446): Preloaded drawable resource #0x1080132 (res/drawable/btn_toggle.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080196 (res/drawable-mdpi/ic_emergency.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080012 (res/drawable-mdpi/divider_horizontal_bright.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080014 (res/drawable-mdpi/divider_horizontal_dark.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080016 (res/drawable/edit_text.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080170 (res/drawable/expander_group.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080062 (res/drawable/list_selector_background.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x108022a (res/drawable-mdpi/menu_background.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x108022b (res/drawable-mdpi/menu_background_fill_parent_width.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x108022c (res/drawable/menu_selector.xml) that varies with configuration!!

D/dalvikvm(  446): GC_EXTERNAL_ALLOC freed 16K, 52% free 2494K/5123K, external 516K/521K, paused 135ms

W/Zygote  (  446): Preloaded drawable resource #0x108023a (res/drawable-mdpi/panel_background.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080242 (res/drawable-mdpi/popup_bottom_bright.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080243 (res/drawable-mdpi/popup_bottom_dark.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080244 (res/drawable-mdpi/popup_bottom_medium.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080245 (res/drawable-mdpi/popup_center_bright.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080246 (res/drawable-mdpi/popup_center_dark.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080249 (res/drawable-mdpi/popup_full_dark.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x108024c (res/drawable-mdpi/popup_top_bright.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x108024d (res/drawable-mdpi/popup_top_dark.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x108006d (res/drawable/progress_indeterminate_horizontal.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080253 (res/drawable/progress_small.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080254 (res/drawable/progress_small_titlebar.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080274 (res/drawable-mdpi/scrollbar_handle_horizontal.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080275 (res/drawable-mdpi/scrollbar_handle_vertical.9.png) that varies with configuration!!

D/dalvikvm(  446): GC_EXPLICIT freed 15K, 52% free 2506K/5123K, external 585K/1038K, paused 142ms

W/Zygote  (  446): Preloaded drawable resource #0x1080071 (res/drawable/spinner_dropdown_background.xml) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080304 (res/drawable-mdpi/text_select_handle_left.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080305 (res/drawable-mdpi/text_select_handle_middle.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080306 (res/drawable-mdpi/text_select_handle_right.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x1080327 (res/drawable-mdpi/title_bar_shadow.9.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x10801d8 (res/drawable-mdpi/indicator_code_lock_drag_direction_green_up.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x10801d9 (res/drawable-mdpi/indicator_code_lock_drag_direction_red_up.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x10801da (res/drawable-mdpi/indicator_code_lock_point_area_default.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x10801db (res/drawable-mdpi/indicator_code_lock_point_area_green.png) that varies with configuration!!

W/Zygote  (  446): Preloaded drawable resource #0x10801dc (res/drawable-mdpi/indicator_code_lock_point_area_red.png) that varies with configuration!!

I/Zygote  (  446): ...preloaded 51 resources in 2898ms.

I/Zygote  (  446): ...preloaded 15 resources in 64ms.

D/dalvikvm(  446): GC_EXPLICIT freed 23K, 51% free 2514K/5123K, external 716K/1038K, paused 134ms

D/dalvikvm(  446): GC_EXPLICIT freed 6K, 52% free 2508K/5123K, external 716K/1038K, paused 128ms

D/dalvikvm(  446): GC_EXPLICIT freed <1K, 52% free 2508K/5123K, external 716K/1038K, paused 224ms

I/dalvikvm(  446): System server process 453 has been created

I/Zygote  (  446): Accepting command socket connections

E/BatteryService(  453): usbOnlinePath not found

E/BatteryService(  453): batteryVoltagePath not found

E/BatteryService(  453): batteryTemperaturePath not found

I/sysproc (  453): Entered system_init()

I/sysproc (  453): ServiceManager: 0x8fbe8

I/SurfaceFlinger(  453): SurfaceFlinger is starting

I/SurfaceFlinger(  453): SurfaceFlinger's main thread ready to run. Initializing graphics H/W...

E/SurfaceFlinger(  453): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake

I/gralloc (  453): using (fd=27)

I/gralloc (  453): id           = 

I/gralloc (  453): xres         = 320 px

I/gralloc (  453): yres         = 480 px

I/gralloc (  453): xres_virtual = 320 px

I/gralloc (  453): yres_virtual = 960 px

I/gralloc (  453): bpp          = 16

I/gralloc (  453): r            = 11:5

I/gralloc (  453): g            =  5:6

I/gralloc (  453): b            =  0:5

I/gralloc (  453): width        = 49 mm (165.877548 dpi)

I/gralloc (  453): height       = 74 mm (164.756760 dpi)

I/gralloc (  453): refresh rate = 60.00 Hz

D/libEGL  (  453): egl.cfg not found, using default config

D/libEGL  (  453): loaded /system/lib/egl/libGLES_android.so

I/SurfaceFlinger(  453): EGL informations:

I/SurfaceFlinger(  453): # of configs : 8

I/SurfaceFlinger(  453): vendor    : Android

I/SurfaceFlinger(  453): version   : 1.4 Android META-EGL

I/SurfaceFlinger(  453): extensions: EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_ANDROID_image_native_buffer EGL_ANDROID_swap_rectangle 

I/SurfaceFlinger(  453): Client API: OpenGL ES

I/SurfaceFlinger(  453): EGLSurface: 5-6-5-0, config=0x0

I/SurfaceFlinger(  453): OpenGL informations:

I/SurfaceFlinger(  453): vendor    : Android

I/SurfaceFlinger(  453): renderer  : Android PixelFlinger 1.4

I/SurfaceFlinger(  453): version   : OpenGL ES-CM 1.0

I/SurfaceFlinger(  453): extensions: GL_OES_byte_coordinates GL_OES_fixed_point GL_OES_single_precision GL_OES_read_format GL_OES_compressed_paletted_texture GL_OES_draw_texture GL_OES_matrix_get GL_OES_query_matrix GL_OES_EGL_image GL_OES_compressed_ETC1_RGB8_texture GL_ARB_texture_compression GL_ARB_texture_non_power_of_two GL_ANDROID_user_clip_plane GL_ANDROID_vertex_buffer_object GL_ANDROID_generate_mipmap 

I/SurfaceFlinger(  453): GL_MAX_TEXTURE_SIZE = 4096

I/SurfaceFlinger(  453): GL_MAX_VIEWPORT_DIMS = 4096

I/SurfaceFlinger(  453): flags = 000c0000

D/SensorService(  453): nuSensorService starting...

E/SensorService(  453): couldn't open device for module sensors (Invalid argument)

I/sysproc (  453): System server: starting Android runtime.

I/sysproc (  453): System server: starting Android services.

我在清单中请求以下权限:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

【问题讨论】:

请附上来自 DDMS 的堆栈跟踪。另外,为什么您将new Criteria() 传递给getBestProvider,因为您之前正在创建和设置标准并且从不使用它?还要检查你是否在 Manifest 中设置了所需的权限 对不起,我想细节有点缺乏。我修复了new Criteria() 错误,并重新运行我的代码以确保它仍然失败。我还添加了 logcat 输出(如果来自 ddms 的堆栈跟踪是其他意思,我不熟悉它),以及清单中的 &lt;uses-permissions&gt; 条目。 嗯,如果在您的 AVD 上运行良好,您是否尝试过一些 Android API 演示或其他小型和基本演示(使用位置)? 对不起,我好像把球丢在了这个上。我找不到 API 演示,但现在我尝试了我编写的另一个基于位置的应用程序,并且在几百部手机上运行良好,它确实也使 AVD 崩溃。我还将 SDK 平台升级到了 2.3.3 版,但结果相同。尝试调试的速度很慢,因为我每次尝试都必须重新启动 AVD。 :) 更新了问题和标题以反映新信息。 【参考方案1】:

有a bug in the 2.3 emulator 导致了这个问题。目前没有修复。

【讨论】:

以上是关于请求单个位置更新,AVD 崩溃的主要内容,如果未能解决你的问题,请参考以下文章

请求位置时应用程序崩溃并且用户啥都不做

从服务 Android M 请求位置权限

Android O 在打盹模式下前台服务未接收位置更新

React Native:请求权限时崩溃

REST API - 在单个请求中批量创建或更新 [关闭]

Android Studio AVD 导致 avd 崩溃,AS 无警告关闭