Skip to content

Instantly share code, notes, and snippets.

View romtsn's full-sized avatar

Roman Zavarnitsyn romtsn

View GitHub Profile
{"event_id":"7fc747960bac4a2d9c8b16375244cae8","sdk":{"name":"sentry.java.android","version":"6.16.0","packages":[{"name":"maven:io.sentry:sentry","version":"6.16.0"},{"name":"maven:io.sentry:sentry-android-core","version":"6.16.0"},{"name":"maven:io.sentry:sentry-compose","version":"6.16.0"},{"name":"maven:io.sentry:sentry-android-ndk","version":"6.16.0"},{"name":"maven:io.sentry:sentry-android-fragment","version":"6.16.0"},{"name":"maven:io.sentry:sentry-android-timber","version":"6.16.0"}],"integrations":["ComposeUserInteraction","UncaughtExceptionHandler","ShutdownHook","Ndk","AppLifecycle","AnrV2","ActivityLifecycle","UserInteraction","FragmentLifecycle","Timber","AppComponentsBreadcrumbs","SystemEventsBreadcrumbs","TempSensorBreadcrumbs"]}}
{"content_type":"application/json","type":"event","length":4737}
{"timestamp":"2023-03-31T07:34:37.275Z","exception":{"values":[{"type":"ApplicationNotResponding","value":"ANR","module":"io.sentry.android.core","thread_id":2,"stacktrace":{"frames":[{"filename":"Zygot
@romtsn
romtsn / ClassData.kt
Created December 6, 2021 07:57
Bytecode Transformations: ClassData
interface ClassData {
/**
* Fully qualified name of the class.
*/
val className: String
/**
* List of the annotations the class has.
*/
val classAnnotations: List<String>
@romtsn
romtsn / SpanAddingClassVisitorFactory.kt
Created December 6, 2021 07:49
Bytecode Transformations: ClassVisitorFactory
abstract class SpanAddingClassVisitorFactory :
AsmClassVisitorFactory<SpanAddingClassVisitorFactory.SpanAddingParameters> {
interface SpanAddingParameters : InstrumentationParameters {
@get:Input
@get:Optional
val invalidate: Property<Long>
@get:Input
@romtsn
romtsn / transformClassesWith.kt
Created December 6, 2021 07:35
Bytecode Transformations: transformClassesWith
variant.transformClassesWith(
SpanAddingClassVisitorFactory::class.java,
InstrumentationScope.ALL
) { params ->
if (extension.tracingInstrumentation.forceInstrumentDependencies.get()) {
params.invalidate.setDisallowChanges(System.currentTimeMillis())
}
params.debug.setDisallowChanges(
extension.tracingInstrumentation.debug.get()
)
@romtsn
romtsn / onVariants.kt
Created December 6, 2021 07:32
Bytecode Transformations: onVariants
androidComponentsExtension.onVariants { variant ->
...
}
@romtsn
romtsn / AGPApplied.kt
Last active December 6, 2021 07:30
Bytecode Transformations: AGP applied
project.pluginManager.withPlugin("com.android.application") {
val androidComponentsExtension =
project.extensions.getByType(AndroidComponentsExtension::class.java)
...
}
@romtsn
romtsn / SentryPlugin.kt
Created December 6, 2021 07:26
Bytecode Transformations: Plugin
class SentryPlugin : Plugin<Project> {
override fun apply(project: Project) {
...
}
}

First off, sorry if something is heavily contradicting what you've done already, but I still wanna leave my 2 cents here, if you find time for that in the future to address that. If not, then this will be a todo list for my future self :) Regardless, everything here is purely subjective and discussable, as always.

A follow-up from our e-mail discussion:

  1. Flows instead of LiveData: you could take a look at this article as an example of how to use StateFlow with ViewModels. And here's an example on how to bring Flow to native. Not a must of course, just if you find time.

  2. About interactors: I'm not sure what did you mean by "sources are uncontrollable black boxes", when you are actually the one who's defining and implementing them :) IMHO it's just a yet another unnecessary layer (because essentially interact

09-12 09:34:23.899 5154-5154/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.runtastic.android.balance.lite, PID: 5154
java.lang.NullPointerException: Attempt to write to field 'java.lang.ref.WeakReference o.ト.ˊ' on a null object reference
at o.טּ.ˎ(:57041)
at o.טּ.ˋ(:64)
at o.nx$1.run(:90)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
@romtsn
romtsn / build.gradle
Created July 25, 2017 11:33
Stream + Retrolambda sample
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "rom4ek.com.sparktestapp"
minSdkVersion 14