当前位置: 首页 > 知识库问答 >
问题:

Genymotion无法实例化服务com.google.Androidgms。测量AppMeasurementService

邹浩
2023-03-14

我的应用程序在真实设备或AndroidAVD上运行得非常完美,但由于AVD占用了大量内存,所以我安装了Genymotion。

现在,当应用程序启动时,应用程序崩溃,日志丢失

04-30 02:29:40.933 2199-2217/com.amelio E/FirebaseInstanceId: Google Play services missing or without correct permission.
04-30 02:29:41.328 2199-2218/com.amelio E/FA: AppMeasurementService not registered/enabled
04-30 02:29:41.329 2199-2218/com.amelio E/FA: Uploading is not possible. App measurement disabled
04-30 02:29:41.632 2199-2199/com.amelio E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.amelio, PID: 2199
    java.lang.RuntimeException: Unable to instantiate service com.google.android.gms.measurement.AppMeasurementService: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.AppMeasurementService" on path: DexPathList[[zip file "/data/app/com.amelio-2/base.apk"],nativeLibraryDirectories=[/data/app/com.amelio-2/lib/x86, /data/app/com.amelio-2/base.apk!/lib/x86, /system/lib, /vendor/lib]]
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3176)
        at android.app.ActivityThread.-wrap5(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.AppMeasurementService" on path: DexPathList[[zip file "/data/app/com.amelio-2/base.apk"],nativeLibraryDirectories=[/data/app/com.amelio-2/lib/x86, /data/app/com.amelio-2/base.apk!/lib/x86, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3173)
        at android.app.ActivityThread.-wrap5(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6119) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

尝试了一些解决方案,都不管用

无法获取提供程序com.google.android.gms.measurement.AppDimurementContentProvider

JAVAlang.RuntimeException:无法实例化服务com.google.Androidgcm。GCMBroadcastereceiver

我的应用级别build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    defaultConfig {
        applicationId "com.amelio"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dataBinding {
        enabled = true
    }
    compileOptions {
        sourceCompatibility rootProject.ext.sourceCompatibilityVersion
        targetCompatibility rootProject.ext.targetCompatibilityVersion
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}
def SDP_VERSION = '1.0.5'
def PERCELER_VERSION = '1.1.10'

dependencies {
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v13'
    }
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation rootProject.ext.dep.supportAppcompatV7
    implementation rootProject.ext.dep.supportRecyclerViewV7
    implementation rootProject.ext.dep.supportV4
    implementation rootProject.ext.dep.supportDesign
    implementation rootProject.ext.dep.playServicesAuth
    implementation rootProject.ext.dep.retrofit2ConverterGson
    implementation rootProject.ext.dep.retrofit2
    implementation rootProject.ext.dep.playServicesLocation
    implementation rootProject.ext.dep.playServicesMaps
    implementation rootProject.ext.dep.playServicesPlaces
    implementation rootProject.ext.dep.firebaseMessaging
    implementation rootProject.ext.dep.materialDatePicker
    implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
    implementation "com.intuit.sdp:sdp-android:$SDP_VERSION"
    implementation "com.intuit.ssp:ssp-android:$SDP_VERSION"
    implementation rootProject.ext.dep.picasso
    implementation 'com.wdullaer:materialdatetimepicker:3.5.1'
    implementation 'me.dm7.barcodescanner:zbar:1.9.8'
//  implementation 'com.google.android.gms:play-services:11.6.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
    implementation "org.parceler:parceler-api:$PERCELER_VERSION"
    annotationProcessor "org.parceler:parceler:$PERCELER_VERSION"
    implementation rootProject.ext.dep.butterKnife
    annotationProcessor rootProject.ext.dep.butterKnifeCompiler
}
apply plugin: 'com.google.gms.google-services'

我已经应用了apply插件:'com.google.gms。谷歌服务已经发布了

项目级build。渐变

// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: rootProject.file('dependencies.gradle')

buildscript {

    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

共有3个答案

海宁
2023-03-14

我在奇巧身上遇到了这样的问题。这就是我所做的:

  1. 升级项目gradle: classpath'com.google.gms: google-service: 4.0.1'

最新版本号:https://developers.google.com/android/guides/google-services-plugin

最新版本号如下:https://firebase.google.com/docs/android/setup

郑星雨
2023-03-14

我在没有安装播放服务的所有设备上都经历过同样的情况。更新到最新的firebase版本有助于:

classpath 'com.google.gms:google-services:3.3.0'

implementation 'com.google.android.gms:play-services-analytics:15.0.2'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.firebase:firebase-appindexing:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
那存
2023-03-14

我用add解决了这个问题

实现com.google.firebase:Firebase核心:16.0.0

 类似资料:
  • 我正在尝试添加Google Play服务到Genymotion但遇到了问题。我正在按照这里的说明操作,我运行的是MacBook Pro。当我尝试将Google应用程序文件拖放到GenyMotion中时,我收到以下错误。我正在运行一个使用Android 4.3的HTC设备: 这可能与没有正确地重新启动仿真程序有关。我只是关闭并通过Android Studio再次启动。

  • 问题内容: 我正在尝试创建一个,所以我可以向JNDI请求一些企业Java Bean。JBoss运行正常,但是当我运行Java代码时,出现异常。 我正在运行JBoss 7.1 这是我的代码: 在启动JBoss服务器之后,我尝试运行Java代码,并得到以下异常: 可能是什么问题? 问题答案: InitialContext属性不适用于您使用的JBoss版本。使用JBoss 7,当您从远程客户端调用ejb

  • 我正在使用Firebase消息,当我从Firebase控制台收到通知时,我的应用程序关闭,但出现此异常。有人能建议我应该怎么做吗?我正在与此问题斗争两个多小时了 我的Firebase Messagin版本是 我对firebaseMessaging的依赖性是 JAVAlang.RuntimeException:无法实例化服务com。桑里德。搭档JAVAMyFirebaseMessagingServi

  • 我试图使用Postgis 2.2和Postgreql 9.5与JPA,Postgis 9.5方言。我已经在pom.xml的要求,按这里http://www.hibernatespatial.org/documentation/documentation/和类型导入正确,但是当我试图运行程序使用几何类型我得到这个错误: 我显然遗漏了一些配置,有人能指出是什么吗?

  • 我在MapFragment的布局文件中出现了这个错误 我试过了 > 安装Google Play服务,但仍有错误 - com.google.android.gms.maps.MapFragment(开放类,显示异常,清除缓存) 提示:在自定义视图中使用view.isinEditMode()跳过代码或在IDE中显示示例数据。 如果这是一个意外错误,您也可以尝试构建项目,然后手动刷新布局。 异常详细信息

  • 我正在将一个Java EE应用程序部署到Bluemix,当第一个请求到达时,我得到了这个错误: 2015-05-20T23:11:58.51+0200[app/0]OUT[INFO]FFDC1015I:已创建FFDC事件:“java.util.ServiceConfigurationError:javax.servlet.ServletContainerInitializer:Provider o