android - 谷歌地图根本没有加载,没有任何错误
问题描述
谷歌地图仍然闪烁并且不加载。所有脚本、api 密钥和代码都是正确的。
应用程序gradle
文件是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.muzammil.bustracking"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-location:+'
implementation 'com.google.android.gms:play-services-maps:+'
implementation 'com.google.firebase:firebase-core:+'
implementation 'com.google.firebase:firebase-auth:+'
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-messaging:+'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support:design:26.1.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// apply plugin: 'com.google.gms.google-services'
}
apply plugin: 'com.google.gms.google-services'
我在实际的 Android 手机上运行应用程序,而不是模拟器。
非常感谢您的回答...
解决方案
我终于找到了解决办法。
实际上,我是在 API 级别 24 的 Android 设备上运行该应用程序,而该应用程序使用的是 API 级别 26。我将目标 SDK 版本从File > Project Structure > app > flavor从 26 更改为 24 ,它可以正常工作。
谢谢大家帮忙!我真的很感激。
推荐阅读
- r - R 结构化数据以允许并排比较
- spark-streaming - 寻找实时流媒体解决方案
- node.js - 添加 firebase firestore 条目失败:7 PERMISSION_DENIED
- python - 如何在 Airflow Operator 中将 Python 函数应用于 Airflow XCom_pull 值
- amazon-web-services - 作为 AWS 组织中的管理账户/委派管理员,如何为 AWS SDK 中的每个成员账户调用 AWS 服务?
- swift - 如何确定哪个 UITextField 编辑确实在 IBAction 内结束?
- pine-script - Pine 脚本如何添加标签而不是绘图
- python - 如何检查两个熊猫数据列中元素的整数部分是否匹配?
- android - Android Canvas如何在同一点画线
- html - 页脚不遵循自动间距