有谁能够解释我这是什么错误?我只得到了安卓4.0 +而不是为如下:
E / AndroidRuntime(891):java.lang.RuntimeException的:无法启动的活动ComponentInfo {com.example.getaddress / com.example.getaddress.MainActivity}:java.lang.IllegalArgumentException:如果要求运营商网络不exisit
看来,NETWORK_PROVIDER位置提供不可访问在4+的Android模拟器没有谷歌的API (还有其实我有不是所有的人进行测试,请参阅下面的)。我已在测试的实际设备与它确定(但他们都对他们的谷歌服务,这将是有趣的测试与定制,干净的Android版本,可能与点燃?)。
这不是关于启用/禁用的设备设置供应商的问题,这是根本不存在的模拟器。
这基本上code:
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,0,0,mLocListener);
将导致以下异常:
java.lang.IllegalArgumentException:如果供应商不exisit:空
在所有的Android 4+赤裸裸的仿真器(而不是谷歌结合的仿真器)
注:在exisit错字是在实际的日志行的
。让所有位置提供的列表,下面的目标设备上:
名单,其中,字符串>提供商= locationManager.getAllProviders();
我可以看到,网络供应商为present上
物理设备 安卓2.3.3仿真器(没有谷歌的API) 在Android的17级(4.2)模拟器(与谷歌的API)但不是
在Android的15级(4.0.3),仿真器与谷歌的API 的Android 4.2模拟器(没有谷歌的API)我的猜测是,对于非技术原因,谷歌已经不允许在AOSP的网络的位置服务,并限制其使用的操作系统的谷歌结合的版本从4.2(?)。
我不知道如果无论是否有非谷歌的设备替换网络位置的服务(如Kindle的)。
您的应用程序我不希望这对大多数智能手机和平板电脑产生任何影响。但它可以
在某种程度上削弱你的能力来测试 是一个兼容性问题,对于使用自定义/非谷歌Android版本的用户(再次点燃?)一个简单的测试,如:
locationManager.getAllProviders()。包括(LocationManager.NETWORK_PROVIDER)
可以告诉你怕疼如果网络提供商的设备上present。需要注意的是,如果它是present,但用户还没有激活它,你的LocationListener的将接收到的 onProviderDisabled 的回调以下位置的请求。
can anybody explain me what is this error ? I am getting only for android 4 + and not for below:
E/AndroidRuntime(891): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.getaddress/com.example.getaddress.MainActivity}: java.lang.IllegalArgumentException: requested provider network doesn't exisit
It appears that the NETWORK_PROVIDER location provider is not accessible in Android 4+ emulators without Google APIs (well actually I have not tested on all of them ,see below). The real devices I have tested on are OK with it (but they all have Google services on them, it would be interesting to test with custom, clean Android versions, maybe with Kindles?).
It is not a question on enabling/disabling the provider in the device settings, it is simply not there in the emulator.
Basically this code:
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,0,0,mLocListener);
will cause the following exception:
java.lang.IllegalArgumentException: provider doesn't exisit: null
on all Android 4+ naked emulators (as opposed to Google-bound emulators)
note: the typo in "exisit" is in the actual log line.
Getting a list of all location providers on the target device with the following:
List<String> providers = locationManager.getAllProviders();
I can see that the network provider is present on
physical devices android 2.3.3 emulator (no Google APIs) android level 17 (4.2) emulator (with Google APIs)But not on
android level 15 (4.0.3) emulator with Google APIs android 4.2 emulator (no Google APIs)My guess is that for non-technical reasons, Google has not allowed the network location service in AOSP and limited its usage to the Google-bound versions of the OS from 4.2 (?).
What I don't know if whether or not there is a replacement network location service on non-Google devices (such as Kindle).
I would not expect this to have any impact on most smartphones and tablets. However it can
somewhat impair your ability to test be a compatibility issue for users that use custom/non-Google versions of Android (once again, Kindle?)A simple test such as:
locationManager.getAllProviders().contains(LocationManager.NETWORK_PROVIDER)
can tell you painlessly if the network provider is present on the device. Note that if it is present, but the user has not activated it, your LocationListener will receive an onProviderDisabled callback following the location request.
上一篇:Android的磨损 - 月食:不承认支持库月食、磨损、不承认、Android
下一篇:&QUOT;无法找到一个版本在运行的运行此申请表]对于在64位的Windows 32位应用程序申请表、应用程序、版本、QUOT