• Stars
    star
    469
  • Rank 90,190 (Top 2 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created about 1 year ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple Compose library to print the reason for recomposition in your `Logcat` window.

๐Ÿž Rebugger

Rebugger : A recomposition debugger

Being a โ€œcompose devโ€ our enemy number one is unnecessary recompositions ๐Ÿค•. Often times we use tools like recompositionHighligher, LogComposition, and layout inspector to count the recomposition, but thereโ€™s no direct way to understand โ€œwhyโ€ the recomposition has happened.

Rebugger is a simple compose utility function that can track the change in the given arguments. Itโ€™ll print the reason for recomposition in your Logcat window.

โŒจ๏ธ Demo

Usage

1. Add dependencies

latestVersion

Kotlin Script

repositories {
    ...
    maven { url = uri("https://jitpack.io") } // Add jitpack
}

dependencies {
    implementation("com.github.theapache64:rebugger:<latest.version>")
}

Groovy

repositories {
    ...
    maven { url 'https://jitpack.io' } // Add jitpack
}

dependencies {
    implementation 'com.github.theapache64:rebugger:<latest.version>'
}

2. Add Rebugger call

Call Rebugger with the states or args you want to track

@Composable
fun VehicleUi(
    car: Car,
    bike: Bike,
) {
    var human by remember { mutableStateOf(Human("John")) }

    // Call Rebugger and pass the states you want to track. 
    // It could be a function arg or a state
    Rebugger(
        trackMap = mapOf(
            "car" to car,
            "bike" to bike,
            "human" to human
        ),
    )
    
    //...

3. See LogCat

Search for Rebugger

๐Ÿ–ฅ Sample Outputs

  • When Rebugger hooked into your composable, itโ€™ll print something like this

image

  • When VehicleUi recomposes due to car instance change

image

  • When VehicleUi recomposes due to both car and bike instance change

image

  • When VehicleUi recomposes due to human instance change (State within the composable)

image

๐ŸŽจ Customization

You can use the RebuggerConfig.init function to override default properties of Rebugger.

class App : Application() {
    // ...
    
    override fun onCreate() {
        super.onCreate()
        
        // ...
        
        RebuggerConfig.init(
            tag = "MyAppRebugger", // changing default tag
            logger = { tag, message -> Timber.i(tag, message) } // use Timber for logging
        )
    }
}

๐Ÿ”Œ Plugin

You can use the Rebugger IntelliJ plugin to generate the Rebugger function call.

Screen.Recording.2023-05-01.at.10.42.57.PM.mov

๐ŸŸ  Limitation

Auto Name Picking

When Rebugger is placed deep inside the composable, it may not be able to pick the correct composable name. For example, if I place the Rebugger somewhere inside the Button lambda like this

@Composable
fun VehicleUi(
  car: Car,
  bike: Bike,
) {
// ...

    Column {
        // ...

        Button(
            onClick = {
                //...
            }
        ) {

            // ๐ŸŸ  Inside Button's content lambda
            Rebugger(
                trackMap = mapOf(
                    "car" to car,
                    "bike" to bike,
                    "human" to human
                ),
            )
            
            // ...
        }
    }
}

Itโ€™ll print something like this

image

The Fix

To fix this, you can pass composableName argument to override the automatic name picking behaviour

Rebugger(
    composableName = "Button's body",
    trackMap = mapOf(
        "car" to car,
        "bike" to bike,
        "human" to human
    ),
)

๐ŸŒ‡ TODO

  • โœ… IDE plugin : To generate Rebugger call (vote here)

More Repositories

1

stackzy

๐Ÿ’ป A cross-platform desktop application to identify libraries used inside an android application. Made possible by Compose Desktop โšก
Kotlin
999
star
2

retrosheet

๐Ÿ“ƒ Turn Google Spreadsheet to JSON endpoint (for Android and JVM) for FREE (100%)
Kotlin
767
star
3

create-compose-app

โŒจ๏ธ A tool that gives you a massive head start when building Compose based apps. It saves you from time-consuming setup and configuration
Kotlin
495
star
4

klokk

๐Ÿ•’ A kinetic wall clock, built using Compose Desktop
Kotlin
322
star
5

faded

โœจ Client did not pay? Add opacity to UI components and decrease it every day until their app completely fades away.
Kotlin
294
star
6

topcorn

A minimalistic movie listing app to browse IMDB's top 250 movies, built to demonstrate MVVM with latest hot-trending Android development tools.
Kotlin
213
star
7

remove-bg

๐Ÿ–ผ๏ธ Remove photo background with just a tap
Kotlin
208
star
8

compose-animation-playground

A playground for Compose Animations
Kotlin
129
star
9

switch-snake

๐Ÿ Switch Snake implemented using Compose Desktop
Kotlin
127
star
10

source-pilot

๐Ÿง‘โ€โœˆ๏ธ A chrome extension to enable IDE like file navigation in GitHub
Kotlin
127
star
11

sim-jacker

Source code for the new SIM card flaw which lets hijack any phone just by sending SMS - Source Code + Demo Video
103
star
12

name-that-color-desktop

Save your brain from the color naming headache
Kotlin
98
star
13

twyper

๐Ÿ”ฅ Yet another Tinder like swipeable cards, built for Jetpack Compose
Kotlin
95
star
14

compose-chrome-extension-template

๐Ÿงฉ A basic compose chrome extension template
Kotlin
90
star
15

benchart

๐Ÿ“Š A web tool to visualise and compare your android benchmark results
Kotlin
86
star
16

compose-desktop-template

๐Ÿ’ป A Compose Desktop project template with MVVM, Dagger, Decompose, tests, and more...
Kotlin
79
star
17

gpm

๐Ÿ“ฆ NPM clone for gradle projects
Kotlin
74
star
18

readgen

A simple tool to generate README
Kotlin
66
star
19

tracktor

A GitHub user tracking app, inspired from a GIF. ๐Ÿ•ต๏ธ Can be considered as a demo project to showcase MVVM with latest android development tools
Kotlin
60
star
20

compose-android-template

๐Ÿš€ Android project template with Compose, MVVM, Hilt and Navigation
Kotlin
58
star
21

coin_hive_android_sdk

An android SDK for coinhive.com
Java
58
star
22

gh-meme-maker

Generate memes using GitHub issues
Kotlin
51
star
23

glo

A tool to amplify your movie watching experience ๐ŸŒŸ
51
star
24

pencil-ui

WIP : A Multiplatform Compose Theme for your Compose app
Kotlin
46
star
25

leancorn

A simple movie app, built using leanback.
Kotlin
41
star
26

boil

Boil is a CLI partner for adding boiler plate codes to Gradle based projects.
Kotlin
39
star
27

decompose-desktop-example

A simple example of how to use Decomposer for navigation and state keeping in Compose desktop
Kotlin
38
star
28

google-play-api

๐Ÿˆ Coroutines based Kotlin library to access play store
Java
38
star
29

movie_db

A simple API for IMDB (free and unlimited access - no API key needed)
Java
36
star
30

compose-bird

๐Ÿฆ A flappy bird clone using Compose Web and radio button
Kotlin
36
star
31

nemo

Nemo is a simple e commerce app powered by google sheets
Kotlin
27
star
32

swipe-search

๐Ÿ“บ A sample app to showcase Twyper with GitHub repo search API
Kotlin
26
star
33

gilfoyle

A CLI to interactively remove useless apps from your Android device.
Kotlin
23
star
34

rebugger-plugin

IDE plugin to assist Rebugger
Kotlin
23
star
35

paper-cop

The "Raja Chor Mantri Sipahi" (aka "Kallanum Polisum" ๐Ÿ˜‚) game android-ized.
Kotlin
22
star
36

compose-mario

๐ŸŽฎ An attempt to create Super Mario Bros using Compose for Desktop
Kotlin
22
star
37

phokuzed

Kotlin
21
star
38

abcd

Anybody Can Draw. ๐Ÿ–Œ๏ธ
Kotlin
21
star
39

cyclone

Write JVM apps Android way
Kotlin
20
star
40

super-github

Enhance your GitHub experience ๐Ÿš€
Kotlin
19
star
41

ccm-analyzer

A CLI companion to analyse and compare Compose Compiler Metrics (CCM)
JavaScript
18
star
42

prime-screams

Prime will scream when you use the unsafe !! operator in Kotlin
Kotlin
18
star
43

neymer

Sometimes you'll need a stylish and unique project name without compromising its meaning ๐Ÿ˜‹
18
star
44

show-todo

A simple utility to find your TODOs while working in a team
Kotlin
17
star
45

to-dot-lottie

A CLI tool to bulk convert all .json lottie files to .lottie format
Kotlin
17
star
46

jaba

A simple CLI program to convert your android project's structure.
Kotlin
16
star
47

WhatsApp-Status-Browser

A simple android application to save your friends' WhatsApp status to your gallery
Java
16
star
48

GPix

GPix - An unofficial Google Images API - (FREE AND UNLIMITED ACCESS :))
Java
14
star
49

ugh

Commit messages beautified ๐Ÿ’–
Kotlin
14
star
50

reky

โบ A simple android app to browse your phone call recordings
Kotlin
12
star
51

git-do-not-ignore

A web app to generate .gitignore rule to NOT to ignore a file
Kotlin
11
star
52

notes

A sample app to demonstrate https://github.com/theapache64/retrosheet library
Kotlin
11
star
53

top250

The IMDB top 250 movies in JSON ๐Ÿ’ป. Updates every 6th hour, 24/7. ๐Ÿ˜Ž
Kotlin
10
star
54

compose-web-template

Kotlin
9
star
55

measure

9
star
56

SoundCloud-Downloader

An android application to download tracks/playlists from SoundCloud (UNOFFICIAL , NO ADS and 100% FREE)
Java
8
star
57

compose-wasm-template

Kotlin
7
star
58

send

**QUICK** file transfer using your console
TypeScript
7
star
59

GJack

GJack or Google Hijack is a google sheet phishing tool
Java
6
star
60

avgizer

A web tool to calculate average from given bulk text data
Kotlin
5
star
61

vysor-pro-hack

Vysor pro hack script for 1.9.3_0
Shell
5
star
62

compose-desktop-game-template

๐ŸŽฎ A basic game template for Compose for Desktop
Kotlin
5
star
63

raven

A simple wallpaper app powered by Retrosheet : https://github.com/theapache64/retrosheet
Kotlin
5
star
64

super-google

Enhance your Google experience
Kotlin
4
star
65

organizer

A simple tool to organize your files.
Kotlin
4
star
66

expekt

Assertion library for Kotlin
Kotlin
4
star
67

ets

Employee Tracking System is an android project developed to track android devices (under employee-company strategy)
Java
4
star
68

name-that-color

A library to name hex color codes
Kotlin
3
star
69

multi-module-navigation-sample

Kotlin
3
star
70

sms-syncer

Sync all your SMS with your email, real-time.
Kotlin
3
star
71

ambient-IDE

Kotlin
3
star
72

Xrob

A spy application, designed for android.
Java
3
star
73

layzee

Generates beautiful work report from your git commit messages
TypeScript
2
star
74

android-benchmark

Kotlin
2
star
75

url-sherlock

A simple app to reveal URL. Inspired from https://revealurl.xyz/
Kotlin
2
star
76

mufy

A CLI tool to generate gifs from your favorite movie
Kotlin
2
star
77

r8-full-mode-issue-repro

Kotlin
2
star
78

FontAwesomeIconView

FontAwesomeIconView is an Android widget that can be used to show FontAwesomeIcons in your Android application.
Java
2
star
79

auto-motion2

๐Ÿค– A CLI to automate your video editing process
Kotlin
2
star
80

modular-navigation

Kotlin
2
star
81

emojipedia-api

An unofficial REST API for emojipedia.org
Kotlin
2
star
82

show-todo-native

Kotlin
2
star
83

livedata_transformation_example

A simple app to show LiveData Transformation, built using ( MVVM + Dagger2 + Retrofit + RxJava + DataBinding )
Java
2
star
84

qpool

An android library to create a questionnaire/feedback application
Kotlin
2
star
85

bugmailer

[DEPRECATED] An android library to send bug report via email
Kotlin
2
star
86

Whistle-Cam

An Android Camera that can capture image using Whistle
Java
2
star
87

twinkill

A simple library, a collection of utlity classes wrapped around JetPack components
Kotlin
1
star
88

stats

A simple file analysis tool for your project
Kotlin
1
star
89

blum

A simple java program to extract package name from an android project directory
Java
1
star
90

WordBird

WordBird is a non-official Android Application of wordhippo.com
Java
1
star
91

green-text

1
star
92

who-wrote

A simple tool to get author statistics from file created signature
Kotlin
1
star
93

theapache64

1
star
94

youtube-rabbit-hole

Kotlin
1
star
95

Log

iOS alternative for Android's Log class
Swift
1
star
96

pewdiepie-vs-tseries

A simple API to get subscriber count of pewdiepie and tseries.
Java
1
star
97

pray-cli

A CLI to get pray timings.
Kotlin
1
star
98

mvpize

A simple command line utility to create MVP components from an activity
Java
1
star
99

quick-emoji

Kotlin
1
star
100

cd-distributable-test

Kotlin
1
star