我的应用程序在真实设备或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)
尝试了一些解决方案,没有工作
Unable to get provider com.google.android.gms.measurement.AppMeasurementContentProvider
我的应用级别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
}
答案 0 :(得分:4)
我通过添加
解决了这个问题 implementation 'com.google.firebase:firebase-core:16.0.0'
答案 1 :(得分:2)
我在没有安装Play服务的所有设备上都经历过相同的体验。尽管如此,更新到最新的firebase版本仍有帮助:
org.springframework.http
答案 2 :(得分:0)
我在KitKat上遇到过这样的问题。这就是我所做的:
最新版本号:https://developers.google.com/android/guides/google-services-plugin