我正在开发一个谷歌地图应用程序,它在模拟器中与android棉花糖一起工作良好,但在android Ics 4.03模拟器中运行时显示错误,它显示错误。我尝试在emulator
中安装playstore
和play services
提前感谢
java.lang.RuntimeException: Unable to create application com.google.android.gms.common.app.GmsApplication: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10044 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3957)
at android.app.ActivityThread.access$1300(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10044 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES.
at android.app.ContextImpl.enforce(ContextImpl.java:1238)
at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1267)
at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:418)
at com.google.android.gsf.f.c(SourceFile:107)
at com.google.android.gsf.f.a(SourceFile:121)
at com.google.android.gsf.f.a(SourceFile:227)
at com.google.android.gms.common.b.m.a(SourceFile:304)
at com.google.android.gms.common.b.f.a(SourceFile:222)
at com.google.android.gms.common.b.e.c(SourceFile:200)
at com.google.android.gms.common.app.GmsApplication.onCreate(SourceFile:92)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3954)
at android.app.ActivityThread.access$1300(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at `com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)`
这是我的manifest文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mema_labs.com.thirdeye">
<permission
android:name="com.mema_labs.com.thirdeye.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:protectionLevel="normal" />
<permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:protectionLevel="normal" />
<uses-permission android:name="com.mema_labs.com.thirdeye.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/-->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:name="com.mema_labs.com.thirdeye.app.AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API KEY" />
<activity
android:name=".LoginActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RegisterActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan"></activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoActionBar"></activity>
<activity
android:name=".TempActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoActionBar"
android:noHistory = "true"
></activity>
<activity
android:name=".MyActivity"
android:label="@string/app_name"
></activity>
</application>
您的logs
清楚地说明您缺少permission
。
注释掉这个权限:
com.google.android.providers.gsf.permission.READ_GSERVICES
请删除这一行的注释
<!--uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/-->
<!-- Anything in between these will be considered as comments -->
所以删除它们,然后尝试