mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added Crashlytics to debug build
This commit is contained in:
parent
d52c12606f
commit
de2f247c5f
3 changed files with 46 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ plugins {
|
|||
id 'org.jetbrains.kotlin.android'
|
||||
id 'com.google.gms.google-services'
|
||||
id 'androidx.navigation.safeargs.kotlin'
|
||||
id 'com.google.firebase.crashlytics'
|
||||
}
|
||||
|
||||
def packageName = "org.linphone"
|
||||
|
|
@ -91,6 +92,11 @@ android {
|
|||
resValue "string", "file_provider", packageName + ".fileprovider"
|
||||
resValue "string", "linphone_app_version", gitVersion.toString().trim()
|
||||
resValue "string", "linphone_app_branch", gitBranch.toString().trim()
|
||||
|
||||
firebaseCrashlytics {
|
||||
nativeSymbolUploadEnabled true
|
||||
unstrippedNativeLibsDir file(LinphoneSdkBuildDir + '/libs-debug/').toString()
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
|
|
@ -160,6 +166,7 @@ dependencies {
|
|||
|
||||
implementation platform('com.google.firebase:firebase-bom:32.5.0')
|
||||
implementation 'com.google.firebase:firebase-messaging'
|
||||
implementation 'com.google.firebase:firebase-crashlytics-ndk'
|
||||
|
||||
implementation 'net.openid:appauth:0.11.1'
|
||||
android.defaultConfig.manifestPlaceholders = [appAuthRedirectScheme: 'org.linphone.sso']
|
||||
|
|
@ -173,4 +180,9 @@ ktlint {
|
|||
ignoreFailures = true
|
||||
}
|
||||
|
||||
project.tasks['preBuild'].dependsOn 'ktlintFormat'
|
||||
project.tasks['preBuild'].dependsOn 'ktlintFormat'
|
||||
|
||||
afterEvaluate {
|
||||
assembleDebug.finalizedBy(uploadCrashlyticsSymbolFileDebug)
|
||||
packageDebug.finalizedBy(uploadCrashlyticsSymbolFileDebug)
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ import androidx.annotation.UiThread
|
|||
import androidx.annotation.WorkerThread
|
||||
import androidx.emoji2.text.EmojiCompat
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import java.util.*
|
||||
import org.linphone.BuildConfig
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
|
|
@ -191,6 +192,25 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
}
|
||||
}
|
||||
|
||||
private val loggingServiceListener = object : LoggingServiceListenerStub() {
|
||||
@WorkerThread
|
||||
override fun onLogMessageWritten(
|
||||
logService: LoggingService,
|
||||
domain: String,
|
||||
level: LogLevel,
|
||||
message: String
|
||||
) {
|
||||
when (level) {
|
||||
LogLevel.Error -> android.util.Log.e(domain, message)
|
||||
LogLevel.Warning -> android.util.Log.w(domain, message)
|
||||
LogLevel.Message -> android.util.Log.i(domain, message)
|
||||
LogLevel.Fatal -> android.util.Log.wtf(domain, message)
|
||||
else -> android.util.Log.d(domain, message)
|
||||
}
|
||||
FirebaseCrashlytics.getInstance().log("[$domain] [${level.name}] $message")
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
EmojiCompat.init(context)
|
||||
emojiCompat = EmojiCompat.get()
|
||||
|
|
@ -203,6 +223,16 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
Log.i("$TAG Creating Core")
|
||||
Looper.prepare()
|
||||
|
||||
Factory.instance().loggingService.addListener(loggingServiceListener)
|
||||
Log.i("$TAG Crashlytics enabled, register logging service listener")
|
||||
|
||||
Log.i("=========================================")
|
||||
Log.i("==== Linphone-android information dump ====")
|
||||
Log.i("VERSION=${BuildConfig.VERSION_NAME} / ${BuildConfig.VERSION_CODE}")
|
||||
Log.i("PACKAGE=${BuildConfig.APPLICATION_ID}")
|
||||
Log.i("BUILD TYPE=${BuildConfig.BUILD_TYPE}")
|
||||
Log.i("=========================================")
|
||||
|
||||
val looper = Looper.myLooper() ?: return
|
||||
coreThread = Handler(looper)
|
||||
|
||||
|
|
@ -244,6 +274,7 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
}
|
||||
|
||||
Log.i("$TAG Core has been stopped, app can gracefully quit")
|
||||
Factory.instance().loggingService.removeListener(loggingServiceListener)
|
||||
quitSafely()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ buildscript {
|
|||
dependencies {
|
||||
def nav_version = "2.6.0"
|
||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
|
||||
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
|
||||
}
|
||||
}
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue