java.lang.SecurityException异常:无效的包名称:com.google.android.gms [英] java.lang.SecurityException: invalid package name: com.google.android.gms

查看:3038
本文介绍了java.lang.SecurityException异常:无效的包名称:com.google.android.gms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个奇怪的堆栈跟踪在测试上三星Galaxy S2(GT-I9100),安卓4.3版本的应用程序。如果有帮助,Bugsense报道也记录数据= {u'ms_from_start':u'19915,u'rooted:u'true'},所以我不是很肯定,如果这个设备是植根与否(客户端是测试应用程序,而不是我)。 编辑:当我打字这一点,客户确认我该设备的定制ROM,如果它的问题

I've got this weird stack trace while testing the app on Samsung Galaxy S2 (GT-i9100), Android version 4.3. If it helps, Bugsense reports also "log data" = {u'ms_from_start': u'19915', u'rooted': u'true'} , so I'm not quite sure if this device is rooted or not (client is testing the app, not me). While I'm typing this, client confirmed me that the device is having custom ROM, if it matters.

总之,这是一个完整的堆栈跟踪:

Anyhow, this is a complete stack trace:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mypackagename/com.mypackagename.activities.ARActivity}: 

java.lang.SecurityException: invalid package name: com.google.android.gms
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2355)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2405)
    at android.app.ActivityThread.access$600(ActivityThread.java:156)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5303)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
    at dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.SecurityException: invalid package name: com.google.android.gms
    at android.os.Parcel.readException(Parcel.java:1431)
    at android.os.Parcel.readException(Parcel.java:1385)
    at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:540)
    at android.location.LocationManager.requestLocationUpdates(LocationManager.java:836)
    at android.location.LocationManager.requestLocationUpdates(LocationManager.java:430)
    at android.privacy.surrogate.PrivacyLocationManager.requestLocationUpdates(PrivacyLocationManager.java:290)
    at com.mypackagename.activities.ARActivity.onCreate(ARActivity.java:371)
    at android.app.Activity.performCreate(Activity.java:5259)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1098)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2309)

现在,ARActivity.java:371只是调用

Now, ARActivity.java:371 is just calling

locationManager.requestLocationUpdates(GPS, gpsRefreshPeriod, 0, locListener);

其中

private String GPS = "gps";
private int gpsRefreshPeriod = 500;

和locListener是LocationListener的。

and locListener is locationListener.

现在,我不知道有什么可以去错在这里,我不能在我的测试设备(三星Galaxy TAB2,摩托罗拉Atrix 4G,三星注2,Galaxy Nexus的)重现此错误。

Now, I have no idea what could go wrong here, and I can't reproduce this error on my testing devices (Samsung Galaxy Tab2, Motorola Atrix 4G, Samsung Note2, Galaxy Nexus).

我想有可能是com.google.android.gms检查不知何故,也许有可能是意图(或某事),若缺少包,用户更新设备的分量。但我完全不知道我要到正确的方向这一思想。

I guess there could be a check for com.google.android.gms somehow, and maybe there could be Intent (or something) that in case of missing that package, user updates device's component.. But I'm totally not sure if I'm going into the right direction with this thinking.

任何想法或经验,本次大跌?

Any ideas or experience with this crash?

感谢。

推荐答案

一些我用来测试doesn't有能力,以支持全球定位系统,并得到了定位装置,那是什么,我得到了异常的原因。

Some devices that i use for testing doesn´t have capabilities to support gps and get the location, that was the reason for what i got the exception

无效的包名:com.google.android.gms

"invalid package name: com.google.android.gms"

我们必须添加所需的权限

We must add permissions required

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

和非常重要的附加的机器人:要求=假的为GPS

and very important add android:required=false" for GPS.

  <uses-feature
         android:name="android.hardware.location.gps"
         android:required="false" />

更多信息:&LT; 使用特征>

这篇关于java.lang.SecurityException异常:无效的包名称:com.google.android.gms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆