java.lang.SecurityException: invalid package name: com.google.android.gms

前端 未结 4 781
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 18:02

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_s

相关标签:
4条回答
  • 2021-01-04 18:33

    These 2 questions are very similar:

    SecurityException when calling getLastKnownLocation

    Add Google Maps to my app

    Perhaps the issue is with the custom ROM and you need to attach the Play Services Android library project to your project.

    0 讨论(0)
  • 2021-01-04 18:43

    try to use

    <uses-library android:name="com.google.android.gms" />
    

    under application tag. Example

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name" >
        <uses-library android:name="com.google.android.gms" />
    
    0 讨论(0)
  • 2021-01-04 18:51

    It seems to me that this device simply does not have GoogleApps application installed. The custom ROM actually may be a hint for this. For instance, an owner of this device might have installed Cyanogenmod but he has forgotten (or deliberately has not installed) Google Apps, which are supplied separately.

    0 讨论(0)
  • 2021-01-04 18:54

    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

    "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"/>  
    

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

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

    More info: <uses-feature>

    0 讨论(0)
提交回复
热议问题