我是Android新手,我正试图在手机上运行我的应用程序(4.4.2),我收到以下错误:
02/09 18:48:02: Launching app
No apk changes detected since last installation, skipping installation of /Users/luisacabs/Documents/POLIMI/SharemyFlat/app/build/outputs/apk/app-debug.apk
$ adb shell am force-stop com.example.android.sharemyflat
$ adb shell am start -n "com.example.android.sharemyflat/com.example.android.sharemyflat.Activities.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 8045 on device enspert-highway-0123456789ABCDEF
V/Provider/Settings: from db cache, name = anr_debugging_mechanism , value = 1
D/asset: AssetManager-->addDefaultAssets CIP path not exsit!
D/dalvikvm: open_cached_dex_file : /data/app/com.example.android.sharemyflat-2.apk /data/dalvik-cache/data@app@com.example.android.sharemyflat-2.apk@classes.dex
D/ActivityThread: installProvider: context.getPackageName()=com.example.android.sharemyflat
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41a19c98)
W/dalvikvm: threadid=1: uncaught exception occurred
W/System.err: 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.android.sharemyflat-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.sharemyflat-2, /vendor/lib, /system/lib]]
W/System.err: at android.app.ActivityThread.installProvider(ActivityThread.java:5052)
W/System.err: at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
W/System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
W/System.err: at android.app.ActivityThread.access$1500(ActivityThread.java:151)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:110)
W/System.err: at android.os.Looper.loop(Looper.java:193)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5333)
W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
W/System.err: at dalvik.system.NativeStart.main(Native Method)
W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.android.sharemyflat-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.sharemyflat-2, /vendor/lib, /system/lib]]
W/System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
W/System.err: at android.app.ActivityThread.installProvider(ActivityThread.java:5037)
W/System.err: ... 12 more
W/dalvikvm: threadid=1: calling UncaughtExceptionHandler
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.sharemyflat, PID: 8045
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.android.sharemyflat-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.sharemyflat-2, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5052)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
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:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
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.android.sharemyflat-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.sharemyflat-2, /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:5037)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
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:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Application terminated.
我正在使用MacBook Pro,我可以在模拟器中运行我的应用程序并且没有出现这些错误,所以我想问题可能是我的手机配置。我也启用了USB调试。我需要在手机上安装任何东西吗?
这是我的app graddle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.android.bauthentication"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.1.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-auth:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
尝试检查配置或查看firebase的文档..
官方网页 - Add Firebase to Your Android Project
小心firebase的版本,存在旧版本和新版本,检查你安装的版本
官方页面旧版本。 Android Quickstart - Firebase
答案 1 :(得分:0)
看起来这个问题是由Multidex编译器引起的。您可能需要为版本<21。
的Android手机正确配置您的应用程序请参阅以下帖子。它处理相同的主题
Android app working perfect in marshmallow and lollipop or nougat but it does not work in kitkat
答案 2 :(得分:0)
apply plugin: 'com.android.application'
android {
signingConfigs {
}
compileSdkVersion 25
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.***.****"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled false
versionCode 12
versionName "1.12"
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
signingConfig signingConfigs.config
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-core:11.4.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'
//compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.google.android.gms:play-services-ads:11.4.2'
compile 'com.google.android.gms:play-services-identity:11.4.2'
compile 'com.google.android.gms:play-services-gcm:11.4.2'
compile 'com.google.android.gms:play-services-analytics:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'
}
apply plugin: 'com.google.gms.google-services'
卸载应用并重新安装
答案 3 :(得分:0)
如果使用multiDexEnabled false
禁用multidex编译器,它应该可以正常工作。