之前我已经构建了mapActivity并且它工作得很好并且地图出现了...我在其他项目上工作以获取地图但它没有工作....我回到我的第一个mapActivity项目(它完美地工作)并再次推出(从我的手机中删除其地图应用程序后),但它没有工作,并给我空白地图 有错误: 1 - 找不到类'android.app.AppOpsManager',从方法com.google.android.gms.internal.zzro.zzg中引用 2-无法找到从方法rv.a引用的类'android.app.AppOpsManager' 3-认证失败。尝试联系服务器时超时。 并且在Manifest中:
<?xml version="1.0" encoding="utf-8"?>
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<permission
android:name="com.example.asus.myapplicationhello.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="com.example.asus.myapplicationhello.permission.MAPS_RECEIVE"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:largeHeap="true"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<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="@string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
这是gradle
apply plugin: 'com.android.application'
android { compileSdkVersion 24 buildToolsVersion“24.0.1”
defaultConfig {
applicationId "com.example.asus.myapplicationhello"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
依赖{ 编译fileTree(dir:'libs',包括:['* .jar']) testCompile'junit:junit:4.12' 编译'com.android.support:appcompat-v7:24.2.0' 编译'com.google.android.gms:play-services:9.4.0' 编译'com.android.support:multidex:1.0.0' }