Jack Liu
Jack Liu

Reputation: 63

java.lang.IllegalArgumentException: provider doesn't exist: network

I have compiled an system from AOSP and fastboot it into Nexus 7. I am now trying to write a very simple app to test the location updates through Network provider.

I have a sim card installed and enabled all the settings but I always get the errors shown below. It seems like there is no network provider. But How can I enabled it?? I have been stuck in this for ages and have no clues.(GPS is working fine)

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)

Upvotes: 1

Views: 3563

Answers (1)

Jaythaking
Jaythaking

Reputation: 2102

Have you added this to your manifest?

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

Also, to be sure you have enable the location update in your phone setting, you can prompt the user to enable it using this method

Upvotes: -1

Related Questions