我正在尝试运行Firebase聊天消息示例应用,但是由于基础lib而导致错误。
我在我的申请和推荐链接上使用的下面的库
compile 'com.firebase:firebase-client-android:2.5.2+'
FATAL EXCEPTION: main
Process: sliderlayout.rrd.com.firebasechatmessaging, PID: 22131
java.lang.RuntimeException: Unable to start activity ComponentInfo{sliderlayout.rrd.com.firebasechatmessaging/sliderlayout.rrd.com.firebasechatmessaging.Register}: java.lang.RuntimeException: Android classes not found. Are you using the firebase-client-android artifact?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: java.lang.RuntimeException: Android classes not found. Are you using the firebase-client-android artifact?
at com.firebase.client.core.Context.setAndroidContext(Context.java:66)
at com.firebase.client.Firebase.setAndroidContext(Firebase.java:974)
at sliderlayout.rrd.com.firebasechatmessaging.Register.onCreate(Register.java:44)
at android.app.Activity.performCreate(Activity.java:6955)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
答案 0 :(得分:1)
引起:java.lang.RuntimeException:找不到Android类。是 你使用firebase-client-android工件?
因为这个版本发生了:
compile 'com.firebase:firebase-client-android:2.5.2+'
您可以使用以下方法之一:
compile 'com.firebase:firebase-client-android:2.4.0'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebase:firebase-client-android:2.3.0'
希望它能帮到你!!