#480 adaptclassstrings does not replace class names in strings with other characters

Eric Chen

I am using Proguard 4.10 with Dagger dependency-injection and am running into an incompatibility where classes generated by Dagger employ strings containing the fully-qualified names of classes using dependency injection, such as:


I call proguard with -adaptclassstrings but found through my testing that Proguard will replace strings consisting of ONLY the fully-qualified classname, but will not replace string containing a fully-qualified classname and other characters.

Would it be possible to replace fully-qualified classnames within strings, or at least, if this is not the default behavior, to allow an option to do so?

I have created and shared a simple test project illustrating this behavior:


  • Eric Chen
    Eric Chen

    This didn't come out right above:

  • Eric Lafortune
    Eric Lafortune

    Thanks for the suggestion. The options -adaptresourcefilenames and -adaptresourcefilecontents could be extended similarly, but it doesn't have a high priority and I haven't found a satisfying solution for not introducing ambiguities and unpleasant surprises.

    In this case, you should be able to split the string in a prefix and a class name (being careful that the compiler doesn't concatenate them for you). ProGuard can then update the class name.


  • Eric Chen
    Eric Chen

    Thanks for your response, Eric.

    In my case (with Dagger), the strings with the classnames are generated during compilation, so it would be infeasible to separate strings by hand each time. So for the moment, I have to rely on not obfuscating class names using Dagger dependency-injection.

    I appreciate you considering my request!