I am fetching the username of the client via alert box in androidd
and storing it in a variable "name"
this is class for fetching the user name i have done so far
private void request_user_name() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Enter name:");
final EditText input_field = new EditText(this);
builder.setView(input_field);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener()
{
#Override
public void onClick(DialogInterface dialogInterface, int i) {
String name = input_field.getText().toString();
SharedPreferences pref = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
SharedPreferences.Editor edit = pref.edit();
edit.putString("name", name);
edit.commit();
String name = pref.getString("name", "");
name = name.trim();
if (TextUtils.isEmpty(name)){
request_user_name();
}
and i am calling the request_user_name class with
if(name.isEmpty()) {
request_user_name();
}
so that The application will not create pop up alert everytime i open this
but in the emulator it crashes when the apk is installed
emulator:nexus 6P api 25
android studio 2.3
logcat :
04-21 19:46:12.921 7369-7369/? I/art: Not late-enabling -Xcheck:jni (already on)
04-21 19:46:12.921 7369-7369/? W/art: Unexpected CPU variant for X86 using defaults: x86_64
04-21 19:46:13.235 7369-7369/app.torune_sav W/System: ClassLoader referenced unknown path: /data/app/app.torune_sav-2/lib/x86_64
04-21 19:46:13.274 7369-7369/app.torune_sav D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
04-21 19:46:13.295 7369-7369/app.torune_sav D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
04-21 19:46:13.344 7369-7369/app.torune_sav I/FA: App measurement is starting up, version: 9452
04-21 19:46:13.344 7369-7369/app.torune_sav I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
04-21 19:46:13.344 7369-7369/app.torune_sav D/FA: Debug logging enabled
04-21 19:46:13.344 7369-7369/app.torune_sav D/FA: AppMeasurement singleton hash: 75451222
04-21 19:46:13.378 7369-7369/app.torune_sav V/FA: Collection enabled
04-21 19:46:13.378 7369-7369/app.torune_sav V/FA: App package, google app id: app.torune_sav, 1:718884139232:android:90e5088fff923640
04-21 19:46:13.415 7369-7369/app.torune_sav V/FA: Registered activity lifecycle callback
04-21 19:46:13.417 7369-7369/app.torune_sav I/FirebaseInitProvider: FirebaseApp initialization successful
04-21 19:46:13.420 7369-7369/app.torune_sav I/InstantRun: starting instant run server: is main process
04-21 19:46:13.425 7369-7392/app.torune_sav V/FA: Using measurement
service 04-21 19:46:13.435 7369-7392/app.torune_sav V/FA: Connecting
to remote service 04-21 19:46:13.504 7369-7369/app.torune_sav
W/System: ClassLoader referenced unknown path:
/system/priv-app/PrebuiltGmsCore/lib/x86_64 04-21 19:46:13.505
7369-7369/app.torune_sav D/ApplicationLoaders: ignored Vulkan layer
search path
/system/priv-app/PrebuiltGmsCore/lib/x86_64:/system/fake-libs64:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86_64:/system/lib64:/vendor/lib64
for namespace 0x7e277c41c0f0 04-21 19:46:13.513
7369-7369/app.torune_sav W/System: ClassLoader referenced unknown
path: 04-21 19:46:13.513 7369-7369/app.torune_sav W/System:
ClassLoader referenced unknown path:
/system/priv-app/PrebuiltGmsCore/lib/x86_64 04-21 19:46:13.514
7369-7369/app.torune_sav D/ApplicationLoaders: ignored Vulkan layer
search path
/system/priv-app/PrebuiltGmsCore/lib/x86_64:/system/fake-libs64:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86_64:/system/lib64:/vendor/lib64
for namespace 0x7e277c41c160 04-21 19:46:13.523
7369-7369/app.torune_sav I/DynamiteModule: Considering local module
com.google.android.gms.firebase_database:3 and remote module
com.google.android.gms.firebase_database:5 04-21 19:46:13.523
7369-7369/app.torune_sav I/DynamiteModule: Selected remote version of
com.google.android.gms.firebase_database, version >= 5 04-21
19:46:13.526 7369-7369/app.torune_sav W/System: ClassLoader referenced
unknown path:
/data/user_de/0/com.google.android.gms/app_chimera/m/00000003/n/x86_64
04-21 19:46:13.583 7369-7369/app.torune_sav W/art: Before Android 4.1,
method android.graphics.PorterDuffColorFilter
android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter,
android.content.res.ColorStateList, android.graphics.PorterDuff$Mode)
would have incorrectly overridden the package-private method in
android.graphics.drawable.Drawable 04-21 19:46:13.597
7369-7399/app.torune_sav D/NetworkSecurityConfig: No Network Security
Config specified, using platform default 04-21 19:46:13.608
7369-7369/app.torune_sav V/FA: onActivityCreated 04-21 19:46:13.754
7369-7369/app.torune_sav W/System: ClassLoader referenced unknown
path:
/data/user_de/0/com.google.android.gms/app_chimera/m/00000002/n/x86_64
04-21 19:46:13.764 7369-7369/app.torune_sav D/AndroidRuntime: Shutting
down VM
--------- >beginning of crash 04-21 19:46:13.765 7369-7369/app.torune_sav >E/AndroidRuntime: FATAL EXCEPTION: main
Process: >app.torune_sav, PID: 7369
java.lang.RuntimeException: Unable to start activity
ComponentInfo{app.torune_sav/app.real_time_chat.MainActivity}:
java.lang.NullPointerException: Attempt to invoke virtual method
'boolean java.lang.String.isEmpty()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method
'boolean java.lang.String.isEmpty()' on a null object reference
at app.real_time_chat.MainActivity.onCreate(MainActivity.java:125)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Can anyone figure out what the issue in the code ?
You should check if your String variable isn't null before calling .isEmpty() en it.
if(name == null && name.isEmpty()) {
request_user_name();
}
Or you should initialize it with a default value.
Related
So I'm getting a black screen whenever I try to run my code through android studio
07-06 22:58:42.480 7969-7969/? I/art: Late-enabling -Xcheck:jni
07-06 22:58:42.508 7969-7969/? D/TidaProvider: TidaProvider()
07-06 22:58:42.549 7969-7969/? W/System: ClassLoader referenced unknown path: /data/app/com.example.delma.ins-1/lib/arm64
07-06 22:58:42.551 7969-7969/? W/ResourceType: No package identifier when getting name for resource number 0x00000000
07-06 22:58:42.557 7969-7979/? I/art: Debugger is no longer active
07-06 22:58:42.557 7969-7979/? I/art: Starting a blocking GC Instrumentation
07-06 22:58:42.618 7969-8006/? W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
07-06 22:58:42.624 7969-8006/? W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
07-06 22:58:42.628 7969-7969/? D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
07-06 22:58:42.636 7969-7969/? I/FA: App measurement is starting up, version: 11020
07-06 22:58:42.636 7969-7969/? I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
07-06 22:58:42.642 7969-7969/? I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.delma.ins
07-06 22:58:42.642 7969-7969/? D/FA: Debug-level message logging enabled
07-06 22:58:42.651 7969-7969/? I/FirebaseInitProvider: FirebaseApp initialization successful
07-06 22:58:42.672 7969-7969/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-06 22:58:42.682 7969-7969/? D/AccessibilityManager: current package=com.example.delma.ins, accessibility manager mIsFinalEnabled=false, mOptimizeEnabled=false, mIsUiAutomationEnabled=false, mIsInterestedPackage=false
07-06 22:58:42.775 7969-7969/? I/DynamiteModule: Considering local module com.google.android.gms.firebase_database:4 and remote module com.google.android.gms.firebase_database:6
07-06 22:58:42.775 7969-7969/? I/DynamiteModule: Selected remote version of com.google.android.gms.firebase_database, version >= 6
07-06 22:58:42.782 7969-7969/? W/System: ClassLoader referenced unknown path:
07-06 22:58:42.784 7969-7969/? W/ResourceType: No package identifier when getting name for resource number 0x00000000
07-06 22:58:42.800 7969-7969/? W/ChimeraDebugLogger: Singleton logger instance not set.
07-06 22:58:42.805 7969-7969/? W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000070/n/arm64-v8a
07-06 22:58:42.818 7969-7969/? W/ResourceType: No package identifier when getting name for resource number 0x00000000
07-06 22:58:42.871 7969-8043/? D/NetworkSecurityConfig: No Network Security Config specified, using platform default
07-06 22:58:42.876 7969-7969/? W/ActionBarDrawerToggle: DrawerToggle may not show up because NavigationIcon is not visible. You may need to call actionbar.setDisplayHomeAsUpEnabled(true);
07-06 22:58:43.049 7969-7969/? I/Timeline: Timeline: Activity_launch_request time:452779 intent:Intent { flg=0x10008000 cmp=com.example.delma.ins/.LoginActivity }
07-06 22:58:43.509 7969-7969/? I/Timeline: Timeline: Activity_launch_request time:453239 intent:Intent { flg=0x10008000 cmp=com.example.delma.ins/.MainActivity }
07-06 22:58:43.523 7969-8020/? D/FA: Connected to remote service
07-06 22:58:43.604 7969-7969/com.example.delma.ins W/ActionBarDrawerToggle: DrawerToggle may not show up because NavigationIcon is not visible. You may need to call actionbar.setDisplayHomeAsUpEnabled(true);
07-06 22:58:43.609 7969-7969/com.example.delma.ins I/Timeline: Timeline: Activity_launch_request time:453339 intent:Intent { flg=0x10008000 cmp=com.example.delma.ins/.LoginActivity }
you have heavy work in the main thread, it will happen to ANR (android not responding), you should check your work, and a black screen is your application theme
As you can see, here is my code mostly copied from google documentation for google sign in authentication. The problem is when I click on sign in button it throws me an error called "16:" Sorry for posting images, I got problem with posting a code, hope so someone can help me to solve this problem.
**Dependencies
//for firebase
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-crash:15.0.2'
implementation 'com.firebase:firebase-client-android:2.3.1'
implementation 'com.google.firebase:firebase-storage:15.0.2'
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.android.gms:play-services-auth:16.0.0'**
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome_screen);
onCreate();
SignInButton signInButton = findViewById(R.id.sign_in_button);
signInButton.setSize(SignInButton.SIZE_STANDARD);
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
mAuth = FirebaseAuth.getInstance();
signInButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
signIn();
}
});
}
private void signIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
Intent intent = new Intent(WelcomeScreen.this, Main.class);
startActivity(intent);
} catch (ApiException e) {
Toast.makeText(WelcomeScreen.this, "problem je: " + e.getStatusCode(), Toast.LENGTH_SHORT).show();
}
}
#Override
public void onStart() {
super.onStart();
if (mAuth.getCurrentUser() != null) {
Intent intent = new Intent(WelcomeScreen.this, Main.class);
startActivity(intent);
}
}
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
handleSignInResult(task);
}
}
Stack trace:
2018-09-27 16:32:54.320 6371-6371/com.example.user.graduationproject I/art: Late-enabling -Xcheck:jni
2018-09-27 16:32:54.320 6371-6371/com.example.user.graduationproject D/houdini: [6371] Initialize library(version: 6.1.2d_x.48748 RELEASE)... successfully.
2018-09-27 16:32:54.512 6371-6387/com.example.user.graduationproject W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2018-09-27 16:32:54.540 6371-6391/com.example.user.graduationproject I/DynamiteModule: Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:3
2018-09-27 16:32:54.540 6371-6391/com.example.user.graduationproject I/DynamiteModule: Selected remote version of com.google.android.gms.flags, version >= 3
2018-09-27 16:32:54.545 6371-6385/com.example.user.graduationproject D/libEGL: loaded /system/lib/egl/libEGL_adreno.so
2018-09-27 16:32:54.549 6371-6371/com.example.user.graduationproject V/FA: Registered activity lifecycle callback
2018-09-27 16:32:54.550 6371-6391/com.example.user.graduationproject W/System: ClassLoader referenced unknown path:
2018-09-27 16:32:54.558 6371-6391/com.example.user.graduationproject D/ApplicationLoaders: ignored Vulkan layer search path /data/app/com.google.android.gms-1/lib/x86:/data/app/com.google.android.gms-1/base.apk!/lib/x86 for namespace 0xb7684090
2018-09-27 16:32:54.560 6371-6371/com.example.user.graduationproject I/FirebaseInitProvider: FirebaseApp initialization successful
2018-09-27 16:32:54.562 6371-6371/com.example.user.graduationproject I/InstantRun: starting instant run server: is main process
2018-09-27 16:32:54.573 6371-6392/com.example.user.graduationproject W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2018-09-27 16:32:54.575 6371-6385/com.example.user.graduationproject D/libEGL: loaded /system/lib/egl/libGLESv1_CM_adreno.so
2018-09-27 16:32:54.581 6371-6385/com.example.user.graduationproject D/libEGL: loaded /system/lib/egl/libGLESv2_adreno.so
2018-09-27 16:32:54.595 6371-6371/com.example.user.graduationproject W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
2018-09-27 16:32:54.598 6371-6371/com.example.user.graduationproject V/FA: onActivityCreated
2018-09-27 16:32:54.607 6371-6391/com.example.user.graduationproject W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/n/armeabi-v7a
2018-09-27 16:32:54.607 6371-6391/com.example.user.graduationproject W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/n/armeabi
2018-09-27 16:32:54.609 6371-6392/com.example.user.graduationproject I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
2018-09-27 16:32:54.609 6371-6392/com.example.user.graduationproject I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject V/FA: Collection enabled
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject V/FA: App package, google app id: com.example.user.graduationproject, 1:155824206953:android:24d999f6e00c6563
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject I/FA: App measurement is starting up, version: 12451
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.user.graduationproject
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject D/FA: Debug-level message logging enabled
2018-09-27 16:32:54.635 6371-6391/com.example.user.graduationproject W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
2018-09-27 16:32:54.637 6371-6391/com.example.user.graduationproject I/DynamiteModule: Considering local module com.google.android.gms.crash:0 and remote module com.google.android.gms.crash:215
2018-09-27 16:32:54.637 6371-6391/com.example.user.graduationproject I/DynamiteModule: Selected remote version of com.google.android.gms.crash, version >= 215
2018-09-27 16:32:54.640 6371-6391/com.example.user.graduationproject I/FirebaseCrashApiImpl: FirebaseCrashApiImpl created by ClassLoader ad[DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/DynamiteModulesC.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/n/armeabi-v7a, /data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/n/armeabi, /system/lib, /vendor/lib]]]
2018-09-27 16:32:54.641 6371-6391/com.example.user.graduationproject I/FirebaseCrash: FirebaseCrash reporting loaded - com.google.android.gms.internal.measurement.zzxw#9bbbe64
2018-09-27 16:32:54.648 6371-6393/com.example.user.graduationproject I/DynamiteModule: Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:3
2018-09-27 16:32:54.648 6371-6393/com.example.user.graduationproject I/DynamiteModule: Selected remote version of com.google.android.gms.flags, version >= 3
2018-09-27 16:32:54.652 6371-6393/com.example.user.graduationproject W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
2018-09-27 16:32:54.662 6371-6393/com.example.user.graduationproject I/FirebaseCrashApiImpl: FirebaseCrash reporting API initialized
2018-09-27 16:32:54.662 6371-6393/com.example.user.graduationproject I/FirebaseCrash: FirebaseCrash reporting initialized com.google.android.gms.internal.measurement.zzxw#9bbbe64
2018-09-27 16:32:54.662 6371-6393/com.example.user.graduationproject D/FirebaseCrash: Firebase Analytics Listener for Firebase Crash is initialized
2018-09-27 16:32:54.666 6371-6395/com.example.user.graduationproject V/FA: Cancelling job. JobID: -1494669227
2018-09-27 16:32:54.676 6371-6395/com.example.user.graduationproject V/FA: Connecting to remote service
2018-09-27 16:32:54.680 6371-6395/com.example.user.graduationproject V/FA: Connection attempt already in progress
2018-09-27 16:32:55.250 6371-6371/com.example.user.graduationproject D/ApplicationLoaders: ignored Vulkan layer search path /data/app/com.google.android.gms-1/lib/x86:/data/app/com.google.android.gms-1/base.apk!/lib/x86 for namespace 0xb76840d0
2018-09-27 16:32:55.256 6371-6371/com.example.user.graduationproject I/DynamiteModule: Considering local module com.google.android.gms.signinbutton_dynamite:0 and remote module com.google.android.gms.signinbutton_dynamite:2
2018-09-27 16:32:55.256 6371-6371/com.example.user.graduationproject I/DynamiteModule: Selected remote version of com.google.android.gms.signinbutton_dynamite, version >= 2
2018-09-27 16:32:55.274 6371-6371/com.example.user.graduationproject W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000009/n/armeabi-v7a
2018-09-27 16:32:55.274 6371-6371/com.example.user.graduationproject W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000009/n/armeabi
2018-09-27 16:32:55.323 6371-6395/com.example.user.graduationproject I/FA: Tag Manager is not found and thus will not be used
2018-09-27 16:32:55.335 6371-6395/com.example.user.graduationproject D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=WelcomeScreen, firebase_screen_id(_si)=-4609609622484588595}]
2018-09-27 16:32:55.350 6371-6395/com.example.user.graduationproject V/FA: Connection attempt already in progress
2018-09-27 16:32:55.351 6371-6395/com.example.user.graduationproject V/FA: Connection attempt already in progress
2018-09-27 16:32:55.351 6371-6395/com.example.user.graduationproject V/FA: Activity resumed, time: 2956494
2018-09-27 16:32:55.363 6371-6399/com.example.user.graduationproject I/OpenGLRenderer: Initialized EGL, version 1.4
2018-09-27 16:32:55.363 6371-6399/com.example.user.graduationproject D/OpenGLRenderer: Swap behavior 1
2018-09-27 16:32:55.413 6371-6399/com.example.user.graduationproject W/EGL_emulation: eglSurfaceAttrib not implemented 3093 12436
2018-09-27 16:32:55.413 6371-6399/com.example.user.graduationproject W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa9078e80, error=EGL_SUCCESS
2018-09-27 16:32:55.420 6371-6371/com.example.user.graduationproject W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
2018-09-27 16:32:55.460 6371-6395/com.example.user.graduationproject D/FA: Connected to remote service
2018-09-27 16:32:55.461 6371-6395/com.example.user.graduationproject V/FA: Processing queued up service tasks: 4
2018-09-27 16:32:57.221 6371-6395/com.example.user.graduationproject V/FA: Recording user engagement, ms: 1898
2018-09-27 16:32:57.222 6371-6395/com.example.user.graduationproject V/FA: Activity paused, time: 2958392
2018-09-27 16:32:57.224 6371-6395/com.example.user.graduationproject D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=1898, firebase_screen_class(_sc)=WelcomeScreen, firebase_screen_id(_si)=-4609609622484588595}]
2018-09-27 16:32:57.231 6371-6371/com.example.user.graduationproject V/FA: onActivityCreated
2018-09-27 16:32:57.241 6371-6395/com.example.user.graduationproject D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=WelcomeScreen, firebase_previous_id(_pi)=-4609609622484588595, firebase_screen_class(_sc)=SignInHubActivity, firebase_screen_id(_si)=-4609609622484588594}]
2018-09-27 16:32:57.268 6371-6395/com.example.user.graduationproject V/FA: Activity resumed, time: 2958410
2018-09-27 16:32:57.269 6371-6395/com.example.user.graduationproject V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 31
2018-09-27 16:32:57.273 6371-6395/com.example.user.graduationproject V/FA: Activity paused, time: 2958411
2018-09-27 16:32:57.287 6371-6399/com.example.user.graduationproject W/EGL_emulation: eglSurfaceAttrib not implemented 3093 12436
2018-09-27 16:32:57.287 6371-6399/com.example.user.graduationproject W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb2d390c0, error=EGL_SUCCESS
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: com.google.android.gms.common.api.ApiException: 16:
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at com.example.user.graduationproject.Bjelasnica.WelcomeScreen.onActivityResult(WelcomeScreen.java:88)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at android.app.Activity.dispatchActivityResult(Activity.java:6945)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:4088)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4135)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at android.app.ActivityThread.-wrap20(ActivityThread.java)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1536)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at android.os.Looper.loop(Looper.java:154)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6169)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
2018-09-27 16:33:01.910 6371-6395/com.example.user.graduationproject D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=SignInHubActivity, firebase_previous_id(_pi)=-4609609622484588594, firebase_screen_class(_sc)=WelcomeScreen, firebase_screen_id(_si)=-4609609622484588595}]
2018-09-27 16:33:01.936 6371-6395/com.example.user.graduationproject V/FA: Activity resumed, time: 2963077
2018-09-27 16:33:01.953 6371-6399/com.example.user.graduationproject W/EGL_emulation: eglSurfaceAttrib not implemented 3093 12436
2018-09-27 16:33:01.953 6371-6399/com.example.user.graduationproject W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb2d390c0, error=EGL_SUCCESS
2018-09-27 16:33:04.784 6371-6426/com.example.user.graduationproject I/FirebaseCrash: Sending crashes
2018-09-27 16:33:06.937 6371-6395/com.example.user.graduationproject V/FA: Inactivity, disconnecting from the service
I had the same problem. This is my solution. I hope you will understand.
Situation: How to solve this problem when there is an error code '16:', stuck at the 'Sign In with Google', after we pressed our email at the messagebox not next activity appear but only appear the error.
5.2. To solve this:
5.2.1. Get SHA1 from your project (Android Studio)
5.2.2. Create the API Key and OAuth 2.0 client IDs (Android type). (https://console.cloud.google.com/apis/credentials)
5.2.3. So, the data is set at Google, so get the new Firebase Console google.json at https://console.firebase.google.com/ (at Project Settings). Download it then replace.
5.2.4. Close the Android Studio, open back, then 'Make Project'
5.2.5. Run at the phone. Success!
Refer to this link: google signIn not working in release mode apk android
Extra about google api: https://developers.google.com/maps/documentation/android-sdk/config
(adding extra things for the manifest.xml)
I was also seeing "error code 16" when integrating Google SignIn on Android with Firebase. Still not sure what I was missing but I went back to the beginning and followed this doc:
https://firebase.google.com/docs/auth/android/google-signin
This link is pretty complete. I didn't need to configure anything in Google Cloud console. I did use the info on the Integrating Google SignIn page that the above page links to and got the code and layout for the button.
After struggling for about 48 hrs to solve the firebase google sign-in error 16 credential not matching;
The only thing that solved my problem is to get your web_client_id using "Configure a Google API Console project" through this link https://developers.google.com/identity/sign-in/android/start-integrating#configure_a_project, you should provide the application id from AndroidManifest.xml and sha1 from the signingReport of android studio.
Also, I got different sha1 for each android studio project as to avoid any conflicts in firebase, this by setting debug parameters in signingConfigs {} in android {} in the app build.gradle as follow
android {
signingConfigs {
debug {
storeFile file("path_to_keystore.jks")
storePassword "keystore_password"
keyAlias "key_alias_name"
keyPassword "key_password"
}
}
}
Moreover, I recommend to try firstly google sign in without firebase to give you a positive energy, then secondly go for firebase google sign-in as needed.
Hope this helps every developer facing the same error and save their time.
This is the code I use to connect and write to the database (I want to create a new child node userand assign the value alex to it.
DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();
mDatabase.child("user").setValue("alex");
Note: I have followed the correct set-up instructions and have changed the authorisation of read and write to true. The code was working for about a month but now I can't figure out why its not writing to the database.
Below is my logcat
03-12 14:43:38.882 12158-12158/? I/art: Late-enabling -Xcheck:jni
03-12 14:43:38.900 12158-12165/? I/art: Debugger is no longer active
03-12 14:43:38.900 12158-12165/? I/art: Starting a blocking GC Instrumentation
03-12 14:43:38.923 12158-12158/? W/System: ClassLoader referenced unknown path: /data/app/anaysingh.anaytyproject-1/lib/arm
03-12 14:43:38.932 12158-12158/? I/InstantRun: Instant Run Runtime started. Android package is anaysingh.anaytyproject, real application class is null.
03-12 14:43:39.090 12158-12158/? W/System: ClassLoader referenced unknown path: /data/app/anaysingh.anaytyproject-1/lib/arm
03-12 14:43:39.127 12158-12158/? D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
03-12 14:43:39.136 12158-12158/? D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
03-12 14:43:39.247 12158-12158/? V/FA: Cancelling job. JobID: -129726599
03-12 14:43:39.253 12158-12158/? V/FA: Registered activity lifecycle callback
03-12 14:43:39.255 12158-12158/? I/FirebaseInitProvider: FirebaseApp initialization successful
03-12 14:43:39.264 12158-12174/? V/FA: Collection enabled
03-12 14:43:39.264 12158-12174/? V/FA: App package, google app id: anaysingh.anaytyproject, 1:1025179625916:android:afeaaa816280de9a
03-12 14:43:39.266 12158-12174/? I/FA: App measurement is starting up, version: 11910
03-12 14:43:39.266 12158-12174/? I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
03-12 14:43:39.266 12158-12174/? I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app anaysingh.anaytyproject
03-12 14:43:39.266 12158-12174/? D/FA: Debug-level message logging enabled
03-12 14:43:39.278 12158-12174/? V/FA: Connecting to remote service
03-12 14:43:39.293 12158-12174/? V/FA: Connection attempt already in progress
03-12 14:43:39.379 12158-12158/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
03-12 14:43:39.384 12158-12158/? V/FA: onActivityCreated
03-12 14:43:39.534 12158-12158/? D/Connection: https://anaytyproject.firebaseio.com/Nigga
03-12 14:43:39.551 12158-12174/? V/FA: Connection attempt already in progress
03-12 14:43:39.556 12158-12174/? I/FA: Tag Manager is not found and thus will not be used
03-12 14:43:39.557 12158-12174/? D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-4541290412013862895}]
03-12 14:43:39.559 12158-12177/? I/DynamiteModule: Considering local module com.google.android.gms.firebase_database:4 and remote module com.google.android.gms.firebase_database:6
03-12 14:43:39.559 12158-12177/? I/DynamiteModule: Selected remote version of com.google.android.gms.firebase_database, version >= 6
03-12 14:43:39.566 12158-12177/? W/System: ClassLoader referenced unknown path:
03-12 14:43:39.573 12158-12174/? V/FA: Connection attempt already in progress
03-12 14:43:39.574 12158-12174/? V/FA: Activity resumed, time: 4225355
03-12 14:43:39.582 12158-12177/? W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000004c/n/armeabi-v7a
03-12 14:43:39.582 12158-12177/? W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000004c/n/armeabi
03-12 14:43:39.604 12158-12178/? I/Adreno: QUALCOMM build : bc479b6, I15255e4b4a
Build Date : 02/22/17
OpenGL ES Shader Compiler Version: XE031.09.00.03
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.5.5.R1.07.00.00.269.019
Remote Branch : NONE
Reconstruct Branch : NOTHING
03-12 14:43:39.608 12158-12178/? I/OpenGLRenderer: Initialized EGL, version 1.4
03-12 14:43:39.608 12158-12178/? D/OpenGLRenderer: Swap behavior 1
03-12 14:43:39.625 12158-12179/? D/NetworkSecurityConfig: No Network Security Config specified, using platform default
03-12 14:43:39.659 12158-12174/? D/FA: Connected to remote service
03-12 14:43:39.660 12158-12174/? V/FA: Processing queued up service tasks: 4
03-12 14:43:44.701 12158-12174/anaysingh.anaytyproject V/FA: Inactivity, disconnecting from the service
03-12 14:43:56.840 12158-12174/anaysingh.anaytyproject V/FA: Recording user engagement, ms: 17290
03-12 14:43:56.840 12158-12174/anaysingh.anaytyproject V/FA: Connecting to remote service
03-12 14:43:56.842 12158-12174/anaysingh.anaytyproject V/FA: Activity paused, time: 4242644
03-12 14:43:56.844 12158-12174/anaysingh.anaytyproject D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=17290, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-4541290412013862895}]
03-12 14:43:56.852 12158-12174/anaysingh.anaytyproject V/FA: Connection attempt already in progress
03-12 14:43:56.852 12158-12174/anaysingh.anaytyproject D/FA: Connected to remote service
03-12 14:43:56.852 12158-12174/anaysingh.anaytyproject V/FA: Processing queued up service tasks: 2
What am I doing wrong, my firebase database still shows null. However when I add data manually and read via JS it is working correctly.
The errors tell you that you haven't linked Firebase to your project.
03-12 14:43:39.127 12158-12158/? D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
03-12 14:43:39.136 12158-12158/? D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
Use the Firebase Assistant to set it up:
To open the Firebase Assistant in Android Studio:
Click Tools > Firebase to open the Assistant window.
Click to expand one of the listed features (for example, Analytics), then click the provided tutorial link (for example, Log an Analytics event).
Click the Connect to Firebase button to connect to Firebase and add the necessary code to your app.
Full documentation here.
This question already has an answer here:
NullPointerException when setting TextView via ButtonClick
(1 answer)
Closed 5 years ago.
I have one activity and a few fragments. My structure looks like this:
Main Activity ->
- Menu 1 Fragment-> Daily Fragment / Weekly Fragment / Monthly Fragment / Annual Fragment
- Menu 2 Fragment -> empty
- Menu 3 Fragment -> empty
All menus are fragments.
Now I want to add values to the database (Cloud Firebase), but I can not call the method (onClick).
I did OnClickListener, and Override onClick (View v). It still does not work. What else do I need?
Daily Fragment:
public class DailyFragment extends Fragment implements
View.OnClickListener{
private static final String QUOTE_KEY = "quote";
private static final String AUTHOR_KEY = "author";
private static final String TAG= "InspiringQuote";
private DocumentReference mDocRef = FirebaseFirestore.getInstance().document("sampleData/inspirations");
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
//just change the fragment_weekly
//with the fragment you want to inflate
//like if the class is DailyFragment it should have R.layout.home_fragment
//if it is WeeklyFragment it should have R.layout.fragment_weekly
//return inflater.inflate(R.layout.fragment_daily, null);
View layout = inflater.inflate(R.layout.fragment_daily, container, false);
//Dołączamy do przycisku obiekt nasłuchujący
Button saveButton = (Button)layout.findViewById(R.id.bn_save);
saveButton.setOnClickListener(this);
return layout;
}
#Override
public void onClick(View v){
switch (v.getId()) {
case R.id.bn_save:
saveQuote(v);
break;
}
}
public void saveQuote (View view){
EditText quoteView = (EditText) view.findViewById(R.id.quote);
EditText authorView = (EditText) view.findViewById(R.id.author);
String quoteText = quoteView.getText().toString();
String authorText = authorView.getText().toString();
if (quoteText.isEmpty() || authorText.isEmpty()) { return; }
Map<String, Object> dataToSave = new HashMap<String, Object>();
dataToSave.put(QUOTE_KEY, quoteText);
dataToSave.put(AUTHOR_KEY, quoteText);
mDocRef.set(dataToSave).addOnSuccessListener(new OnSuccessListener<Void>() {
#Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "Dokument został zapisany!");
}
}).addOnFailureListener(new OnFailureListener() {
#Override
public void onFailure(#NonNull Exception e) {
Log.w(TAG, "Błąd, dokument nie został zapisany.", e);
}
});
}}
XML:
<TextView
android:id="#+id/tv_dzienne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/quote"
android:layout_centerHorizontal="true"
android:layout_marginBottom="52dp"
android:text="Dzienne"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Large" />
<EditText
android:id="#+id/quote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/bn_save"
android:layout_alignParentStart="true"
android:layout_marginBottom="67dp"
android:ems="10"
android:hint="Podaj wartość"
android:inputType="textCapSentences"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp" />
<EditText
android:id="#+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/quote"
android:layout_marginTop="51dp"
android:ems="10"
android:hint="Nazwa"
android:inputType="textPersonName"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp" />
<Button
android:id="#+id/bn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="8dp"
android:onClick="saveQuote" --> **cannot resolve symbol**
android:text="#string/save_quote" />
02-13 19:09:49.852 11587-11587/? I/zygote: Not late-enabling -Xcheck:jni (already on)
02-13 19:09:49.865 11587-11587/? W/zygote: Unexpected CPU variant for X86 using defaults: x86
02-13 19:09:50.864 11587-11587/? W/zygote: Skipping duplicate class check due to unrecognized classloader
02-13 19:09:50.867 11587-11587/? W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
02-13 19:09:50.871 11587-11587/? W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
02-13 19:09:50.875 11587-11587/? I/BiChannelGoogleApi: [FirebaseAuth: ] No Fallback module; NOT setting up for lazy initialization
02-13 19:09:50.879 11587-11607/? W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
02-13 19:09:50.892 11587-11610/? I/DynamiteModule: Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:0
02-13 19:09:50.892 11587-11610/? I/DynamiteModule: Selected local version of com.google.android.gms.flags
02-13 19:09:50.894 11587-11607/? I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
02-13 19:09:50.894 11587-11607/? I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
02-13 19:09:50.894 11587-11587/? V/FA: Cancelling job. JobID: -386501406
02-13 19:09:50.895 11587-11587/? V/FA: Registered activity lifecycle callback
02-13 19:09:50.896 11587-11587/? I/FirebaseInitProvider: FirebaseApp initialization successful
02-13 19:09:50.917 11587-11613/? V/FA: Collection enabled
02-13 19:09:50.917 11587-11613/? V/FA: App package, google app id: com.example.xovin.organizerrozwojuosobistego, 1:922322846834:android:d173fbb977e9a87d
02-13 19:09:50.918 11587-11613/? I/FA: App measurement is starting up, version: 11910
02-13 19:09:50.918 11587-11613/? I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
02-13 19:09:50.918 11587-11610/? W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
02-13 19:09:50.919 11587-11613/? I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.xovin.organizerrozwojuosobistego
02-13 19:09:50.919 11587-11613/? D/FA: Debug-level message logging enabled
02-13 19:09:50.922 11587-11610/? I/DynamiteModule: Considering local module com.google.android.gms.crash:0 and remote module com.google.android.gms.crash:10
02-13 19:09:50.922 11587-11610/? I/DynamiteModule: Selected remote version of com.google.android.gms.crash, version >= 10
02-13 19:09:50.925 11587-11587/? V/FA: onActivityCreated
02-13 19:09:50.974 11587-11610/? W/zygote: Skipping duplicate class check due to unrecognized classloader
02-13 19:09:50.979 11587-11613/? V/FA: Connecting to remote service
02-13 19:09:50.992 11587-11613/? V/FA: Connection attempt already in progress
02-13 19:09:50.995 11587-11610/? I/FirebaseCrashApiImpl: FirebaseCrashApiImpl created by ClassLoader ae[DexPathList[[zip file "/system/priv-app/PrebuiltGmsCore/app_chimera/m/DynamiteModulesC.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000003/n/x86, /system/lib, /vendor/lib]]]
02-13 19:09:50.995 11587-11610/? I/FirebaseCrash: FirebaseCrash reporting loaded - com.google.android.gms.internal.zzdzk#963bd28
02-13 19:09:51.006 11587-11611/? I/DynamiteModule: Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:0
02-13 19:09:51.006 11587-11611/? I/DynamiteModule: Selected local version of com.google.android.gms.flags
02-13 19:09:51.012 11587-11611/? W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
02-13 19:09:51.042 11587-11611/? I/FirebaseCrashApiImpl: FirebaseCrash reporting API initialized
02-13 19:09:51.042 11587-11611/? I/FirebaseCrash: FirebaseCrash reporting initialized com.google.android.gms.internal.zzdzk#963bd28
02-13 19:09:51.042 11587-11611/? D/FirebaseCrash: Firebase Analytics Listener for Firebase Crash is initialized
02-13 19:09:51.134 11587-11587/? W/linker: "/data/user_de/0/com.google.android.gms/app_extracted_libs/x86/libconscrypt_gmscore_jni.so" unused DT entry: type 0xf arg 0x91
02-13 19:09:51.135 11587-11587/? V/NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 276 native methods...
02-13 19:09:51.183 11587-11587/? D/NetworkSecurityConfig: No Network Security Config specified, using platform default
02-13 19:09:51.185 11587-11592/? I/zygote: Do partial code cache collection, code=28KB, data=30KB
02-13 19:09:51.185 11587-11587/? I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL
02-13 19:09:51.186 11587-11592/? I/zygote: After code cache collection, code=27KB, data=30KB
02-13 19:09:51.186 11587-11592/? I/zygote: Increasing code cache capacity to 128KB
02-13 19:09:51.223 11587-11613/? V/FA: Connection attempt already in progress
02-13 19:09:51.224 11587-11613/? V/FA: Activity resumed, time: 79702594
02-13 19:09:51.239 11587-11613/? I/FA: Tag Manager is not found and thus will not be used
02-13 19:09:51.241 11587-11613/? D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-3727998583761649633}]
02-13 19:09:51.243 11587-11618/? D/OpenGLRenderer: HWUI GL Pipeline
02-13 19:09:51.274 11587-11613/? V/FA: Connection attempt already in progress
02-13 19:09:51.307 11587-11592/? I/zygote: Do partial code cache collection, code=37KB, data=54KB
02-13 19:09:51.310 11587-11592/? I/zygote: After code cache collection, code=34KB, data=53KB
02-13 19:09:51.310 11587-11592/? I/zygote: Increasing code cache capacity to 256KB
02-13 19:09:51.312 11587-11592/? I/zygote: JIT allocated 71KB for compiled code of void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
02-13 19:09:51.312 11587-11592/? I/zygote: Compiler allocated 4MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
02-13 19:09:53.367 11587-11618/com.example.xovin.organizerrozwojuosobistego I/OpenGLRenderer: Initialized EGL, version 1.4
02-13 19:09:53.367 11587-11618/com.example.xovin.organizerrozwojuosobistego D/OpenGLRenderer: Swap behavior 1
02-13 19:09:53.367 11587-11618/com.example.xovin.organizerrozwojuosobistego W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
02-13 19:09:53.367 11587-11618/com.example.xovin.organizerrozwojuosobistego D/OpenGLRenderer: Swap behavior 0
02-13 19:09:54.392 11587-11618/com.example.xovin.organizerrozwojuosobistego D/EGL_emulation: eglCreateContext: 0xa2f74f00: maj 2 min 0 rcv 2
02-13 19:09:55.204 11587-11592/com.example.xovin.organizerrozwojuosobistego I/zygote: Do full code cache collection, code=125KB, data=68KB
02-13 19:09:55.223 11587-11592/com.example.xovin.organizerrozwojuosobistego I/zygote: After code cache collection, code=102KB, data=39KB
02-13 19:09:55.400 11587-11618/com.example.xovin.organizerrozwojuosobistego D/EGL_emulation: eglMakeCurrent: 0xa2f74f00: ver 2 0 (tinfo 0x92495230)
02-13 19:09:55.428 11587-11587/com.example.xovin.organizerrozwojuosobistego I/Choreographer: Skipped 249 frames! The application may be doing too much work on its main thread.
02-13 19:09:57.664 11587-11618/com.example.xovin.organizerrozwojuosobistego D/EGL_emulation: eglMakeCurrent: 0xa2f74f00: ver 2 0 (tinfo 0x92495230)
02-13 19:09:59.755 11587-11587/com.example.xovin.organizerrozwojuosobistego I/Choreographer: Skipped 259 frames! The application may be doing too much work on its main thread.
02-13 19:09:59.755 11587-11613/com.example.xovin.organizerrozwojuosobistego D/FA: Connected to remote service
02-13 19:09:59.755 11587-11613/com.example.xovin.organizerrozwojuosobistego V/FA: Processing queued up service tasks: 4
02-13 19:09:59.922 11587-11587/com.example.xovin.organizerrozwojuosobistego W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
02-13 19:09:59.928 11587-11587/com.example.xovin.organizerrozwojuosobistego I/chatty: uid=10089(u0_a89) com.example.xovin.organizerrozwojuosobistego identical 7 lines
02-13 19:09:59.928 11587-11587/com.example.xovin.organizerrozwojuosobistego W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
02-13 19:09:59.935 11587-11587/com.example.xovin.organizerrozwojuosobistego I/AssistStructure: Flattened final assist data: 9104 bytes, containing 1 windows, 44 views
02-13 19:09:59.950 11587-11628/com.example.xovin.organizerrozwojuosobistego I/FirebaseCrash: Sending crashes
02-13 19:10:01.237 11587-11613/com.example.xovin.organizerrozwojuosobistego V/FA: Session started, time: 79712610
02-13 19:10:01.240 11587-11613/com.example.xovin.organizerrozwojuosobistego D/FA: Logging event (FE): session_start(_s), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-3727998583761649633}]
02-13 19:10:06.267 11587-11613/com.example.xovin.organizerrozwojuosobistego V/FA: Inactivity, disconnecting from the service
02-13 19:10:07.754 11587-11592/com.example.xovin.organizerrozwojuosobistego I/zygote: Do partial code cache collection, code=123KB, data=70KB
02-13 19:10:07.754 11587-11592/com.example.xovin.organizerrozwojuosobistego I/zygote: After code cache collection, code=123KB, data=70KB
02-13 19:10:07.754 11587-11592/com.example.xovin.organizerrozwojuosobistego I/zygote: Increasing code cache capacity to 512KB
02-13 19:10:26.008 11587-11592/com.example.xovin.organizerrozwojuosobistego I/zygote: Do full code cache collection, code=241KB, data=166KB
02-13 19:10:26.008 11587-11592/com.example.xovin.organizerrozwojuosobistego I/zygote: After code cache collection, code=162KB, data=105KB
02-13 19:10:31.670 11587-11587/com.example.xovin.organizerrozwojuosobistego D/AndroidRuntime: Shutting down VM
02-13 19:10:31.671 11587-11587/com.example.xovin.organizerrozwojuosobistego E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.xovin.organizerrozwojuosobistego, PID: 11587
java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
at com.example.xovin.organizerrozwojuosobistego.DailyFragment.saveQuote(DailyFragment.java:61)
at com.example.xovin.organizerrozwojuosobistego.DailyFragment$1.onClick(DailyFragment.java:48)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
02-13 19:10:31.671 11587-11587/com.example.xovin.organizerrozwojuosobistego E/UncaughtException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
at com.example.xovin.organizerrozwojuosobistego.DailyFragment.saveQuote(DailyFragment.java:61)
at com.example.xovin.organizerrozwojuosobistego.DailyFragment$1.onClick(DailyFragment.java:48)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
02-13 19:10:31.675 11587-11613/com.example.xovin.organizerrozwojuosobistego D/FA: Logging event (FE): app_exception(_ae), Bundle[{firebase_event_origin(_o)=crash, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-3727998583761649633, timestamp=1518549031673, fatal=1}]
02-13 19:10:31.747 11587-11613/com.example.xovin.organizerrozwojuosobistego V/FA: Connecting to remote service
02-13 19:10:31.749 11587-11613/com.example.xovin.organizerrozwojuosobistego V/FA: Recording user engagement, ms: 40528
02-13 19:10:31.752 11587-11613/com.example.xovin.organizerrozwojuosobistego D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=40528, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-3727998583761649633}]
02-13 19:10:31.766 11587-11613/com.example.xovin.organizerrozwojuosobistego V/FA: Connection attempt already in progress
02-13 19:10:31.902 11587-11638/com.example.xovin.organizerrozwojuosobistego I/FirebaseCrash: Sending crashes
02-13 19:10:32.501 11587-11638/com.example.xovin.organizerrozwojuosobistego I/FirebaseCrash: Response code: 200
02-13 19:10:32.503 11587-11638/com.example.xovin.organizerrozwojuosobistego I/FirebaseCrash: Report sent with crash report id: 1794c89e94000000
Button saveButton = (Button)layout.findViewById(R.id.bn_save);
saveButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// do something when the corky2 is clicked
}
});
try this way since i think when you go to your fragment it changes your view so basically you are not on the right view
I'm trying to write a function to increment unread message count in a chatapp(android) using transaction in Firebase.
My database structure looks like:
The member list can in fact contain more than 2 users for a group chat which I intend to expand later.
Currently, messages can be added into the messageList but after adding to the messageList I want to increase the unreadCount for all other user except the sender as well. I realised that I need to make use of Transaction to make it atomic so this is my incrementUnreadCount code.
private static void incrementUnreadCount(String chatRoomId) {
DatabaseReference mDatabaseMemberList = mDatabaseChatRooms.child(chatRoomId).child("memberList");
mDatabaseMemberList.runTransaction(new Transaction.Handler() {
#Override
public Transaction.Result doTransaction(MutableData mutableData) {
Map<String, Map<String, Object>> tempMemberList = (Map<String, Map<String, Object>>) mutableData.getValue();
if (tempMemberList == null) {
return Transaction.abort();
}
for (String key : tempMemberList.keySet()) {
// if it is not a sender node
if (!key.equals(TutUserManager.getCurrentUid())) {
Map<String, Object> tempMap = tempMemberList.get(key);
long tempCount = (long) tempMap.get("unreadCount");
tempCount += 1;
tempMap.put("unreadCount", tempCount);
tempMemberList.put(key, tempMap);
}
}
mutableData.setValue(tempMemberList);
return Transaction.success(mutableData);
}
#Override
public void onComplete(DatabaseError databaseError, boolean b, DataSnapshot dataSnapshot) {
}
});
}
The following code works only when I send the second message. So the value of unreadCount is 1 less than what it is expected to be.
I read the doc and realised that for the null case it is supposed to be:
return Transaction.success(mutableData);
and not:
return Transaction.abort();
as abort() will make server abort the transaction instead of trying to make the transaction again.
I try to change the code above to use return ransaction.success(mutableData); but it causes the app to crash upon calling the function.
Did I miss something ?
This is what I get from the console:
11/14 23:19:25: Launching app
No apk changes detected since last installation, skipping installation of C:\Users\Potcharaphol\AndroidStudioProjects\Tut\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop com.pchatanan.tut
$ adb shell am start -n "com.pchatanan.tut/com.pchatanan.tut.MainActivities.GetStartedActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.pchatanan.tut.test | com.pchatanan.tut
Connecting to com.pchatanan.tut
E/HAL: load: id=gralloc != hmi->id=gralloc
I/System.out: Sending WAIT chunk
I/art: Debugger is active
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
Connected to the target VM, address: 'localhost:8600', transport: 'socket'
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1339)
I/InstantRun: Instant Run Runtime started. Android package is com.pchatanan.tut, real application class is null.
[ 11-14 23:19:29.241 2931: 2931 E/ ]
process stopped due to unexpected signal 13
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
[ 11-14 23:19:29.819 2931: 2931 E/ ]
process stopped due to unexpected signal 13
I/FA: App measurement is starting up, version: 9877
I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
I/FA: To enable faster debug mode event logging run:
adb shell setprop firebase.analytics.debug-mode com.pchatanan.tut
I/HwCust: Constructor found for class android.app.HwCustAlarmManagerImpl
I/FirebaseInitProvider: FirebaseApp initialization successful
I/HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
[ 11-14 23:19:30.422 2931: 2931 E/ ]
process stopped due to unexpected signal 13
I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
I/HwSecImmHelper: mSecurityInputMethodService is null
W/ActionBarDrawerToggle: DrawerToggle may not show up because NavigationIcon is not visible. You may need to call actionbar.setDisplayHomeAsUpEnabled(true);
I/DynamiteModule: Considering local module com.google.android.gms.firebase_database:4 and remote module com.google.android.gms.firebase_database:4
I/DynamiteModule: Selected remote version of com.google.android.gms.firebase_database, version >= 4
W/System: ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/00000018/n/arm64-v8a
[ 11-14 23:19:31.068 2931: 2931 E/ ]
process stopped due to unexpected signal 13
E/HAL: load: id=gralloc != hmi->id=gralloc
I/OpenGLRenderer: Initialized EGL, version 1.4
I/System: core_booster, getBoosterConfig = false
I/System: core_booster, getBoosterConfig = false
[ 11-14 23:19:33.493 2931: 2931 E/ ]
process stopped due to unexpected signal 13
W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
I/System: core_booster, getBoosterConfig = false
I/System: core_booster, getBoosterConfig = false
[ 11-14 23:19:35.396 2931: 2931 E/ ]
process stopped due to unexpected signal 13
I/HwSecImmHelper: mSecurityInputMethodService is null
I/HwSecImmHelper: mSecurityInputMethodService is null
I/HwSecImmHelper: mSecurityInputMethodService is null
W/art: Suspending all threads took: 14.466ms
I/FA: Tag Manager is not found and thus will not be used
I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
I/HwSecImmHelper: mSecurityInputMethodService is null
I/HwSecImmHelper: mSecurityInputMethodService is null
I/System: core_booster, getBoosterConfig = false
I/System: core_booster, getBoosterConfig = false
I/HwSecImmHelper: mSecurityInputMethodService is null
I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
E/RecyclerView: No adapter attached; skipping layout
I/HwSecImmHelper: mSecurityInputMethodService is null
I/HwSecImmHelper: mSecurityInputMethodService is null
E/RecyclerView: No adapter attached; skipping layout
I/HwSecImmHelper: mSecurityInputMethodService is null
I/HwSecImmHelper: mSecurityInputMethodService is null
I/HwSecImmHelper: mSecurityInputMethodService is null
I/HwSecImmHelper: mSecurityInputMethodService is null
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
I/Process: Sending signal. PID: 20588 SIG: 9
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
This is what I get from logcat, there seems to be no errors.
[ 11-14 23:21:49.129 2931: 2931 E/ ]
process stopped due to unexpected signal 13
11-14 23:21:49.321 21571-21571/com.pchatanan.tut I/System.out: waiting for debugger to settle...
11-14 23:21:49.522 21571-21571/com.pchatanan.tut I/System.out: waiting for debugger to settle...
11-14 23:21:49.723 21571-21571/com.pchatanan.tut I/System.out: waiting for debugger to settle...
[ 11-14 23:21:49.781 2931: 2931 E/ ]
process stopped due to unexpected signal 13
11-14 23:21:49.924 21571-21571/com.pchatanan.tut I/System.out: waiting for debugger to settle...
11-14 23:21:50.125 21571-21571/com.pchatanan.tut I/System.out: debugger has settled (1319)
11-14 23:21:50.149 21571-21571/com.pchatanan.tut I/InstantRun: Instant Run Runtime started. Android package is com.pchatanan.tut, real application class is null.
[ 11-14 23:21:50.364 2931: 2931 E/ ]
process stopped due to unexpected signal 13
11-14 23:21:50.842 21571-21633/com.pchatanan.tut W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
11-14 23:21:50.863 21571-21633/com.pchatanan.tut W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
11-14 23:21:50.973 21571-21571/com.pchatanan.tut I/FA: App measurement is starting up, version: 9877
11-14 23:21:50.973 21571-21571/com.pchatanan.tut I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
11-14 23:21:50.980 21571-21571/com.pchatanan.tut I/FA: To enable faster debug mode event logging run:
adb shell setprop firebase.analytics.debug-mode com.pchatanan.tut
[ 11-14 23:21:50.999 2931: 2931 E/ ]
process stopped due to unexpected signal 13
11-14 23:21:51.035 21571-21571/com.pchatanan.tut I/HwCust: Constructor found for class android.app.HwCustAlarmManagerImpl
11-14 23:21:51.043 21571-21571/com.pchatanan.tut I/FirebaseInitProvider: FirebaseApp initialization successful
11-14 23:21:51.140 21571-21571/com.pchatanan.tut I/HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl
11-14 23:21:51.216 21571-21571/com.pchatanan.tut W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
11-14 23:21:51.601 21571-21571/com.pchatanan.tut I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
[ 11-14 23:21:51.609 2931: 2931 E/ ]
process stopped due to unexpected signal 13
11-14 23:21:51.875 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:21:51.925 21571-21571/com.pchatanan.tut W/ActionBarDrawerToggle: DrawerToggle may not show up because NavigationIcon is not visible. You may need to call actionbar.setDisplayHomeAsUpEnabled(true);
11-14 23:21:52.015 21571-21571/com.pchatanan.tut I/DynamiteModule: Considering local module com.google.android.gms.firebase_database:4 and remote module com.google.android.gms.firebase_database:4
11-14 23:21:52.015 21571-21571/com.pchatanan.tut I/DynamiteModule: Selected remote version of com.google.android.gms.firebase_database, version >= 4
11-14 23:21:52.030 21571-21571/com.pchatanan.tut W/System: ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/00000018/n/arm64-v8a
11-14 23:21:52.192 21571-21651/com.pchatanan.tut E/HAL: load: id=gralloc != hmi->id=gralloc
11-14 23:21:52.193 21571-21651/com.pchatanan.tut I/OpenGLRenderer: Initialized EGL, version 1.4
11-14 23:21:52.194 21571-21666/com.pchatanan.tut I/System: core_booster, getBoosterConfig = false
[ 11-14 23:21:52.196 2931: 2931 E/ ]
process stopped due to unexpected signal 13
11-14 23:21:54.257 21571-21711/com.pchatanan.tut I/System: core_booster, getBoosterConfig = false
[ 11-14 23:21:54.586 2931: 2931 E/ ]
process stopped due to unexpected signal 13
[ 11-14 23:21:55.208 2931: 2931 E/ ]
process stopped due to unexpected signal 13
11-14 23:21:56.193 21571-21571/com.pchatanan.tut W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
11-14 23:21:56.248 21571-21743/com.pchatanan.tut I/System: core_booster, getBoosterConfig = false
11-14 23:21:56.279 21571-21743/com.pchatanan.tut I/System: core_booster, getBoosterConfig = false
[ 11-14 23:21:56.442 2931: 2931 E/ ]
process stopped due to unexpected signal 13
[ 11-14 23:21:57.081 2931: 2931 E/ ]
process stopped due to unexpected signal 13
11-14 23:21:57.204 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:21:57.206 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:01.561 21571-21633/com.pchatanan.tut W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
[ 11-14 23:22:01.587 2931: 2931 E/ ]
process stopped due to unexpected signal 13
[ 11-14 23:22:02.195 2931: 2931 E/ ]
process stopped due to unexpected signal 13
[ 11-14 23:22:02.874 2931: 2931 E/ ]
process stopped due to unexpected signal 13
[ 11-14 23:22:03.487 2931: 2931 E/ ]
process stopped due to unexpected signal 13
11-14 23:22:07.605 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:07.720 21571-21641/com.pchatanan.tut I/FA: Tag Manager is not found and thus will not be used
11-14 23:22:07.775 21571-21571/com.pchatanan.tut I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
11-14 23:22:07.985 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:07.985 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:09.062 21571-21942/com.pchatanan.tut I/System: core_booster, getBoosterConfig = false
11-14 23:22:09.141 21571-21942/com.pchatanan.tut I/System: core_booster, getBoosterConfig = false
11-14 23:22:09.354 21571-21571/com.pchatanan.tut I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
11-14 23:22:09.454 21571-21571/com.pchatanan.tut E/RecyclerView: No adapter attached; skipping layout
11-14 23:22:09.471 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:09.472 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:09.476 21571-21571/com.pchatanan.tut E/RecyclerView: No adapter attached; skipping layout
11-14 23:22:10.246 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:10.308 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:10.309 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:10.313 21571-21571/com.pchatanan.tut I/HwSecImmHelper: mSecurityInputMethodService is null
11-14 23:22:13.747 21571-21571/com.pchatanan.tut I/Process: Sending signal. PID: 21571 SIG: 9
11-14 23:22:13.995 22048-22063/com.pchatanan.tut E/HAL: load: id=gralloc != hmi->id=gralloc
11-14 23:22:14.012 22048-22048/com.pchatanan.tut I/InstantRun: Instant Run Runtime started. Android package is com.pchatanan.tut, real application class is null.
11-14 23:22:14.575 22048-22083/com.pchatanan.tut W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
11-14 23:22:14.659 22086-22100/com.pchatanan.tut E/HAL: load: id=gralloc != hmi->id=gralloc
11-14 23:22:14.679 22086-22086/com.pchatanan.tut I/InstantRun: Instant Run Runtime started. Android package is com.pchatanan.tut, real application class is null.
11-14 23:22:15.323 22086-22133/com.pchatanan.tut W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
11-14 23:22:15.341 22086-22133/com.pchatanan.tut W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
11-14 23:22:15.462 22086-22086/com.pchatanan.tut I/FA: App measurement is starting up, version: 9877
11-14 23:22:15.462 22086-22086/com.pchatanan.tut I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
11-14 23:22:15.471 22086-22086/com.pchatanan.tut I/FA: To enable faster debug mode event logging run:
adb shell setprop firebase.analytics.debug-mode com.pchatanan.tut
11-14 23:22:15.524 22086-22086/com.pchatanan.tut I/HwCust: Constructor found for class android.app.HwCustAlarmManagerImpl
11-14 23:22:15.532 22086-22086/com.pchatanan.tut I/FirebaseInitProvider: FirebaseApp initialization successful
11-14 23:22:25.611 22086-22133/com.pchatanan.tut W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
In stead of iterate through each node in the Transaction thread, I use .addListenerForSingleValueEvent and iterate through each node. Then for the one that needs to be updated, I run the transaction code. This method works fine.
This is illustrated in the following code:
private static void incrementUnreadCount(String chatRoomId) {
final DatabaseReference mDatabaseMemberList = mDatabaseChatRooms.child(chatRoomId).child("memberList");
mDatabaseMemberList.addListenerForSingleValueEvent(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot child : dataSnapshot.getChildren()){
if(!child.getKey().equals(TutUserManager.getCurrentUid())){
mDatabaseMemberList.child(child.getKey()).runTransaction(new Transaction.Handler() {
#Override
public Transaction.Result doTransaction(MutableData mutableData) {
Map<String, Object> tempData = (Map<String, Object>) mutableData.getValue();
if(tempData == null){
return Transaction.success(mutableData);
}
long unreadCount = (long) tempData.get("unreadCount");
unreadCount += 1;
tempData.put("unreadCount", unreadCount);
mutableData.setValue(tempData);
return Transaction.success(mutableData);
}
#Override
public void onComplete(DatabaseError databaseError, boolean b, DataSnapshot dataSnapshot) {
}
});
}
}
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
}