I have an app that i've recently noticed crashes on devices that do not have Google Play Services installed. After a bit of debugging i've noticed the cause is Firebase.
This is fine with me because i figured Firebase needs Google Play Services to run.
The issue however is the sudden crash. I have tried detecting if Google Play Service is available first thing in the launcher activity so that i can show the user a proper message, but the app crashes immediately without even executing code in the launcher activity or in the Application class.
How can i properly handle this Firebase error. I need a proper way to catch the error or prevent it from occurring and display a proper message instead of a crash. I have looked at a lot of similar questions and tried the solutions out but this case looks a bit different.
Note, this ONLY happens when the app is in Release mode. Also, you will notice the logcat highlights SQLite, nowhere do i use SQLite in this project, i reckon maybe Firebase is referencing it.
App level gradle:
plugins{
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'realm-android'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
repositories {
maven { url 'https://maven.google.com' }
}
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.myapp"
minSdkVersion 19
targetSdkVersion 31
versionCode 14
versionName "2.3.3"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
configurations {
all {
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
}
}
realm {
syncEnabled = true
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.31"
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
//if i remove the firebase dependencies, everything runs smoothly
implementation 'com.google.firebase:firebase-core:20.0.0'
implementation 'com.google.firebase:firebase-crashlytics:18.2.4'
implementation 'com.google.firebase:firebase-analytics:20.0.0'
implementation 'com.google.firebase:firebase-messaging:23.0.0'
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-maps:18.0.0'
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:adapter-rxjava:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Project level gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.5.31'
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven { url 'https://plugins.gradle.org/m2/'}
// jcenter() //for now(31Jul2021) Realm depends on this, will remove when Realm has moved - maybe to mavenCentral
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath "io.realm:realm-gradle-plugin:10.8.0"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.0'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Logcat:
2021-11-02 23:15:31.406 17886-17886/com.myapp I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
2021-11-02 23:15:31.459 17886-17900/com.myapp E/SQLiteLog: (1) table log_event_dropped already exists
2021-11-02 23:15:31.459 17886-17886/com.myapp I/FirebaseCrashlytics: Initializing Firebase Crashlytics 18.2.4 for com.myapp
2021-11-02 23:15:31.466 17886-17900/com.myapp E/TransportRuntime.Executor: Background execution failure.
android.database.sqlite.SQLiteException: table log_event_dropped already exists (code 1): , while compiling: CREATE TABLE log_event_dropped (log_source VARCHAR(45) NOT NULL,reason INTEGER NOT NULL,events_dropped_count BIGINT NOT NULL,PRIMARY KEY(log_source, reason))
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:887)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:498)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1674)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1605)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.k(SourceFile:1)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.e(SourceFile)
at w20.upgrade(SourceFile)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.m(SourceFile:2)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.onUpgrade(SourceFile:2)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:256)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
at g20.a(SourceFile)
at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.r0(SourceFile:2)
at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.E(SourceFile:3)
at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.runCriticalSection(SourceFile:1)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.WorkInitializer.d(SourceFile:1)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.WorkInitializer.b(SourceFile)
at le0.run(SourceFile)
at q20$a.run(SourceFile:1)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
2021-11-02 23:15:31.482 17886-17906/com.myapp E/FirebaseMessaging: Google Play services missing or without correct permission.
2021-11-02 23:15:31.492 17886-17907/com.myapp E/ActivityThread: Failed to find provider info for com.google.android.gms.chimera
2021-11-02 23:15:31.493 17886-17907/com.myapp W/DynamiteModule: Failed to retrieve remote module version.
2021-11-02 23:15:31.500 17886-17907/com.myapp W/GooglePlayServicesUtil: Google Play Store is missing.
2021-11-02 23:15:31.500 17886-17907/com.myapp I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:55 and remote module com.google.android.gms.measurement.dynamite:0
2021-11-02 23:15:31.500 17886-17907/com.myapp I/DynamiteModule: Selected local version of com.google.android.gms.measurement.dynamite
2021-11-02 23:15:31.501 17886-17907/com.myapp W/GooglePlayServicesUtil: Google Play Store is missing.
2021-11-02 23:15:31.579 17886-17886/com.myapp I/FirebaseInitProvider: FirebaseApp initialization successful
2021-11-02 23:15:31.590 17886-17886/com.myapp D/WM-WrkMgrInitializer: Initializing WorkManager with default configuration.
2021-11-02 23:15:31.609 17886-17913/com.myapp V/FA: App measurement enabled for app package, google app id: com.myapp, 1:483778118943:android:c6a45e2f9497b6ac
2021-11-02 23:15:31.610 17886-17913/com.myapp I/FA: App measurement initialized, version: 46000
2021-11-02 23:15:31.610 17886-17913/com.myapp I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2021-11-02 23:15:31.610 17886-17913/com.myapp I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.myapp
2021-11-02 23:15:31.610 17886-17913/com.myapp D/FA: Debug-level message logging enabled
2021-11-02 23:15:31.669 17886-17886/com.myapp W/GooglePlayServicesUtil: Google Play Store is missing.
2021-11-02 23:15:31.677 17886-17913/com.myapp V/FA: Checking service availability
2021-11-02 23:15:31.679 17886-17913/com.myapp W/GooglePlayServicesUtil: Google Play Store is missing.
2021-11-02 23:15:31.679 17886-17913/com.myapp W/FA: Service invalid
2021-11-02 23:15:31.681 17886-17913/com.myapp V/FA: Using local app measurement service
2021-11-02 23:15:31.706 17886-17913/com.myapp V/FA: Connection attempt already in progress
2021-11-02 23:15:31.721 17886-17886/com.myapp E/ResourceType: Style contains key with bad entry: 0x0101056c
2021-11-02 23:15:31.722 17886-17913/com.myapp V/FA: Connection attempt already in progress
2021-11-02 23:15:31.736 17886-17907/com.myapp V/FA: onActivityCreated
2021-11-02 23:15:31.857 17886-17913/com.myapp V/FA: Activity resumed, time: 67518553
2021-11-02 23:15:31.865 17886-17913/com.myapp I/FA: Tag Manager is not found and thus will not be used
2021-11-02 23:15:31.869 17886-17924/com.myapp D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
2021-11-02 23:15:31.869 17886-17913/com.myapp W/GooglePlayServicesUtil: Google Play services is missing.
2021-11-02 23:15:31.879 17886-17886/com.myapp V/FA: Local AppMeasurementService is starting up
2021-11-02 23:15:31.895 17886-17913/com.myapp V/FA: Connection attempt already in progress
2021-11-02 23:15:31.895 17886-17913/com.myapp V/FA: Connection attempt already in progress
2021-11-02 23:15:31.921 17886-17924/com.myapp I/OpenGLRenderer: Initialized EGL, version 1.4
2021-11-02 23:15:31.921 17886-17924/com.myapp W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2021-11-02 23:15:31.925 17886-17924/com.myapp D/EGL_emulation: eglCreateContext: 0x7ff0504fa320: maj 3 min 0 rcv 3
2021-11-02 23:15:31.925 17886-17913/com.myapp V/FA: Upload scheduled in approximately ms: 2087017
2021-11-02 23:15:31.926 17886-17913/com.myapp V/FA: Unscheduling upload
2021-11-02 23:15:31.927 17886-17913/com.myapp V/FA: Scheduling upload, millis: 2087017
2021-11-02 23:15:31.928 17886-17924/com.myapp D/EGL_emulation: eglMakeCurrent: 0x7ff0504fa320: ver 3 0 (tinfo 0x7ff05d016b40)
2021-11-02 23:15:31.929 17886-17924/com.myapp E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
2021-11-02 23:15:31.929 17886-17924/com.myapp E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
2021-11-02 23:15:31.942 17886-17924/com.myapp D/EGL_emulation: eglMakeCurrent: 0x7ff0504fa320: ver 3 0 (tinfo 0x7ff05d016b40)
2021-11-02 23:15:31.952 17886-17886/com.myapp V/FA: Bound to IMeasurementService interface
2021-11-02 23:15:31.953 17886-17913/com.myapp V/FA: Connected to service
2021-11-02 23:15:31.954 17886-17913/com.myapp V/FA: Processing queued up service tasks: 5
2021-11-02 23:15:31.956 17886-17913/com.myapp V/FA: Storage concurrent access okay
2021-11-02 23:15:31.971 17886-17913/com.myapp V/FA: Parsed config. version, gmp_app_id: 1630707713501066, 1:483778118943:android:c6a45e2f9497b6ac
2021-11-02 23:15:31.975 17886-17913/com.myapp D/FA: Unable to get advertising id: com.google.android.gms.common.GooglePlayServicesNotAvailableException: com.google.android.gms.measurement.internal.zzjp.b(SourceFile:12)
2021-11-02 23:15:32.027 17886-17913/com.myapp V/FA: Logging event: origin=auto,name=screen_view(_vs),params=Bundle[{ga_event_origin(_o)=auto, ga_screen_class(_sc)=SplashActivity, ga_screen_id(_si)=-5424791619731338053}]
2021-11-02 23:15:32.029 17886-17913/com.myapp A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x25ff70 in tid 17913 (Measurement Wor)
2021-11-02 23:15:32.119 17886-17900/com.myapp E/SQLiteLog: (1) table log_event_dropped already exists
2021-11-02 23:15:32.119 17886-17900/com.myapp W/TransportRuntime: Error scheduling event table log_event_dropped already exists (code 1): , while compiling: CREATE TABLE log_event_dropped (log_source VARCHAR(45) NOT NULL,reason INTEGER NOT NULL,events_dropped_count BIGINT NOT NULL,PRIMARY KEY(log_source, reason))
2021-11-02 23:15:32.120 17886-17908/com.myapp W/FirebaseCrashlytics: Crashlytics report could not be enqueued to DataTransport
android.database.sqlite.SQLiteException: table log_event_dropped already exists (code 1): , while compiling: CREATE TABLE log_event_dropped (log_source VARCHAR(45) NOT NULL,reason INTEGER NOT NULL,events_dropped_count BIGINT NOT NULL,PRIMARY KEY(log_source, reason))
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:887)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:498)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1674)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1605)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.k(SourceFile:1)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.e(SourceFile)
at w20.upgrade(SourceFile)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.m(SourceFile:2)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.onUpgrade(SourceFile:2)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:256)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
at g20.a(SourceFile)
at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.r0(SourceFile:2)
at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.E(SourceFile:3)
at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.runCriticalSection(SourceFile:1)
at com.google.android.datatransport.runtime.scheduling.DefaultScheduler.d(SourceFile:8)
at com.google.android.datatransport.runtime.scheduling.DefaultScheduler.a(SourceFile)
at fd.run(SourceFile)
at q20$a.run(SourceFile:1)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
2021-11-02 23:15:32.124 17886-17900/com.myapp E/SQLiteLog: (1) table log_event_dropped already exists
2021-11-02 23:15:32.124 17886-17900/com.myapp W/TransportRuntime: Error scheduling event table log_event_dropped already exists (code 1): , while compiling: CREATE TABLE log_event_dropped (log_source VARCHAR(45) NOT NULL,reason INTEGER NOT NULL,events_dropped_count BIGINT NOT NULL,PRIMARY KEY(log_source, reason))
2021-11-02 23:15:32.125 17886-17908/com.myapp W/FirebaseCrashlytics: Crashlytics report could not be enqueued to DataTransport
android.database.sqlite.SQLiteException: table log_event_dropped already exists (code 1): , while compiling: CREATE TABLE log_event_dropped (log_source VARCHAR(45) NOT NULL,reason INTEGER NOT NULL,events_dropped_count BIGINT NOT NULL,PRIMARY KEY(log_source, reason))
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:887)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:498)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1674)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1605)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.k(SourceFile:1)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.e(SourceFile)
at w20.upgrade(SourceFile)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.m(SourceFile:2)
at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.onUpgrade(SourceFile:2)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:256)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
at g20.a(SourceFile)
at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.r0(SourceFile:2)
at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.E(SourceFile:3)
at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.runCriticalSection(SourceFile:1)
at com.google.android.datatransport.runtime.scheduling.DefaultScheduler.d(SourceFile:8)
at com.google.android.datatransport.runtime.scheduling.DefaultScheduler.a(SourceFile)
at fd.run(SourceFile)
at q20$a.run(SourceFile:1)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
I finally figured how to go about this.
FirebaseCrashlytics initializes even before the Application class is executed and therefore in release mode on a device without Google Play Service it instantly crashes. The best way to handle this properly is to disable FirebaseCrashlytics from immediately trying to collect any analytics data when running the app by disabling analytics collection in the Android Manifest:
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="false" />
Then in the Application class, we can check if Google Play Services is available. If so we can proceed to enable analytics by Firebase:
class MyApp : Application(){
override fun onCreate() {
super.onCreate()
if(isGooglePlayServicesAvailable()){
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true)
}else{
//show user proper error
}
}
private fun isGooglePlayServicesAvailable(): Boolean {
val googleApiAvailability = GoogleApiAvailability.getInstance()
val status = googleApiAvailability.isGooglePlayServicesAvailable(this)
if (status != ConnectionResult.SUCCESS) {
return false
}
return true
}
}
Related
I am in the process of setting up FirebaseUI using Google's guide but I suddenly got an error I can't seem to find a solution for. I'm pretty sure it has to do with my gradle, because I've tried commenting changes in my Java files, using my phone instead of an AVD, and other emulators to no avail. I've included what I got in the Run console, Manifest, and gradles. If you need more information, please let me know. Thanks!
EDIT: For those with the same issue, I think I fixed it by updating Google Play services on the API Q emulator (you have to sign in to Google Play first), then I added the following to the app-level gradle:
android {
...
compileOptions {
...
sourceCompatibility = 1.8
targetCompatibility = 1.8
...
}
...
}
I don't know how it worked, but I hope it does for you too.
Run (conflicts only)
...
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
...
W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
E/vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so" not found.
E/libEGL: load_driver(/vendor/lib/egl/libGLES_emulation.so): unknown
W/RenderThread: type=1400 audit(0.0:4480): avc: denied { write } for name="property_service" dev="tmpfs" ino=8377 scontext=u:r:untrusted_app_27:s0:c119,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0
...
W/xample.litloca: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection)
Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection)
...
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
...
W/Gralloc3: mapper 3.x is not supported
Run (full)
09/07 19:52:53: Launching 'app' on Pixel 2 API Q.
$ adb shell am start -n "com.example.litlocal/com.example.litlocal.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Waiting for process to come online...
Connected to process 14608 on device 'Pixel_2_API_Q [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/xample.litloca: The ClassLoaderContext is a special shared library.
I/xample.litloca: The ClassLoaderContext is a special shared library.
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.
I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
V/FA: Registered activity lifecycle callback
I/FirebaseInitProvider: FirebaseApp initialization successful
D/OpenGLRenderer: Skia GL Pipeline
D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
E/vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so" not found.
E/libEGL: load_driver(/vendor/lib/egl/libGLES_emulation.so): unknown
D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
W/RenderThread: type=1400 audit(0.0:4449): avc: denied { write } for name="property_service" dev="tmpfs" ino=8377 scontext=u:r:untrusted_app_27:s0:c119,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0
D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
V/FA: onActivityCreated
W/xample.litloca: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection)
W/xample.litloca: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection)
D/: HostConnection::get() New Host Connection established 0xdc721500, tid 14666
D/: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_host_composition_v1 GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
D/OpenGLRenderer: Swap behavior 1
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer: Swap behavior 0
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation: eglCreateContext: 0xdc7124e0: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0xdc7124e0: ver 3 0 (tinfo 0xdc708f60)
V/FA: Collection enabled
V/FA: App package, google app id: com.example.litlocal, 1:175514927228:android:47ec351c4609ff5c6609f9
W/Gralloc3: mapper 3.x is not supported
I/FA: App measurement is starting up, version: 18202
To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.litlocal
D/FA: Debug-level message logging enabled
D/: createUnique: call
D/: HostConnection::get() New Host Connection established 0xdc721640, tid 14666
D/: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_host_composition_v1 GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
D/EGL_emulation: eglMakeCurrent: 0xdc7124e0: ver 3 0 (tinfo 0xdc708f60)
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 0
I/xample.litloca: Background young concurrent copying GC freed 16987(4410KB) AllocSpace objects, 8(224KB) LOS objects, 78% free, 1696KB/7840KB, paused 6.401ms total 59.038ms
V/FA: Connecting to remote service
V/FA: Detected application was in foreground
V/FA: Session started, time: 27900964
D/FA: Setting user property (FE): _sid, 1567911177
V/FA: Connection attempt already in progress
I/FA: Tag Manager is not found and thus will not be used
D/FA: Logging event (FE): session_start(_s), Bundle[{ga_event_origin(_o)=auto, ga_session_id(_sid)=1567911177}]
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
V/FA: Activity resumed, time: 27900309
D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=8377598752693967695}]
V/FA: Connection attempt already in progress
Connection attempt already in progress
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 6
V/FA: Inactivity, disconnecting from the service
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.litlocal">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="LitLocal">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".CreateEventActivity"
android:label="#string/create_event_activity_name"/>
<activity
android:name=".SetEventLocationActivity"
android:label="#string/set_event_location_activity_name"/>
<activity
android:name=".LoginActivity"
android:label="#string/login_activity_name"/>
</application>
</manifest>
Gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Grade (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.litlocal"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resConfigs "en"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
/*sourceCompatibility = 1.8
targetCompatibility = 1.8*/
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:8.2.1'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v8:0.9.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.google.firebase:firebase-firestore:21.0.0'
//implementation 'com.firebaseui:firebase-ui-database:5.1.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
// Tentative for login
//implementation 'com.squareup.picasso:picasso:2.71828'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
This worked for me:
android {
...
compileOptions {
...
sourceCompatibility = 1.8
targetCompatibility = 1.8
...
}
...
}
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.
My app keeps crashing but I can't figure out why.
Can someone please tell me
My Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.securitytechno2018"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-
android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main { java.srcDirs = ['src/main/java',
'src/main/java/com/securitytechno2018/listeners'] }
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:cardview-v7:27.0.0'
implementation 'com.android.support:design:27.0.0'
implementation 'com.android.support:recyclerview-v7:27.0.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.firebaseui:firebase-ui-database:3.2.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.google.code.gson:gson:2.8.0'
}
apply plugin: 'com.google.gms.google-services'
My logcat:
04-25 10:10:44.101 1621-1621/system_process I/InstallerConnection: connecting...
[ 04-25 10:10:44.102 1302: 1302 I/ ]
new connection
04-25 10:10:44.145 1621-1621/system_process I/InstallerConnection: disconnecting...
[ 04-25 10:10:44.145 1302: 1302 E/ ]
eof
[ 04-25 10:10:44.145 1302: 1302 E/ ]
failed to read size
[ 04-25 10:10:44.145 1302: 1302 I/ ]
closing connection
04-25 10:10:44.551 1621-1621/system_process I/InstallerConnection: connecting...
[ 04-25 10:10:44.551 1302: 1302 I/ ]
new connection
04-25 10:11:00.376 1621-1621/system_process W/IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
04-25 10:11:48.189 2633-2658/com.securitytechno2018 E/FirebaseInstanceId: Google Play services missing or without correct permission.
04-25 10:11:48.252 2633-2633/com.securitytechno2018 V/FA: Cancelling job. JobID: 2074818501
04-25 10:11:48.256 2633-2633/com.securitytechno2018 V/FA: Registered activity lifecycle callback
04-25 10:11:48.311 2633-2633/com.securitytechno2018 V/FA: onActivityCreated
04-25 10:11:49.476 2633-2671/com.securitytechno2018 V/FA: Collection enabled
04-25 10:11:49.476 2633-2671/com.securitytechno2018 V/FA: App package, google app id: com.securitytechno2018, 1:702727695830:android:1ac1b0e480da2fe9
04-25 10:11:49.476 2633-2671/com.securitytechno2018 I/FA: App measurement is starting up, version: 11910
04-25 10:11:49.477 2633-2671/com.securitytechno2018 I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
04-25 10:11:49.478 2633-2671/com.securitytechno2018 I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.securitytechno2018
04-25 10:11:49.478 2633-2671/com.securitytechno2018 D/FA: Debug-level message logging enabled
04-25 10:11:49.505 2633-2671/com.securitytechno2018 V/FA: Checking service availability
04-25 10:11:49.518 2633-2671/com.securitytechno2018 W/FA: Service invalid
04-25 10:11:49.521 2633-2671/com.securitytechno2018 V/FA: Using local app measurement service
04-25 10:11:49.561 2633-2671/com.securitytechno2018 V/FA: Connection attempt already in progress
04-25 10:11:51.294 2633-2671/com.securitytechno2018 V/FA: Connection attempt already in progress
04-25 10:11:51.297 2633-2671/com.securitytechno2018 V/FA: Activity resumed, time: 77330
04-25 10:11:51.370 2633-2633/com.securitytechno2018 V/FA: Local AppMeasurementService is starting up
04-25 10:11:51.400 2633-2671/com.securitytechno2018 D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=SplashScreen, firebase_screen_id(_si)=1354703464960186567}]
04-25 10:11:51.434 2633-2633/com.securitytechno2018 V/FA: Bound to IMeasurementService interface
04-25 10:11:51.508 2633-2671/com.securitytechno2018 V/FA: Connection attempt already in progress
04-25 10:11:51.509 2633-2671/com.securitytechno2018 V/FA: Connected to service
04-25 10:11:51.509 2633-2671/com.securitytechno2018 V/FA: Processing queued up service tasks: 4
04-25 10:11:51.525 2633-2671/com.securitytechno2018 I/FA: This instance being marked as an uploader
04-25 10:11:51.617 2633-2671/com.securitytechno2018 V/FA: Nothing to upload or uploading impossible
04-25 10:11:51.685 2633-2671/com.securitytechno2018 V/FA: Cancelling job. JobID: 2074818501
Try running on real Device, the problem is related to emulators or genymotion virtual machines.
check that you have google play services installed.
Download google play service sdk and add ACCESS_FINE_LOCATION permission in manifest if not added.
I had the same error while using Google Maps on my device. The problem was Google Map Service were not installed in my emulator.
Simply add google play services on your emulator. It will clear your problem.
Yes Its needed the real device you prefer real android device for check your build.you can use usb connect with android phone and debug mode you can also see error.
I want added Firebase into my application. I write below codes, but when running application I can't see TOKEN in log!
My dependencies :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Manifest :
<application>
...
<!--Firebase service-->
<service android:name=".CloudMSG.MyFirebaseInctanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
</application>
MyFirebaseInctanceIdService :
public class MyFirebaseInctanceIdService extends FirebaseInstanceIdService {
private static final String TAG = "MyFirebaseInctance";
#Override
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d("MyFirebaseInctance", "Refreshed token: " + refreshedToken);
// If you want to send messages to this application instance or
// manage this apps subscriptions on the server side, send the
// Instance ID token to your app server.
//sendRegistrationToServer(refreshedToken);
}
}
Logs:
03-30 13:36:42.943 9487-9487/? I/art: Late-enabling -Xcheck:jni
03-30 13:36:43.218 9487-9487/com.example.mohammad.a1_firebase D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
03-30 13:36:43.269 9487-9487/com.example.mohammad.a1_firebase W/InstanceID/Rpc: Found 10004
03-30 13:36:43.298 9487-9487/com.example.mohammad.a1_firebase D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
03-30 13:36:43.364 9487-9487/com.example.mohammad.a1_firebase I/FA: App measurement is starting up, version: 10084
03-30 13:36:43.364 9487-9487/com.example.mohammad.a1_firebase I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
03-30 13:36:43.364 9487-9487/com.example.mohammad.a1_firebase D/FA: Debug-level message logging enabled
03-30 13:36:43.364 9487-9487/com.example.mohammad.a1_firebase D/FA: AppMeasurement singleton hash: 720240273
03-30 13:36:43.404 9487-9487/com.example.mohammad.a1_firebase V/FA: Collection enabled
03-30 13:36:43.404 9487-9487/com.example.mohammad.a1_firebase V/FA: App package, google app id: com.example.mohammad.a1_firebase, 1:685652680518:android:0280a3bc1c6da8cb
03-30 13:36:43.405 9487-9487/com.example.mohammad.a1_firebase I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.mohammad.a1_firebase
03-30 13:36:43.463 9487-9487/com.example.mohammad.a1_firebase V/FA: Registered activity lifecycle callback
03-30 13:36:43.465 9487-9487/com.example.mohammad.a1_firebase I/FirebaseInitProvider: FirebaseApp initialization successful
03-30 13:36:43.467 9487-9487/com.example.mohammad.a1_firebase I/InstantRun: Starting Instant Run Server for com.example.mohammad.a1_firebase
03-30 13:36:43.471 9487-9587/com.example.mohammad.a1_firebase V/FA: Using measurement service
03-30 13:36:43.489 9487-9587/com.example.mohammad.a1_firebase V/FA: Connecting to remote service
03-30 13:36:43.528 9487-9587/com.example.mohammad.a1_firebase W/GooglePlayServicesUtil: Google Play services out of date. Requires 10084000 but found 6599430
03-30 13:36:43.612 9487-9487/com.example.mohammad.a1_firebase D/ContextHelper: convertTheme. context->name=com.example.mohammad.a1_firebase themeResourceId=2131230883
03-30 13:36:43.656 9487-9487/com.example.mohammad.a1_firebase 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-30 13:36:43.690 9487-9487/com.example.mohammad.a1_firebase V/FA: onActivityCreated
03-30 13:36:43.696 9487-9487/com.example.mohammad.a1_firebase I/PhoneWindow: [generateLayout] setColorNavigationBar => color=0x ff000001
03-30 13:36:43.718 9487-9487/com.example.mohammad.a1_firebase D/PhoneWindowEx: [PWEx][generateLayout] setNavigationBarColor2 : colors=0xfff5f5f5
03-30 13:36:43.718 9487-9487/com.example.mohammad.a1_firebase I/PhoneWindow: [setNavigationBarColor2] color=0x fff5f5f5
03-30 13:36:43.859 9487-9587/com.example.mohammad.a1_firebase V/FA: Using measurement service
03-30 13:36:43.859 9487-9587/com.example.mohammad.a1_firebase V/FA: Connection attempt already in progress
03-30 13:36:43.864 9487-9587/com.example.mohammad.a1_firebase V/FA: Activity resumed, time: 1436094125
03-30 13:36:43.879 9487-9612/com.example.mohammad.a1_firebase D/OpenGLRenderer: Render dirty regions requested: true
03-30 13:36:43.881 9487-9612/com.example.mohammad.a1_firebase I/Adreno-EGL: <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.00.02.042.013_msm8974_LA.BF.1.1.1_RB1__release_AU ()
OpenGL ES Shader Compiler Version: E031.25.03.00
Build Date: 01/21/15 Wed
Local Branch: mybranch7061829
Remote Branch: quic/LA.BF.1.1.1_rb1.7
Local Patches: NONE
Reconstruct Branch: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.00.02.042.013 + NOTHING
03-30 13:36:43.882 9487-9612/com.example.mohammad.a1_firebase I/OpenGLRenderer: Initialized EGL, version 1.4
03-30 13:36:43.910 9487-9612/com.example.mohammad.a1_firebase D/OpenGLRenderer: Enabling debug mode 0
03-30 13:36:43.916 9487-9487/com.example.mohammad.a1_firebase D/Atlas: Validating map...
03-30 13:36:43.927 9487-9487/com.example.mohammad.a1_firebase W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
03-30 13:36:43.936 9487-9592/com.example.mohammad.a1_firebase D/FirebaseInstanceId: background sync failed: SERVICE_NOT_AVAILABLE, retry in 30s
03-30 13:36:44.008 9487-9502/com.example.mohammad.a1_firebase W/art: Suspending all threads took: 5.068ms
03-30 13:36:44.047 9487-9487/com.example.mohammad.a1_firebase W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
03-30 13:36:44.183 9487-9487/com.example.mohammad.a1_firebase I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy#755dbad time:128236912
03-30 13:37:14.017 9487-10051/com.example.mohammad.a1_firebase D/FirebaseInstanceId: background sync failed: SERVICE_NOT_AVAILABLE, retry in 60s
How can I fix this issue and show Firebase token in logs?
Firebase onTokenRefresh() will only be called if your token changes. Before that you should invoke
FirebaseInstanceId.getInstance().getToken()
in your initial activity (like MainActivity) maybe.
why you not tried integrated android studio with firebase directly using Tools menu-->firebase
add this line Gradle :-Module(app)
compile 'com.google.firebase:firebase-crash:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
Try to uninstall the application and re-install , you will see the
Refreshed token in the logcat.
Also check in firebase console that Anonymous sign-in status is
Enabled or not in Authentication menu -> Sign in method
The app I am developing is linked to a project in Firebase Console. I have included 'google-services.json' under the 'app' folder too.
My Top Level build.gradle is:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
}
My App Level build.gradle is:
dependencies {
compile 'com.google.firebase:firebase-crash:9.8.0'
}
apply plugin: 'com.google.gms.google-services'
I know that latest 'firebase-crash' is 10.0.1 which requires an updated Google Repository and Google Play Services. However, I am able to use same firebase-crash on another app I am making. I am a little short on internet pack, i can't update yet.
I use following snippet in onCreate() of MainActivity to cause a test crash:
FirebaseCrash.log(TAG + ": Test Log"));
FirebaseCrash.report(new Exception("Test Exception"));
I checked 'google-services.json' too for correct mobile_sdk_id, it matches perfectly. My package name matches with firebase project too.
I don't do anything with Firebase Analytics.
Following is logcat output:
20:09:07.830 D/OpenGLRenderer: Enabling debug mode 0
20:09:07.915 D/FA: Connected to remote service
20:09:07.915 V/FA: Processing queued up service tasks: 3
20:09:10.340 D/dalvikvm: GC_CONCURRENT freed 301K, 12% free 11312K/12807K, paused 45ms+3ms, total 167ms
20:09:12.995 V/FA: Inactivity, disconnecting from the service
20:13:29.480 V/FA: Recording user engagement, ms: 261701
20:13:29.480 V/FA: Using measurement service
20:13:29.480 V/FA: Connecting to remote service
20:13:29.485 V/FA: Activity paused, time: 31073604
20:13:29.485 D/FA: Logging event (FE): _e, Bundle[{_o=auto, _si=-207754800234984953, _et=261701, _sc=MainActivity}]
20:13:29.675 D/dalvikvm: GC_CONCURRENT freed 612K, 14% free 11339K/13127K, paused 31ms+64ms, total 187ms
20:13:29.675 V/FA: Using measurement service
20:13:29.690 V/FA: Connection attempt already in progress
20:13:29.690 D/FA: Connected to remote service
20:13:29.695 V/FA: Processing queued up service tasks: 2
20:13:34.745 V/FA: Inactivity, disconnecting from the service
20:26:19.835 D/dalvikvm: GC_CONCURRENT freed 630K, 14% free 11302K/13127K, paused 19ms+2ms, total 135ms
Its been 5 hours since i am trying to see Errors on Firebase Console. I have tried opening and closing my app for more than 20 times.
How do i know FirebaseCrash has been enabled?
When will Errors show up in console?
Am i doing something wrong?
Edit:
There is no V/FirebaseCrash: message in logcat.
Following does not appear in logcat:
FirebaseCrash.logcat(0, TAG, "Test Logcat 0");
FirebaseCrash.logcat(1, TAG, "Test Logcat 1");
There are some lines printed by FirebaseCrash before debugger has attached:
12-11 22:27:09.950 I/FirebaseCrash: FirebaseCrash reporting initialized com.google.android.gms.internal.zzbks#424d3e68
12-11 22:27:09.950 I/FirebaseInitProvider: FirebaseApp initialization successful
Updated Firebase-Crash to 10.0.1 and other SDK tools. No change.
I am so ashamed to know that my laptop's date was one day late. As soon as i corrected the date, results started to show in console. My problem is solved now.