我正在构建一个使用谷歌地图api的应用程序。应用程序的第一个活动是地图活动,它根据我在标题中声明的错误拒绝运行。
我已经大量修改了我的build.gradle,试图修复问题;基于我在本网站上找到的其他解决方案。
但我想我可能会让情况变得更糟:这就是我的build.gradle的样子:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.navigation.dixongardens.ben.bensgardens"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:28.0.0-alpha1'
compile 'com.google.android.gms:play-services-maps:11.6.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.1'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.google.maps.android:android-maps-utils:+'
compile 'com.google.android.gms:play-services:11.8.+'
compile 'com.android.support:design:26.0.0-alpha1'
}
有人可以帮我指导我的build.gradle有什么问题吗?我很困惑谷歌服务需要哪些依赖项才能正常工作。
答案 0 :(得分:0)
这不是您的应用程序的问题,但是您的模拟器存在问题。您需要更新正在运行的模拟器/下载新的系统映像并从中创建模拟器。
此例外情况告诉您,Google地图需要比您设备上当前运行的版本更新的Google Play服务版本。有时,它会在通知下提供更新Google Play服务的链接。 (在谷歌地图视图的应用程序中)
答案 1 :(得分:0)
您无需执行任何操作,只需单击上面消息中显示的通知即可。然后,Google Play服务将自动更新。容易