运行时错误--java.lang.IllegalArgumentException:provider=gps

发布于 2025-01-01 08:56:37 字数 1996 浏览 2 评论 0原文

我从我创建的 Android 应用程序的用户日志中收到此错误。到目前为止我还无法复制该错误。任何帮助将不胜感激。

错误是:

java.lang.IllegalArgumentException: provider=gps
at android.os.Parcel.readException(Parcel.java:1326)
at android.os.Parcel.readException(Parcel.java:1276)
at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:646)
at android.location.LocationManager._requestLocationUpdates(LocationManager.java:582)
at android.location.LocationManager.requestLocationUpdates(LocationManager.java:446)
at com.myApp.service.DeviceManager$7.handleMessage(DeviceManager.java:470)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(Native Method)

它引用的devicemanager位置是:

private final Handler uihandler = new Handler() {

 @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MSG_TOAST:
                    Toast.makeText(DeviceManager.this, msg.arg1, Toast.LENGTH_SHORT).show();
                    break;

                case MSG_ENABLE_LOCATION:
                    mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 1,DeviceManager.this);
                   mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
                            60000, 1, DeviceManager.this);
                    break;

                case MSG_DISABLE_LOCATION:
                    mLocationManager.removeUpdates(DeviceManager.this);
                    break;

                case MSG_STOP_SELF:
                    break;
            }
        }

    };

I got this error from the user logs on an android app I created. I have been unable to replicate the error thus far. Any help would be extremely appreciated.

The error is:

java.lang.IllegalArgumentException: provider=gps
at android.os.Parcel.readException(Parcel.java:1326)
at android.os.Parcel.readException(Parcel.java:1276)
at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:646)
at android.location.LocationManager._requestLocationUpdates(LocationManager.java:582)
at android.location.LocationManager.requestLocationUpdates(LocationManager.java:446)
at com.myApp.service.DeviceManager$7.handleMessage(DeviceManager.java:470)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(Native Method)

The devicemanager location it refers to is:

private final Handler uihandler = new Handler() {

 @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MSG_TOAST:
                    Toast.makeText(DeviceManager.this, msg.arg1, Toast.LENGTH_SHORT).show();
                    break;

                case MSG_ENABLE_LOCATION:
                    mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 1,DeviceManager.this);
                   mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
                            60000, 1, DeviceManager.this);
                    break;

                case MSG_DISABLE_LOCATION:
                    mLocationManager.removeUpdates(DeviceManager.this);
                    break;

                case MSG_STOP_SELF:
                    break;
            }
        }

    };

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

虫児飞 2025-01-08 08:56:37

抱歉忘记发布解决方案。该问题最终是由于用户在位置更新过程中强行关闭应用程序造成的。我们对此无能为力!

Sorry forgot to post the solution. The problem ended up being due to a user force closing the app in the middle of a location update. Nothing we can do about that!

蹲在坟头点根烟 2025-01-08 08:56:37

IllegalArgumentException 如果提供程序为 null 或不存在。确保 GPS 提供商已启用。

您检查过这个教程吗?您是否添加了以下条目清单文件?

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

IllegalArgumentException if provider is null or doesn't exist. Make sure GPS provider enabled.

Did you check this tutorial? Have you added following entry manifest file?

  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文