Showkase icon indicating copy to clipboard operation
Showkase copied to clipboard

The library doesn't work with Proguard/R8

Open davidvavra opened this issue 3 years ago • 3 comments

If the app has Proguard/R8 turned on, generated code is removed and Showkase doesn't show any components.

I workarounded it by adding an exception to Proguard rules - keep everything in a package with generated code - like this:

-keep class com.jll.jet.app.showkase.** { *; }

But probably more generic rule should be included in the library.

davidvavra avatar Dec 09 '21 15:12 davidvavra

Are you using a release build of the Showkase browser? The primary use case of the app was in the debug mode so an R8 rule wasn't exported with the app. This is to ensure that we don't have an apk size impact on your app.

vinaygaba avatar Dec 09 '21 19:12 vinaygaba

Yes we have multiple flavors of the app and the use-case is that there is a flavor for QA environment. But we want to distribute release build so QA people test as close as production app possible. But seing Showkase is useful for QA people. Maybe R8 configuration can be only in documentation, not exported in the library.

davidvavra avatar Dec 09 '21 19:12 davidvavra

Any update on this ?

lupsyn avatar Mar 22 '22 11:03 lupsyn

You essentially need to add a proguard keep rule to make it with in release/alternate builds. The exact keep rule depends on your setup. For example, if your ShowkaseRootModule implementation looks like this -

package my.lovely.package

@ShowkaseRoot
class MyRootModule: ShowkaseRootModule

Then your proguard rule will need to be

-keep class **.MyRootModuleCodegen { }

We are essentially trying to retain the final XCodegen class that Showkase generates. The name of this generated class is of the format (_name_of_ShowkaseRootModule_implementation_)Codegen.

Hope this makes sense!

vinaygaba avatar Dec 20 '22 18:12 vinaygaba

@vinaygaba Thanks for the info. But it would be good to add this information to README before closing this issue.

davidvavra avatar Dec 21 '22 10:12 davidvavra