Adds some keep rules for R8 use cases

ajesh/r8-usecases
Ajesh R 1 month ago
parent c170a8ffb1
commit 4233caa2d5

@ -35,7 +35,8 @@
# Keep the public execute() method that has no parameters.
# This is critical because TaskRunner calls getMethod("execute").
# If this method is renamed (obfuscated) or removed (shrunk), your app will crash.
# If this method is renamed (obfuscated) or removed
# (shrunk), your app wont work the intended way.
public void execute();
}

@ -59,9 +59,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import javax.inject.Inject
import kotlin.reflect.KVisibility
@AndroidEntryPoint
class MainActivity : ComponentActivity() {
@ -90,19 +88,19 @@ class MainActivity : ComponentActivity() {
val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState)
// Loading class by reflection example
val workerClassName = "com.google.samples.apps.nowinandroid.CrashTestWorker"
WorkerLoader.loadAndRun(workerClassName)
val eventBus = EventBus()
// val listener = CustomListener()
// eventBus.dispatch(listener)
//
// val runner = TaskRunner()
// val task1 = ImportantBackgroundTask()
// Reflection using method annotation example
val eventBus = EventBus()
val listener = CustomListener()
eventBus.dispatch(listener)
// runner.process(task1) // This will be executed.
// Reflection using class annotation example
val runner = TaskRunner()
val task1 = ImportantBackgroundTask()
runner.process(task1) // This will be executed.

Loading…
Cancel
Save