java.lang.IllegalArgumentException:服务未注册:com.google.android.gms.internal.measurement.zziy@11da9cb2

时间:2019-04-16 09:00:16

标签: java android

每当我单击浮动操作按钮时,我的应用就会崩溃!! 我不明白问题出在哪里 我在任何地方的编码中都没有任何服务!! 我打开了该上下文wrapper.java,它仅包含错误! 就像下面的图片一样 [在此处输入图片描述] [1]

这是Logcat:

04-16 13:17:49.479 7430-7452/com.example.myfoodorderapp W/ContextImpl: forgetServiceDispatcher failed for:
    java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.internal.measurement.zziy@11da9cb2
        at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1105)
        at android.app.ContextImpl.unbindService(ContextImpl.java:1873)
        at android.content.ContextWrapper.unbindService(ContextWrapper.java:562)
        at com.google.android.gms.common.stats.ConnectionTracker.unbindService(Unknown Source)
        at com.google.android.gms.internal.measurement.zzik.disconnect(Unknown Source)
        at com.google.android.gms.internal.measurement.zzik.zzcv(Unknown Source)
        at com.google.android.gms.internal.measurement.zzik.zzc(Unknown Source)
        at com.google.android.gms.internal.measurement.zzil.run(Unknown Source)
        at com.google.android.gms.internal.measurement.zzeq.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at com.google.android.gms.internal.measurement.zzgm.run(Unknown Source)
04-16 13:17:55.019 7430-7452/com.example.myfoodorderapp W/ContextImpl: forgetServiceDispatcher failed for:
    java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.internal.measurement.zziy@11da9cb2
        at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1105)
        at android.app.ContextImpl.unbindService(ContextImpl.java:1873)
        at android.content.ContextWrapper.unbindService(ContextWrapper.java:562)
        at com.google.android.gms.common.stats.ConnectionTracker.unbindService(Unknown Source)
        at com.google.android.gms.internal.measurement.zzik.disconnect(Unknown Source)
        at com.google.android.gms.internal.measurement.zzik.zzcv(Unknown Source)
        at com.google.android.gms.internal.measurement.zzik.zzc(Unknown Source)
        at com.google.android.gms.internal.measurement.zzil.run(Unknown Source)
        at com.google.android.gms.internal.measurement.zzeq.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at com.google.android.gms.internal.measurement.zzgm.run(Unknown Source)

这是我的gradle版本:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.myfoodorderapp"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        android.defaultConfig.vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'info.hoang8f:fbutton:1.0.5'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.android.support:cardview-v7:26.+'
    implementation 'com.android.support:recyclerview-v7:26.+'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.firebaseui:firebase-ui-database:1.2.0'
    implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'





    implementation 'com.android.support:design:26.+'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}
apply plugin: 'com.google.gms.google-services'


// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.0.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

此清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myfoodorderapp">


    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".Cart"></activity>
        <activity android:name=".FoodDetail" />
        <activity android:name=".FoodList" />
        <activity
            android:name=".Home"
            android:label="@string/title_activity_home"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity android:name=".SignUp" />
        <activity android:name=".SignIn" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


  [1]: https://i.stack.imgur.com/pumeW.jpg

1 个答案:

答案 0 :(得分:0)

尝试一下?

    dependencies {
    implementation 'com.google.android.gms:play-services-basement:17.5.0'
}

如果它不起作用 尝试匹配如下所示的lib版本

compile 'com.google.android.gms:play-services-location:10.2.4'
apply plugin: 'com.google.gms.google-services'
compile 'com.google.firebase:firebase-messaging:10.2.4'