2017-10-07 295 views
0

我正在嘗試檢查我的應用程序在模擬器上的工作情況,但是當我嘗試使用谷歌登錄選項登錄選項時,我的應用程序僅顯示有「Google Play服務錯誤」的敬酒。Google Play服務在模擬器上出錯

此外,當我去登錄屏幕,更新對話框出現沒有寫上它。

我試圖更新我的谷歌播放服務到最新版本,但它沒有幫助。有誰知道如何在我的模擬器上使用Google登錄的解決方案?

這裏是我的gradle構建:

apply plugin: 'com.android.application' 
apply plugin: 'com.google.firebase.firebase-crash' 

android { 
signingConfigs { 
    config { 

    } 
} 
compileSdkVersion 25 
buildToolsVersion "25.0.2" 
defaultConfig { 
    applicationId "com.fromworldwide.from" 
    minSdkVersion 21 
    targetSdkVersion 23 
    versionCode 19 
    versionName "2.8" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    multiDexEnabled true 
} 
packagingOptions { 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/DEPENDENCIES' 
    exclude '.readme' 
} 
buildTypes { 
    release { 
     debuggable false 
     minifyEnabled true 
     shrinkResources true 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     signingConfig signingConfigs.config 

    } 
    debug { 
     debuggable true 
     minifyEnabled false 
     shrinkResources false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
useLibrary 'org.apache.http.legacy' 
} 

buildscript { 
repositories { 
    mavenCentral() 
    maven { url 'https://maven.fabric.io/public' } 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle:2.2.3' 
    classpath 'io.fabric.tools:gradle:1.+' 

} 
} 

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
compile 'com.android.support:support-v4:25.2.0' 
compile 'com.android.support:design:25.2.0' 
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1' 
testCompile 'junit:junit:4.12' 

compile 'com.google.firebase:firebase-database:11.0.2' 
compile 'com.google.firebase:firebase-auth:11.0.2' 
compile 'com.google.firebase:firebase-storage:11.0.2' 
compile 'com.google.firebase:firebase-invites:11.0.2' 
compile 'com.google.firebase:firebase-crash:11.0.2' 
compile 'com.google.firebase:firebase-core:11.0.2' 
compile 'com.google.firebase:firebase-messaging:11.0.2' 

compile 'com.google.android.gms:play-services-basement:11.0.2' 
// Mandatory 
compile 'com.google.android.gms:play-services-location:11.0.2' 


} 
apply plugin: 'io.fabric' 

repositories { 
maven { url 'https://maven.fabric.io/public' } 
} 
apply plugin: 'com.google.gms.google-services' 

allprojects { 
repositories { 
    maven { url "https://jitpack.io" } 
} 
} 

enter image description here

回答

0

我認爲你缺少這是在文檔中提到的how you can test your app東西。

要使用谷歌Play服務SDK時,測試你的應用程序,您必須使用 之一:

  • 運行的Android 4.0或更高版本,包括谷歌Play商店兼容的Android設備。
  • Android模擬器的AVD運行基於Android 4.2.2或更高版本的Google API平臺。

還需要Add Google Play Services to Your Project

爲了使谷歌Play的服務的API,你的應用程序:

  1. 打開的build.gradle文件的應用模塊目錄中。

注:Android的Studio項目包含一個頂級的build.gradle文件和的build.gradle文件爲每個模塊。請務必編輯您的應用程序模塊的 文件。有關Gradle的更多信息,請參閱Building Your Project with Gradle

  1. 在依賴關係下爲最新版本的play-services添加新的構建規則。例如:

    apply plugin: 'com.android.application'

    ... 
    
    dependencies { 
        compile 'com.google.android.gms:play-services:11.4.2' 
    } 
    

確保您每次谷歌Play服務 更新更新此版本號。

注意:如果您的應用程序中的方法引用數量超過65K limit,您的應用程序可能無法編譯。通過僅指定應用使用的特定 Google Play服務API,而不是所有這些API,編譯您的應用時,您可能會緩解 此問題。有關如何執行此操作的信息,請參閱Selectively compiling APIs into your executable

  • 保存更改並點擊工具欄同步項目與搖籃文件
  • 相關問題