firebase数据的链接-https://fireui-78226.firebaseio.com/users
使用的库-
FirebaseDatabase.getInstance().getReferenceFromUrl("https://fireui-78226.firebaseio.com/Users");
ListView listView;
DatabaseReference ref;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView = findViewById(R.id.listView);
ref = FirebaseDatabase.getInstance().getReferenceFromUrl("https://fireui-78226.firebaseio.com/Users");
Query query = FirebaseDatabase.getInstance().getReferenceFromUrl("https://fireui-78226.firebaseio.com/Users");
FirebaseListOptions<String> options = new FirebaseListOptions.Builder<String>()
.setQuery(query, String.class)
.setLayout(android.R.layout.simple_list_item_1)
.build();
FirebaseListAdapter<String> firebaseListAdapter = new FirebaseListAdapter<String>(options) {
@Override
protected void populateView(View v, String model, int position) {
TextView textView = v.findViewById(android.R.id.text1);
textView.setText(model);
}
};
listView.setAdapter(firebaseListAdapter);
}
}
E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(SourceFile:739)
at com.google.firebase.FirebaseApp.zze(SourceFile:709)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
at android.app.ActivityThread.installProvider(ActivityThread.java:5852)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5444)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5383)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.android.gms.internal.zzcim.zzdx(Unknown Source)
at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(SourceFile:739)
at com.google.firebase.FirebaseApp.zze(SourceFile:709)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
at android.app.ActivityThread.installProvider(ActivityThread.java:5852)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5444)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5383)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/com.example.vivanksharma.fireui-2/base.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.vivanksharma.fireui-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.vivanksharma.fireui-2/lib/arm, /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 com.google.android.gms.internal.zzcim.zzdx(Unknown Source)
at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(SourceFile:739)
at com.google.firebase.FirebaseApp.zze(SourceFile:709)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
at android.app.ActivityThread.installProvider(ActivityThread.java:5852)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5444)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5383)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
试试看:
在这一行下:
listView.setAdapter(firebaseListAdapter);
添加此行:
firebaseListAdapter.startListening();
firebaseListAdapter.stopListening();
对于我的Android应用程序,我需要集成firebase。所以我跟着谷歌教程学习。 现在我总是在实现firebase之后 当我运行应用程序(在真实设备和模拟) 已经看到了:Firebase数据库依赖崩溃应用程序,但他正在使用旧版本... 以下是项目的分级: 有人知道该怎么做才能解决这个初始化问题吗?
我正在尝试为我的代码做一个简单的csv读取,它一直工作到我今晚尝试Mac。目前是10点15分。3、卡塔琳娜。这是我的代码: 它给我的错误是:OSError:从文件初始化失败。 我尝试了多种不同的选项来读取这个csv,包括 但所有这些都给出了类似的错误。我确信有一个简单的答案,但是我还没有找到。我在终端上尝试了 sudo chown username: group filename 命令,并通过我的
在实施Facebook帐户工具包并运行项目后,它将Firebase API初始化失败显示为 并且还从AccountKitController获取空指针异常 使用帐户工具包gradle作为 而 Firebase Gradle 则作为 注意:从项目中删除帐户套件工作正常,即没有Firebase API初始化失败。问题。因此,可以肯定的是,firebase和Account kit SDK之间存在冲突:
我在我的android应用程序中使用谷歌地图。我已经创建了密钥并在清单文件中添加了必要的权限。但很快我启动了应用程序,我在调试器中收到了这条消息: Google服务初始化失败,状态:10,缺少用于初始化Google服务的预期资源:“R.string.google_app_id”。可能的原因是缺少google-services.json或com.google.gms.google服务gradle插件
我正在尝试使用Spring Security实现一个简单的登录(我是Spring Security的新手)。我从Spring Security参考开始,其中包含一个简单的“Hello world”示例(链接)。我在Eclipse中准备了一个Web项目(带有EAR项目),文件结构如下所示: SecurityConfig和SecurityWebApplicationInitializer类与上面链接(
我使用velocity作为Java代码生成器,我正在运行一个Eclipse应用程序,它有多个插件,不同的插件调用velocity模块进行代码生成。 每当我运行一个特定的插件时,不管我运行多少次,它都可以单独工作,现在如果我试图运行另一个插件,它会抛出速度异常(我在下面提供了堆栈跟踪),我将再次重启eclipse,其他插件也可以工作。 结论:当一个插件在某个插件已经执行后运行时,Velocity初始