尝试加载Google地图时,即时应用会崩溃

时间:2017-06-20 22:37:02

标签: android android-instant-apps

我们正准备发布我们的即时应用,但是,在尝试初始化Google地图时,我们遇到了安全例外情况。以下是正在发生的错误。经过多次尝试解决问题和无数谷歌搜索,我们还没有找到解决方案。已安装的应用程序不会发生此问题。任何帮助将不胜感激。

06-20 11:10:57.263 13891-13891/com.myapp.example.debug E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.myapp.example.debug, PID: 13891
                                                                           java.lang.SecurityException: Failed to find provider com.google.android.gsf.gservices for user 0; expected to find a valid ContentProvider for this authority

与即时应用关联的build.gradle文件:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.22.2'
    }
}

apply plugin: 'com.android.instantapp'
apply plugin: 'io.fabric'

repositories {
    jcenter()
    flatDir {
        dirs '../libs'
    }
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

android {

    compileSdkVersion rootProject.compileSdk
    buildToolsVersion rootProject.buildTools

    def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()

    defaultConfig {
        minSdkVersion rootProject.minSdk
        targetSdkVersion rootProject.compileSdk
    }

    signingConfigs {

        flavor1Release {
            storeFile file('../publish/flavor1-release.keystore')
            storePassword System.getenv("FLAVOR_1_STORE_PASSWORD")
            keyAlias "flavor1"
            keyPassword System.getenv("FLAVOR_1_KEY_PASSWORD")
            v2SigningEnabled true
        }

        flavor2Release {
            storeFile file('../publish/flavor2-release.keystore')
            storePassword System.getenv("FLAVOR_2_STORE_PASSWORD")
            keyAlias "flavor2"
            keyPassword System.getenv("FLAVOR_2_KEY_PASSWORD")
            v2SigningEnabled true
        }

        debug {
            storeFile file('../publish/debug.keystore')
        }
    }

    flavorDimensions rootProject.flavorDimensions

    productFlavors {
        flavor1 {
            applicationId rootProject.flavor1PackageName
            versionCode rootProject.flavor1VersionCode
            versionName rootProject.flavor1VersionName

            dimension rootProject.flavorDimensions
        }

        flavor2 {
            applicationId rootProject.flavor2PackageName
            versionCode rootProject.flavor2VersionCode
            versionName rootProject.flavor2VersionName

            dimension rootProject.flavorDimensions
        }
    }

    buildTypes {

        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug-${gitSha}"
            signingConfig signingConfigs.debug
        }

        release {
            productFlavors.flavor1.signingConfig signingConfigs.flavor1Release
            productFlavors.flavor2.signingConfig signingConfigs.flavor2Release
        }
    }
}

dependencies {
    implementation project(':features:base')
    implementation project(':features:auth')
    implementation project(':features:chat')
    implementation project(':features:filter')
    implementation project(':features:search')
    implementation project(':features:message')
}

编辑:

将gms库更新为11.0.2

后解决

0 个答案:

没有答案