谷歌播放服务升级后的空白屏幕 [英] Blank screen after google play-services upgrade

查看:145
本文介绍了谷歌播放服务升级后的空白屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用在版本com.google.android.gms:play-services:5.0.89上使用了谷歌地图2年。当我尝试升级时,该应用程序将不显示GUI,只显示空白屏幕。



可能与这里,但是没有解决办法,只能降级。



我试过了

  compile'c​​om.google.android.gms:play-services:9.6.0'

也只是子集,因为我不使用其他服务

  compile'c​​om.google.android.gms:play-services-maps:9.6.0'
compile'c​​om.google.android.gms:play-services -analytics:9.6.0'

这是完整的gradle脚本

  apply plugin:'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion24.0.0

defaultConfig {
applicationIdcz.benhur.vfrdroid
minSdkVersion 17
targetSdkV ersion 23
versionCode 12
versionName1.12

// http://developer.android.com/tools/building/multidex.html
// multiDexEnabled true

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
包装选项{
不包括'META-INF / LICENSE'
不包括'META-INF / LICENSE.txt'
不包括'META-INF / NOTICE '
exclude'META-INF / NOTICE.txt'
}

compileOptions {
// sourceCompatibility JavaVersion.VERSION_1_7
// targetCompatibility JavaVersion.VERSION_1_7
}

testOptions {
unitTests.returnDefaultValues = true
}
}

依赖关系{
//编译'com.android.support:multidex:1.0.0'
compile'c​​o m.android.support:support-v13:23.4.0'
compile fileTree(dir:'libs',include:['* .jar'])

compile'c​​om.google .android.gms:play-services-maps:9.6.0'
compile'c​​om.google.android.gms:play-services-analytics:9.6.0'

// MPAndroidChart ,geodesy:apache2 license
compile'c​​om.dropbox.core:dropbox-core-sdk:2.1.1'
compile'c​​om.github.PhilJay:MPAndroidChart:v2.2.2'
compile 'org.gavaghan:geodesy:1.1.3'

// testCompile'junit:junit:4.12'
}

解决方案

经过2天的复制粘贴我的代码片段到新项目,我发现问题:


  1. 我的应用有2个地图片段。我曾经在setUpMapIfNeeded()中的每个元素上调用getMap()。我必须更新getMapAsync()。
  2. setUpMapIfNeeded()是从onCreate()和onResume()调用的。如果我删除第二个setUpMapIfNeeded()(或第二个getMapAsync()),那么所有的东西都可以被删除。
  3. 工作正常。


    My app uses google maps for 2 years on version com.google.android.gms:play-services:5.0.89. When I try to upgrade, the app will show no GUI, just blank screen.

    Probably the same issue as here, but there is no solution but downgrade.

    I have tried

    compile 'com.google.android.gms:play-services:9.6.0'
    

    and also just subset as I do not use other services

    compile 'com.google.android.gms:play-services-maps:9.6.0'
    compile 'com.google.android.gms:play-services-analytics:9.6.0'
    

    Here is complete gradle script

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 23
        buildToolsVersion "24.0.0"
    
        defaultConfig {
            applicationId "cz.benhur.vfrdroid"
            minSdkVersion 17
            targetSdkVersion 23
            versionCode 12
            versionName "1.12"
    
            // http://developer.android.com/tools/building/multidex.html
            //multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        packagingOptions {
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/NOTICE.txt'
        }
    
        compileOptions {
    //        sourceCompatibility JavaVersion.VERSION_1_7
    //        targetCompatibility JavaVersion.VERSION_1_7
        }
    
        testOptions {
            unitTests.returnDefaultValues = true
        }
    }
    
    dependencies {
        //compile 'com.android.support:multidex:1.0.0'
        compile 'com.android.support:support-v13:23.4.0'
        compile fileTree(dir: 'libs', include: ['*.jar'])
    
        compile 'com.google.android.gms:play-services-maps:9.6.0'
        compile 'com.google.android.gms:play-services-analytics:9.6.0'
    
        // MPAndroidChart, geodesy: apache2 license
        compile 'com.dropbox.core:dropbox-core-sdk:2.1.1'
        compile 'com.github.PhilJay:MPAndroidChart:v2.2.2'
        compile 'org.gavaghan:geodesy:1.1.3'
    
        //testCompile 'junit:junit:4.12'
    }
    

    解决方案

    After 2 days spent copy-pasting my code piece by piece to new project I found the problem:

    1. my app have 2 map fragments. I used to call getMap() on each in setUpMapIfNeeded(). I have to update to getMapAsync().
    2. setUpMapIfNeeded() was called from onCreate() and from onResume(). This was probably generated by Android Studio 2 years ago.

    If I remove second setUpMapIfNeeded() (or second getMapAsync()), everything works ok.

    这篇关于谷歌播放服务升级后的空白屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆