android - 升级 gradle 版本后,谷歌地图停止显示

标签 android google-maps android-studio gradle

Here is screen of my app, this working before i upgrade some of gradle files version

Bellow 是我的 list 文件元数据

 <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="HERE IS MY API KEY" />

这是我的 Gradle 文件
 compileSdkVersion 24
buildToolsVersion "24.0.0"


dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':DatePicker')
compile project(':agendacalendarview')
compile files('libs/acra-4.5.0.jar')
compile project(':MaterialCalenderView')
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.sothree.slidinguppanel:library:3.3.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.sothree.slidinguppanel:library:3.3.0'
compile 'com.android.support:design:24.2.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.hbb20:ccp:1.4'
compile 'com.github.scottyab:showhidepasswordedittext:0.8'
compile 'com.vistrav:ask:2.4'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.android.volley:volley:1.0.0'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.apache.httpcomponents:httpmime:4.2.3'

compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okio:okio:1.7.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.google.code.gson:gson:2.7'
compile 'org.apmem.tools:layouts:1.10@aar'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.mani:ThinDownloadManager:1.2.4'
compile 'com.jakewharton:butterknife:7.0.0'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.tbuonomo:slidingpuzzleloading:1.0.1'
testCompile 'junit:junit:4.12'

}

应用插件:'com.google.gms.google-services'

这是我的项目 Gradle
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'
    classpath 'com.google.gms:google-services:3.0.0'
    classpath 'me.tatarka:gradle-retrolambda:3.1.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

我已尝试从 MAP API 升级所有最新代码

但它现在不起作用。我也用过android studio 2.3版

这是我仅适用于 MAP 的应用程序代码

公共(public)类 MapsActivity 扩展 FragmentActivity 实现 OnMapReadyCallback {
private GoogleMap mMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}

@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    // Add a marker in Sydney and move the camera
    LatLng sydney = new LatLng(-34, 151);
    mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}

}

MAP View 的 XML
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.squincy.inhup.Activity.MapsActivity" />

最佳答案

嗨@pmrajnai13 您的 AndroidManifest.xml 文件中缺少您的 google map api key 。添加该 google map api key 。

关于android - 升级 gradle 版本后,谷歌地图停止显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43065859/

相关文章:

android - 错误 :failed to find Build Tools revision 23. 0.0 rc2 - Android Studio

javascript - 在 webview 中显示网页的一部分

java - 为什么不显示工具栏?

java - 如何使用 NIO 从服务器检索数据

android - IOS : Cordova App Crash on Google Map api zoom in ios 11. 3 iphone x

google-maps - 移除 Google map 信息气泡

android - 如何在二维 View 中显示谷歌地图?

macos - 适用于 macOS 的 Android Studio 3.5 Gradle 位置?

android - 在 Android 上设计图形

java - 如何仅将来电铃声静音而不将短信静音