我在kitkat和jellybean上找不到类错误。我在软糖,kitkat模拟器,棒棒糖和marshmellow物理设备上测试了我的应用程序。
我搜索了很多帖子,但所有帖子都显示卸载和清除,或使用play-service-maps
代替play-service
。但是我需要使用play-services
因为标记和所有东西。
请帮我解决这个问题。
错误
12-12 21:08:59.289 3396-3396/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.thetech.ambulancerequest, PID: 3396
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.thetech.ambulancerequest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.thetech.ambulancerequest-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:4793)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.thetech.ambulancerequest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.thetech.ambulancerequest-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:4778)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
这是我的 app> gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.thetech.ambulancerequest"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", "Ambulance Requests-$versionName")
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'eu.the4thfloor.volley:com.android.volley:2015.05.28'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
SplashSvcreen
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_splash);
MultiDex.install(this);
答案 0 :(得分:2)
在build.gradle
compile 'com.google.android.gms:play-services:10.0.1'
为此:
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
请注意,the documentation建议仅使用必要的Play服务模块,而不是依赖于整个Play服务库:
如果您的应用中方法引用的数量超过65K限制,您的应用可能无法编译。通过仅指定应用使用的特定Google Play服务API而非全部API,您可以在编译应用时缓解此问题。有关如何执行此操作的信息,请参阅将API选择性地编译到可执行文件中。