Genymotion Невозможно создать экземпляр службы com.google.android.gms.measurement.AppMeasurementService - PullRequest
0 голосов
/ 30 апреля 2018

Мое приложение отлично работало на реальных устройствах или Android AVD, но поскольку 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.AppMeasurementContentProvider

java.lang.RuntimeException: невозможно создать экземпляр службы com.google.android.gcm.GCMBroadCastReceiver

Уровень моего приложения 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 plugin: 'com.google.gms.google-services'.

Уровень проекта build.gradle

// 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 ]

0 голосов
/ 28 мая 2018

Я решил эту проблему с помощью добавления

implementation 'com.google.firebase:firebase-core:16.0.0'

0 голосов
/ 03 июня 2018

Такая проблема у меня была на KitKat. Вот что я сделал:

  1. Обновить проект gradle: classpath 'com.google.gms: google-services: 4.0.1'

номер последней версии здесь: https://developers.google.com/android/guides/google-services-plugin

  1. Обновление приложения gradle: реализация 'com.google.firebase: firebase-core: 16.0.0'

номер последней версии здесь: https://firebase.google.com/docs/android/setup

0 голосов
/ 07 мая 2018

Я испытал то же самое на всех устройствах без установленных Play Services. Обновление до последних версий 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'
...