我将数据插入firebase,现在想从firebase获取该数据,但项目在某个时刻终止。我调试代码并获取这些..
我正在尝试从firebase数据库获取此数据。
rcsfirebaseproject
-test2
-L03KXCTlprnkQ3-Fsfl
pubid:
"-L03KXCTlprnkQ3-Fsfl"
publisher:
"test"
reseracher:
"test2"
tile:
"test3"
我使用代码
插入此数据FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = database.getReference("test2");
String paperid=myRef.push().getKey();
publishedpaperitemdemi pubpaper=new
publishedpaperitemdemi(paperid,"test","test2","test3");
myRef.child(paperid).setValue(pubpaper);
这很好用 我想使用
来检索这些数据// Read from the database
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot papershapshot: dataSnapshot.getChildren()){
publishedpaperitemdemi
pubda=papershapshot.getValue(publishedpaperitemdemi.class);
long abc=papershapshot.getChildrenCount();
}
}
@Override
public void onCancelled(DatabaseError error) {
// Failed to read value
// Log.w(TAG, "Failed to read value.", error.toException());
}
});
代码到达时
publishedpaperitemdemi
pubda=papershapshot.getValue(publishedpaperitemdemi.class);
为什么项目在此时终止任何帮助,请
t logcat的详细信息
12-11 12:48:53.497 1588-1639/system_process E/InputDispatcher: channel '7fe09e7 com.example.ahmadkhan.rcs/com.example.ahmadkhan.rcs.testfirebasedbActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
12-11 12:48:53.497 1588-1639/system_process E/InputDispatcher: channel 'f311c3d Toast (server)' ~ Channel is unrecoverably broken and will be disposed!
12-11 12:48:53.791 7214-7214/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:48:53.791 7214-7214/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:48:54.360 7227-7227/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:48:54.360 7227-7227/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:48:55.664 7242-7242/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:48:55.664 7242-7242/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:49:18.440 7254-7254/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:49:18.440 7254-7254/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:49:18.462 7254-7268/? E/art: Thread attaching while runtime is shutting down: Binder_1
12-11 12:49:18.462 7256-7256/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:49:18.464 7256-7256/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:49:18.917 7272-7272/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:49:18.917 7272-7272/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:49:19.245 7283-7283/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:49:19.245 7283-7283/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:49:19.633 7294-7294/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:49:19.633 7294-7294/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:49:20.405 1311-1311/? E/installd: Couldn't opendir /data/app/vmdl475084502.tmp: No such file or directory
12-11 12:49:20.663 1922-5855/com.google.android.gms.persistent E/NetworkScheduler: Unrecognised action provided: android.intent.action.PACKAGE_REMOVED
12-11 12:49:21.461 7330-7330/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:49:21.461 7330-7330/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:49:21.704 1941-2129/com.android.launcher3 E/Surface: getSlotFromBufferLocked: unknown buffer: 0xaab0a3c0
12-11 12:49:24.408 1588-3667/system_process E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9c2f58c0
12-11 12:49:24.430 7357-7357/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_dependencies_apk.apk@classes.dex: Permission denied
12-11 12:49:24.571 7359-7359/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_0_apk.apk@classes.dex: Permission denied
12-11 12:49:24.607 7361-7361/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_1_apk.apk@classes.dex: Permission denied
12-11 12:49:24.653 7363-7363/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_2_apk.apk@classes.dex: Permission denied
12-11 12:49:24.679 7365-7365/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_3_apk.apk@classes.dex: Permission denied
12-11 12:49:24.691 7367-7367/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_4_apk.apk@classes.dex: Permission denied
12-11 12:49:24.702 7369-7369/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_5_apk.apk@classes.dex: Permission denied
12-11 12:49:24.717 7371-7371/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_6_apk.apk@classes.dex: Permission denied
12-11 12:49:24.736 7373-7373/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_7_apk.apk@classes.dex: Permission denied
12-11 12:49:24.751 7375-7375/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_8_apk.apk@classes.dex: Permission denied
12-11 12:49:24.769 7377-7377/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_9_apk.apk@classes.dex: Permission denied
12-11 12:49:25.398 1216-1276/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
12-11 12:49:28.874 7344-7384/com.example.ahmadkhan.rcs E/Surface: getSlotFromBufferLocked: unknown buffer: 0xae5828c0
12-11 12:50:11.906 7405-7405/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:50:11.906 7405-7405/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:50:12.273 7420-7420/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:50:12.273 7420-7420/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:50:21.745 7430-7430/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:50:21.745 7430-7430/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:50:21.748 7432-7432/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:50:21.748 7432-7432/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:50:21.765 7432-7446/? E/art: Thread attaching while runtime is shutting down: Binder_2
12-11 12:50:21.766 7430-7444/? E/art: Thread attaching while runtime is shutting down: Binder_1
12-11 12:50:23.806 7454-7454/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-11 12:50:23.806 7454-7454/? E/android.os.Debug: failed to load memtrack module: -2
12-11 12:50:24.189 1941-2129/com.android.launcher3 E/Surface: getSlotFromBufferLocked: unknown buffer: 0xaab0a820
12-11 12:50:26.829 1588-3667/system_process E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9c2f5f00
12-11 12:50:26.849 7475-7475/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_dependencies_apk.apk@classes.dex: Permission denied
12-11 12:50:27.146 7477-7477/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_0_apk.apk@classes.dex: Permission denied
12-11 12:50:27.172 7480-7480/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_1_apk.apk@classes.dex: Permission denied
12-11 12:50:27.189 7482-7482/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_2_apk.apk@classes.dex: Permission denied
12-11 12:50:27.209 7484-7484/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_3_apk.apk@classes.dex: Permission denied
12-11 12:50:27.229 7486-7486/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_4_apk.apk@classes.dex: Permission denied
12-11 12:50:27.248 7488-7488/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_5_apk.apk@classes.dex: Permission denied
12-11 12:50:27.261 7490-7490/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_6_apk.apk@classes.dex: Permission denied
12-11 12:50:27.280 7492-7492/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_7_apk.apk@classes.dex: Permission denied
12-11 12:50:27.301 7494-7494/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_8_apk.apk@classes.dex: Permission denied
12-11 12:50:27.319 7496-7496/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/x86/data@app@com.example.ahmadkhan.rcs-1@split_lib_slice_9_apk.apk@classes.dex: Permission denied
12-11 12:50:28.180 1216-1271/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
12-11 12:50:31.628 7462-7503/com.example.ahmadkhan.rcs E/Surface: getSlotFromBufferLocked: unknown buffer: 0xaab0a960
12-11 12:50:48.150 1588-1639/system_process E/InputDispatcher: channel 'd063fc9 com.example.ahmadkhan.rcs/com.example.ahmadkhan.rcs.testfirebasedbActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
答案 0 :(得分:2)
我发现错误的最常见原因之一是DispatchQueue.main.async {
// new Code
let geoCoder = GMSGeoCoder()
geoCoder.reverseGeocodeCoordinate((coordinate), completionHandler: {
reverseGeoCodeResponse, _ in
}
// OLD code self.geocoder.reverseGeocodeCoordinate((coordinate), completionHandler: {
reverseGeoCodeResponse, _ in
}
}
,当您尝试在不在前台的活动中显示警告对话框或进度对话框时。
关于截图,该数据是Channel is unrecoverably broken and will be disposed!
对象包含的内容。我在那里看不出有什么问题。