我正在尝试在我的设备中测试我的Android应用程序。
首先,我在android 6
进行了测试,它运行正常,当我尝试安装在我的Android 4.4.2
设备中时,它崩溃了。
这是我的gradle文件中的sdk信息
compileSdkVersion 25
buildToolsVersion "25.0.2"
minSdkVersion 14
targetSdkVersion 25
这里任何人都有任何想法可以帮助我。
logcat的:
02-22 12:46:17.170 2136-2136/? D/dalvikvm: Not late-enabling CheckJNI (already on)
02-22 12:46:17.190 2136-2136/? D/AndroidRuntime: Shutting down VM
02-22 12:46:17.190 2136-2136/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x9cd8eb20)
02-22 12:46:17.190 2136-2142/? E/jdwp: Failed sending reply to debugger: Broken pipe
02-22 12:46:17.190 2136-2142/? D/dalvikvm: Debugger has detached; object registry had 1 entries
02-22 12:46:17.190 2136-2136/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.kaouther.needtaxi, PID: 2136
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.example.kaouther.needtaxi-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.kaouther.needtaxi-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.example.kaouther.needtaxi-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.kaouther.needtaxi-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)
02-22 12:47:36.370 2136-2136/? I/Process: Sending signal. PID: 2136 SIG: 9
答案 0 :(得分:0)
此问题的一个重要原因(在较低版本的Android设备上)是添加Play服务依赖项。避免添加整个Play服务gradle依赖项。而不是整个Play服务依赖项,只添加您将在项目中使用的特定依赖项(例如:位置,地图,地点等)。
通过以下步骤启用Multidex:
在Build.gradle中(模块:app) 'defaultConfig { applicationId“com。***。****” minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName“1.0” multiDexEnabled是的 }“
将insert添加到依赖项中: 编译'com.android.support:multidex:1.0.1'
然后将代码添加到清单: 机器人:名称= “android.support.multidex.MultiDexApplication”
希望。它会起作用。