我已经从AOSP编译了一个系统并将其快速启动到Nexus 7.我现在正在尝试编写一个非常简单的应用程序来通过网络提供商测试位置更新。
我安装了SIM卡并启用了所有设置,但我总是得到如下所示的错误。好像没有网络提供商。但我怎样才能启用它?我已经被困在这里多年没有线索了。(GPS工作正常)
D/PbdTrial( 4527): Network provider NOT enabled
D/AndroidRuntime( 4527): Shutting down VM
E/AndroidRuntime( 4527): FATAL EXCEPTION: main
E/AndroidRuntime( 4527): Process: com.example.jack.pbdtrial, PID: 4527
E/AndroidRuntime( 4527): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.jack.pbdtrial/com.example.jack.pbdtrial.MainActivity}: java.lang.IllegalArgumentException: provider doesn't exist: network
E/AndroidRuntime( 4527): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
E/AndroidRuntime( 4527): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
E/AndroidRuntime( 4527): at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime( 4527): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
E/AndroidRuntime( 4527): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 4527): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 4527): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 4527): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 4527): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 4527): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 4527): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime( 4527): Caused by: java.lang.IllegalArgumentException: provider doesn't exist: network
E/AndroidRuntime( 4527): at android.os.Parcel.readException(Parcel.java:1544)
E/AndroidRuntime( 4527): at android.os.Parcel.readException(Parcel.java:1493)
E/AndroidRuntime( 4527): at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:584)
E/AndroidRuntime( 4527): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:867)
E/AndroidRuntime( 4527): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:459)
E/AndroidRuntime( 4527): at com.example.jack.pbdtrial.MainActivity.onCreate(MainActivity.java:73)
E/AndroidRuntime( 4527): at android.app.Activity.performCreate(Activity.java:5933)
E/AndroidRuntime( 4527): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 4527): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
答案 0 :(得分:0)
您是否已将此添加到清单中?
<manifest ... >
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
...
</manifest>
此外,为确保您已在手机设置中启用位置更新,您可以提示用户启用它using this method