# How to break your Android App with proguard / R8

DevFeed: [How to break your Android App with proguard / R8](<https://devfeed.tech/articles/how-to-break-your-android-app-with-proguard-r8-24744.md>)

Original publisher: [Read original article](<https://medium.com/yazio-engineering/how-to-break-your-android-app-with-proguard-r8-6566bc387b63?source=rss----65bd178b00af---4>)

Author: Paul Woitaschek

Published: 2021-03-02T15:19:22Z

Content type: article

Language: en

Sources: [YAZIO](<https://devfeed.tech/sources/yazio-engineering-medium.md>)

Topics: [R8](<https://devfeed.tech/topics/r8.md>), [proguard](<https://devfeed.tech/topics/proguard.md>), [Android Testing](<https://devfeed.tech/topics/android-testing.md>), [Android](<https://devfeed.tech/topics/android.md>), [Android Gradle Plugin](<https://devfeed.tech/topics/android-gradle-plugin.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [app](<https://devfeed.tech/tags/app.md>), [proguard](<https://devfeed.tech/tags/proguard.md>), [r8](<https://devfeed.tech/tags/r8.md>)

## AI overview

A broad R8/ProGuard rule, `-assumenosideeffects class android.util.Log { public *; }`, can affect inherited public methods as well as logging calls. The article reports that this includes synchronization methods on `Object`, such as `notify`, potentially breaking app synchronization and causing hangs. It recommends avoiding `*` wildcards with `-assumenosideeffects` and specifying the logging signatures explicitly (`v`, `d`, `i`, `w`, `e`, and `println`) when removing production log calls. The author also warns that the issue can enter an app through a library's consumer ProGuard rules.

## Source excerpt

I recently updated the android gradle plugin to 4.0.0. While developing, everything went smoothly and at some point I was ready to cut a release. The very last manual testing of the release app bundle was also fine so no Proguard / R8 issues on the first sight either. Then I thought: Let me check the CI results again. Everything was fine, but: The instrumentation tests. Almost all of them were timing out. After inspecting the logs, they all hang at the end of the on-boarding. Strangely the loading spinner was loading for way longer than the timeout should be. So I tested it on my phone and faced the same results. At that time I had no idea it was caused by updating AGP, so I did a 2 hours long git bisect. Okay, now lets create a minimal self reproducible bug report because I found a huge bug in AGP, everyone should know about immediately. I created a Hello World project that was making a single network call and printed it results into a TextView. Strangely here it did not reproduce. After experimenting with the OkHttp configuration and testing if it was related to some gradle plugin, I finally had the idea that it might be related to R8. So I added my proguard configuration and now the network call hang! Let's locate the issue further. I was step by step removing lines from my proguard configuration until only a single line was left: -assumenosideeffects class android.util.Log { public * ; } Now what is this? How is that even slightly related to anything? It should remove the log spam of some third party libraries we're using. So I was asking Mads Ager. (he works on D8/R8) you have to be very careful with -assumenosideeffects The problem is that in order for -assumenosideeffects to have the effect of actually removing calls, it matches up the class hierarchy. Therefore, this rule says that anything public in android.util.Log and its superclasses has no side-effects. That include the synchronization methods defined on Object. So, please don't use * wildcards in conne