Firebaseを使用しているため、アプリの起動時にサポートされているバージョンのGoogle Playサービスがあることを確認する必要があります。 GooglePlayServicesUtilは推奨されていません。したがって、私は新しい光沢のあるGoogleApiAvailability APIを使用しており、アップグレードが必要かどうかを検出できます。Android 6以降でGoogle Playサービスエラーを解決するにはどうすればよいですか?
しかし私が使用するときは、GoogleApiAvailability.getErrorDialogは必要なインテントを起動しません。それは何もしません。インターネットのトロールは有用なコードサンプルを明らかにしません。理想的には、独自のカスタムダイアログを作成してpendingIntentを起動したいと思いますが、これも難解です。私のコード:
final GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
final int resultCode = googleAPI.isGooglePlayServicesAvailable(this);
if (resultCode == ConnectionResult.SUCCESS) {
if (isOnline()) {
app.init(this, this);
}
} else {
switch (resultCode) {
case SERVICE_VERSION_UPDATE_REQUIRED:
Dialog updateDialog = googleAPI.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST, mOnCancelFinishApp);
updateDialog.setOnDismissListener(mOnDismissFinishApp);
updateDialog.setCanceledOnTouchOutside(false);
updateDialog.show();
...
アップデート:私のGradleは
.....
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.microsoft.aad:adal:2.0.1-alpha') {
exclude group: 'com.android.support'
}
compile 'com.google.android.gms:play-services-location:10.0.0'
compile('com.crashlytics.sdk.android:answers:[email protected]') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.google.android.gms:play-services-maps:10.0.0'
compile 'com.google.android.gms:play-services-location:10.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.google.android.gms:play-services-analytics:10.0.0'
compile 'com.google.firebase:firebase-core:10.0.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
}
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
ください。あなたのgradleファイルを更新する –
@YogeshBorhade私は自分のgradleファイルからの依存関係を含んでいます。 – giulio
あなたのグラデルファイルを投稿してください –