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
...
}
...
}
Related
I am trying to call asp.net web api from Android Client using Volley library. The .net API is working fine and listening ports are:
http://localhost:5000 and https://localhost:5001 in my local machine.
But,When, I try to run android client keeping the base url as http://10.0.2.2:5000/api/login
I found below error in console->
04/23 23:13:41: Launching 'app' on Nexus 6 API 24.
Install successfully finished in 9 s 435 ms.
$ adb shell am start -n "com.example.tourexpwip/com.example.tourexpwip.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 3662 on device 'Nexus_6_API_24 [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/art: Late-enabling -Xcheck:jni
W/art: Unexpected CPU variant for X86 using defaults: x86
W/System: ClassLoader referenced unknown path: /data/app/com.example.tourexpwip-1/lib/x86
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.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
I/System.out: URL: http://10.0.2.2:5000/api/login/
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/: HostConnection::get() New Host Connection established 0xa67ec7c0, tid 3662
E/Volley: [210] NetworkUtility.shouldRetryException: Unexpected response code 307 for http://10.0.2.2:5000/api/login/
D/: HostConnection::get() New Host Connection established 0xa67ecac0, tid 3683
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer: Swap behavior 0
D/EGL_emulation: eglCreateContext: 0xb5c05660: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xb5c05660: ver 2 0 (tinfo 0xb5c032b0)
W/System.err: com.android.volley.ServerError
at com.android.volley.toolbox.NetworkUtility.shouldRetryException(NetworkUtility.java:201)
W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:145)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:132)
W/System.err: at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
I/Choreographer: Skipped 68 frames! The application may be doing too much work on its main thread.
D/EGL_emulation: eglMakeCurrent: 0xb5c05660: ver 2 0 (tinfo 0xb5c032b0)
I/Choreographer: Skipped 35 frames! The application may be doing too much work on its main thread.
The controller class for login in ASP.NET web api->
namespace TourExpWIP1.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class LoginController : ControllerBase
{
NetCoreAuthenticationContext dbContext = new NetCoreAuthenticationContext();
public string Post([FromBody] TblUser value)
{
if (dbContext.TblUser.Any(user => user.UserName.Equals(value.UserName)))
{
TblUser user = dbContext.TblUser.Where(u => u.UserName.Equals(value.UserName)).First();
var client_post_hash_password = Convert.ToBase64String(
Common.SaltHashPassword(
Encoding.ASCII.GetBytes(value.Password),
Convert.FromBase64String(user.Salt)));
if (client_post_hash_password.Equals(user.Password))
return JsonConvert.SerializeObject(user);
else return JsonConvert.SerializeObject("Wrong Password");
}
else
{
return JsonConvert.SerializeObject("user does not exists in db");
}
}
}
}
Try this
1.In Android Manifiest, in tag application add:
inside tag application add this tag:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
<application
android:usesCleartextTraffic="true"
android:networkSecurityConfig="#xml/network_security_config"
...
/>
2.With a corresponding network_security_config.xml in app/src/main/res/xml/:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
More details please find from here- Link
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
}
}
I go to build > clean project, then build > build project, "react-native run-android" from root of react native project, metro terminal spins up, I click the green arrow 'run app' button on android studio, the app pops up loading on the emulator, then exits to emulator home screen, and this error is in the run tab log. Relatively new to react native, can't find anything that gives me a solution. Not sure what's happening or where to go from here. Any help is much appreciated
01/21 20:30:53: Launching 'app' on Nexus 5X API 29 x86.
$ adb shell am start -n "com.mysampleapp/com.mysampleapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Waiting for process to come online...
Connected to process 15533 on device 'emulator-5554'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/SoLoader: init start
adding system library source: /vendor/lib
D/SoLoader: adding system library source: /system/lib
D/SoLoader: adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.mysampleapp-91pUgz3FulEOy0UDuAiTAw==/lib/x86 flags = 0]
D/SoLoader: adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/data/com.mysampleapp/lib-main flags = 1]
Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
D/SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /vendor/lib flags = 2]
Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.mysampleapp-91pUgz3FulEOy0UDuAiTAw==/lib/x86 flags = 0]
Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/data/com.mysampleapp/lib-main flags = 1]
V/fb-UnpackingSoSource: locked dso store /data/user/0/com.mysampleapp/lib-main
V/fb-UnpackingSoSource: deps mismatch on deps store: regenerating
so store dirty: regenerating
D/ApkSoSource: not allowing consideration of lib/x86/libc++_shared.so: deferring to libdir
D/ApkSoSource: not allowing consideration of lib/x86/libfb.so: deferring to libdir
not allowing consideration of lib/x86/libfolly_futures.so: deferring to libdir
not allowing consideration of lib/x86/libfolly_json.so: deferring to libdir
not allowing consideration of lib/x86/libglog.so: deferring to libdir
not allowing consideration of lib/x86/libglog_init.so: deferring to libdir
not allowing consideration of lib/x86/libhermes-executor-debug.so: deferring to libdir
not allowing consideration of lib/x86/libhermes-executor-release.so: deferring to libdir
not allowing consideration of lib/x86/libhermes-inspector.so: deferring to libdir
not allowing consideration of lib/x86/libimagepipeline.so: deferring to libdir
D/ApkSoSource: not allowing consideration of lib/x86/libjscexecutor.so: deferring to libdir
not allowing consideration of lib/x86/libjsijniprofiler.so: deferring to libdir
not allowing consideration of lib/x86/libjsinspector.so: deferring to libdir
not allowing consideration of lib/x86/libnative-filters.so: deferring to libdir
not allowing consideration of lib/x86/libnative-imagetranscoder.so: deferring to libdir
not allowing consideration of lib/x86/libreactnativeblob.so: deferring to libdir
not allowing consideration of lib/x86/libreactnativejni.so: deferring to libdir
not allowing consideration of lib/x86/libyoga.so: deferring to libdir
V/fb-UnpackingSoSource: regenerating DSO store com.facebook.soloader.ApkSoSource
Finished regenerating DSO store com.facebook.soloader.ApkSoSource
V/fb-UnpackingSoSource: starting syncer worker
V/fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.mysampleapp/lib-main (from syncer thread)
not releasing dso store lock for /data/user/0/com.mysampleapp/lib-main (syncer thread started)
D/SoLoader: init finish: 4 SO sources prepared
init exiting
W/RenderThread: type=1400 audit(0.0:62): avc: denied { write } for name="property_service" dev="tmpfs" ino=36 scontext=u:r:untrusted_app_27:s0:c133,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.mysampleapp
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)
D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
D/SoLoader: About to load: libjscexecutor.so
D/SoLoader: libjscexecutor.so not found on /data/data/com.mysampleapp/lib-main
libjscexecutor.so found on /data/app/com.mysampleapp-91pUgz3FulEOy0UDuAiTAw==/lib/x86
Not resolving dependencies for libjscexecutor.so
E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
D/ReactNative: ReactInstanceManager.ctor()
D/SoLoader: init exiting
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/com.mysampleap: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (greylist,core-platform-api, reflection, allowed)
Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (greylist,core-platform-api, reflection, allowed)
Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (greylist,core-platform-api, reflection, allowed)
D/ReactNative: ReactInstanceManager.createReactContextInBackground()
ReactInstanceManager.recreateReactContextInBackgroundInner()
W/com.mysampleap: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
W/com.mysampleap: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
W/unknown:ReactNative: Packager connection already open, nooping.
D/HostConnection: HostConnection::get() New Host Connection established 0xd1f22080, tid 15586
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/EGL_emulation: eglCreateContext: 0xdd4e35c0: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0xdd4e35c0: ver 3 0 (tinfo 0xd1f68300)
W/Gralloc3: mapper 3.x is not supported
D/HostConnection: createUnique: call
HostConnection::get() New Host Connection established 0xd1f23660, tid 15586
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache 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/eglCodecCommon: allocate: Ask for block of size 0x1000
D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3ffff4000 size 0x2000
D/EGL_emulation: eglMakeCurrent: 0xdd4e35c0: ver 3 0 (tinfo 0xd1f68300)
D/EGL_emulation: eglMakeCurrent: 0xdd4e35c0: ver 3 0 (tinfo 0xd1f68300)
D/EGL_emulation: eglMakeCurrent: 0xdd4e35c0: ver 3 0 (tinfo 0xd1f68300)
D/ReactNative: ReactInstanceManager.onJSBundleLoadedFromServer()
D/ReactNative: ReactInstanceManager.recreateReactContextInBackground()
ReactInstanceManager.runCreateReactContextOnNewThread()
D/SoLoader: About to load: libhermes.so
D/SoLoader: libhermes.so not found on /data/data/com.mysampleapp/lib-main
libhermes.so not found on /data/app/com.mysampleapp-91pUgz3FulEOy0UDuAiTAw==/lib/x86
libhermes.so not found on /vendor/lib
libhermes.so not found on /system/lib
E/SoLoader: couldn't find DSO to load: libhermes.so
E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.mysampleapp, PID: 15533
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:952)
at java.lang.Thread.run(Thread.java:919)
I/Process: Sending signal. PID: 15533 SIG: 9
Process 15533 terminated.
And here is my build.gradle:
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js",
enableHermes: false
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.mysampleapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-gesture-handler')
implementation project(':react-native-vector-icons')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'androidx.annotation:annotation:1.1.0'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
I have created a google map activity in android studio. I have also generated an api key from the link given and placed it in the appropriate place. But when I run the app it crashes without displaying anything. Here is the logcat
2018-12-19 16:13:00.080 17295-17295/? I/ik7.locationap: Not late-enabling -Xcheck:jni (already on)
2018-12-19 16:13:00.312 17295-17295/? W/ik7.locationap: Unexpected CPU variant for X86 using defaults: x86
2018-12-19 16:13:00.667 17295-17295/com.example.nik7.locationapp W/ik7.locationap: JIT profile information will not be recorded: profile file does not exits.
2018-12-19 16:13:00.669 17295-17295/com.example.nik7.locationapp I/chatty: uid=10087(com.example.nik7.locationapp) identical 10 lines
2018-12-19 16:13:00.670 17295-17295/com.example.nik7.locationapp W/ik7.locationap: JIT profile information will not be recorded: profile file does not exits.
2018-12-19 16:13:00.733 17295-17295/com.example.nik7.locationapp I/InstantRun: starting instant run server: is main process
2018-12-19 16:13:01.001 17295-17295/com.example.nik7.locationapp I/zzbz: Making Creator dynamically
2018-12-19 16:13:01.022 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Unsupported class loader
2018-12-19 16:13:01.023 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Skipping duplicate class check due to unsupported classloader
2018-12-19 16:13:01.033 17295-17295/com.example.nik7.locationapp I/DynamiteModule: Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:221
2018-12-19 16:13:01.033 17295-17295/com.example.nik7.locationapp I/DynamiteModule: Selected remote version of com.google.android.gms.maps_dynamite, version >= 221
2018-12-19 16:13:01.033 17295-17295/com.example.nik7.locationapp V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
2018-12-19 16:13:01.113 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Unsupported class loader
2018-12-19 16:13:01.131 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Skipping duplicate class check due to unsupported classloader
2018-12-19 16:13:01.180 17295-17295/com.example.nik7.locationapp I/Google Maps Android API: Google Play services client version: 12451000
2018-12-19 16:13:01.192 17295-17295/com.example.nik7.locationapp I/Google Maps Android API: Google Play services package version: 14799040
2018-12-19 16:13:01.319 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
2018-12-19 16:13:01.712 17295-17295/com.example.nik7.locationapp D/OpenGLRenderer: HWUI GL Pipeline
2018-12-19 16:13:01.877 17295-17341/com.example.nik7.locationapp I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2018-12-19 16:13:01.878 17295-17341/com.example.nik7.locationapp I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2018-12-19 16:13:01.878 17295-17341/com.example.nik7.locationapp I/OpenGLRenderer: Initialized EGL, version 1.4
2018-12-19 16:13:01.878 17295-17341/com.example.nik7.locationapp D/OpenGLRenderer: Swap behavior 1
2018-12-19 16:13:01.883 17295-17341/com.example.nik7.locationapp W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2018-12-19 16:13:01.883 17295-17341/com.example.nik7.locationapp D/OpenGLRenderer: Swap behavior 0
2018-12-19 16:13:01.907 17295-17341/com.example.nik7.locationapp D/EGL_emulation: eglCreateContext: 0xe8310280: maj 2 min 0 rcv 2
2018-12-19 16:13:01.913 17295-17341/com.example.nik7.locationapp D/EGL_emulation: eglMakeCurrent: 0xe8310280: ver 2 0 (tinfo 0xe7093fa0)
2018-12-19 16:13:02.025 17295-17341/com.example.nik7.locationapp D/EGL_emulation: eglMakeCurrent: 0xe8310280: ver 2 0 (tinfo 0xe7093fa0)
2018-12-19 16:13:02.034 17295-17338/com.example.nik7.locationapp D/EGL_emulation: eglCreateContext: 0xe9d05f00: maj 1 min 0 rcv 1
2018-12-19 16:13:02.229 17295-17338/com.example.nik7.locationapp D/EGL_emulation: eglMakeCurrent: 0xe9d05f00: ver 1 0 (tinfo 0xe9d03470)
2018-12-19 16:13:02.564 17295-17319/com.example.nik7.locationapp D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2018-12-19 16:13:03.305 17295-17319/com.example.nik7.locationapp E/AndroidRuntime: FATAL EXCEPTION: Thread-6
Process: com.example.nik7.locationapp, PID: 17295
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at ez.b(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):3)
at ey.a(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):3)
at fa.a(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):15)
at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):6)
at ed.a(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):21)
at ed.run(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):8)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/00000015/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000015/MapsDynamite.apk!/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at ad.loadClass(:com.google.android.gms.dynamite_dynamiteloader#14799084#14.7.99 (100700-223214910):4)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at ez.b(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):3)
at ey.a(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):3)
at fa.a(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):15)
at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):6)
at ed.a(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):21)
at ed.run(:com.google.android.gms.dynamite_mapsdynamite#14799084#14.7.99 (100700-223214910):8)
2018-12-19 16:13:03.338 17295-17295/com.example.nik7.locationapp E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
2018-12-19 16:13:03.379 17295-17319/com.example.nik7.locationapp I/Process: Sending signal. PID: 17295 SIG: 9
This is the compelte log.I have even tried by removing the restrictions but that didn't work. Whats the issue here. I have also seledted api 23 marshmallow. I have done nothing except entering the api key in its place
EDIT: I also included the key in the manifest but still the app is crashing
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY"/>
EDIT:
Seems to be an issue in API 28
To fix it add this code under application in your manifest file:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Its probably because you dont have google play services installed. If you ran the app on your actual phone it would work just fine.
To fix it, you either add this line of code inside the in the manifest
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Or
to upgrade your play-services-maps in build.gradle to
implementation 'com.google.android.gms:play-services-maps:16.1.0'
That worked for me
I created a new sample project for displaying the Facebook audience network Banner ad at bottom of my activity.
My app is running in device but not displaying anything at bottom. I already added the hash for test device.
MainActivity.java
package liveradio.radioz.com.facebookads;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.facebook.ads.*;
import android.widget.LinearLayout;
public class MainActivity extends AppCompatActivity {
private AdView adView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
adView = new AdView(this, "PLACEMENT-ID", AdSize.BANNER_HEIGHT_50);
// Find the Ad Container
LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container);
// Add the ad view to your activity layout
adContainer.addView(adView);
AdSettings.addTestDevice("DEVICE-ID");
// Request an ad
adView.loadAd();
}
#Override
protected void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="liveradio.radioz.com.facebookads.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="#+id/banner_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
/>
</android.support.constraint.ConstraintLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="liveradio.radioz.com.facebookads">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
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">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Log :
01/12 12:13:01: Launching app
$ adb shell am start -n "liveradio.radioz.com.facebookads/liveradio.radioz.com.facebookads.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: liveradio.radioz.com.facebookads.test | liveradio.radioz.com.facebookads
Waiting for application to come online: liveradio.radioz.com.facebookads.test | liveradio.radioz.com.facebookads
Waiting for application to come online: liveradio.radioz.com.facebookads.test | liveradio.radioz.com.facebookads
Connecting to liveradio.radioz.com.facebookads
Waiting for application to start debug server
Waiting for application to come online: liveradio.radioz.com.facebookads.test | liveradio.radioz.com.facebookads
Connecting to liveradio.radioz.com.facebookads
Connected to the target VM, address: 'localhost:8645', transport: 'socket'
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/zygote: Not late-enabling -Xcheck:jni (already on)
W/zygote: Suspending all threads took: 83.944ms
W/zygote: Unexpected CPU variant for X86 using defaults: x86
I/zygote: Background concurrent copying GC freed 9752(4MB) AllocSpace objects, 0(0B) LOS objects, 61% free, 973KB/2MB, paused 48.188ms total 236.235ms
W/ActivityThread: Application liveradio.radioz.com.facebookads is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/zygote: Debugger is active
I/System.out: Debugger has connected
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: waiting for debugger to settle...
I/System.out: debugger has settled (1486)
I/InstantRun: starting instant run server: is main process
I/WebViewFactory: Loading com.android.chrome version 61.0.3163.98 (code 316409812)
I/zygote: The ClassLoaderContext is a special shared library.
I/cr_LibraryLoader: Time to load native libraries: 3 ms (timestamps 6510-6513)
I/chromium: [INFO:library_loader_hooks.cc(136)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader: Expected native library version number "61.0.3163.98", actual native library version number "61.0.3163.98"
E/FBAudienceNetwork: You don't call AudienceNetworkAds.initialize(). Some functionality may not work properly.
D/IS_UNITY: false
D/AdInternalSettings: Test mode device hash: 877dd37b-fff7-4fa1-b83d-776592220359
D/AdInternalSettings: When testing your app with Facebook's ad units you must specify the device hashed ID to ensure the delivery of test ads, add the following code before loading an ad: AdSettings.addTestDevice("877dd37b-fff7-4fa1-b83d-776592220359");
D/IS_UNITY: false
E/ActivityThread: Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
D/OpenGLRenderer: HWUI GL Pipeline
V/StudioProfiler: StudioProfilers agent attached.
V/StudioProfiler: Acquiring Application for Events
V/StudioProfiler: Transformed class: java/net/URL
W/zygote: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
V/StudioProfiler: Memory control stream started.
[ 01-12 12:13:06.606 20774:20877 D/ ]
HostConnection::get() New Host Connection established 0xd1835a80, tid 20877
I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer: Swap behavior 0
D/EGL_emulation: eglCreateContext: 0xe4b85540: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0xe4b85540: ver 3 0 (tinfo 0xe4b83360)
D/EGL_emulation: eglMakeCurrent: 0xe4b85540: ver 3 0 (tinfo 0xe4b83360)
W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
I/cr_BrowserStartup: Initializing chromium process, singleProcess=false
[ 01-12 12:13:07.026 20774:20774 D/ ]
HostConnection::get() New Host Connection established 0xd1583c00, tid 20774
D/EGL_emulation: eglCreateContext: 0xcecec360: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0xcecec360: ver 3 0 (tinfo 0xe21fff60)
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/cr_CrashFileManager: /data/user/0/liveradio.radioz.com.facebookads/cache/WebView/Crash Reports does not exist or is not a directory
W/com.facebookads: type=1400 audit(0.0:22): avc: denied { read } for name="vmstat" dev="proc" ino=4026532039 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
D/IS_UNITY: false
I/zygote: Background concurrent copying GC freed 7886(1025KB) AllocSpace objects, 5(100KB) LOS objects, 50% free, 1746KB/3MB, paused 680us total 122.639ms
I/zygote: Do partial code cache collection, code=30KB, data=25KB
I/zygote: After code cache collection, code=30KB, data=25KB
I/zygote: Increasing code cache capacity to 128KB
V/StudioProfiler: Live memory tracking disabled.
V/StudioProfiler: Live memory tracking enabled.
V/StudioProfiler: JNIEnv not attached
V/StudioProfiler: Loaded classes: 6311
V/StudioProfiler: Tracking initialization took: 648527000ns
I/zygote: Do partial code cache collection, code=60KB, data=44KB
I/zygote: After code cache collection, code=56KB, data=43KB
I/zygote: Increasing code cache capacity to 256KB
Disconnected from the target VM, address: 'localhost:8645', transport: 'socket'
I'm getting the build successful and installed in my device. When I open the app I can't see any ads or test ads at bottom of my main activity.
If you've added Audience network libraries, you can add the code below to show test ads without worrying about adding a test device.
if (BuildConfig.DEBUG) {
AdSettings.setTestMode(true);
}
Add this code, preferably in your Application class.
First Implement this library:
implementation 'com.facebook.android:audience-network-sdk:4.99.1'
than use below code:
com.facebook.ads.AdView adView;
adView = new com.facebook.ads.AdView(this, "PLACEMENT-ID",
com.facebook.ads.AdSize.BANNER_HEIGHT_50);
((LinearLayout) adContainer).addView(adView);
adView.loadAd();
first, add this library to your grade file
implementation 'com.facebook.android:audience-network-sdk:6.12.0'
then paste this code in your xml file
<LinearLayout
android:id="#+id/banner_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
/>
In your Java code paste this code and also replace IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID with your banner ad ID
adView = new AdView(this, "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID", AdSize.BANNER_HEIGHT_50);
LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container);
adContainer.addView(adView);
adView.loadAd();
for more information you can follow official link of meta
https://developers.facebook.com/docs/audience-network/setting-up/ad-setup/android/banner