Blank screen after google play-services upgrade

空扰寡人 提交于 2020-01-26 04:34:13

问题


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'
}

回答1:


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.



来源:https://stackoverflow.com/questions/39729270/blank-screen-after-google-play-services-upgrade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!