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

v4.9
open
5
2013-11-10
2013-10-26
Eric Chen
No

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:

'members/com.example.MainUsingProvider'
'javax.inject.Provider<com.example.Dependency>'

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:
https://github.com/Vungle/adapt-class-strings-example

Discussion

  • Eric Chen
    Eric Chen
    2013-10-31

    This didn't come out right above:
    'javax.inject.Provider<com.example.Dependency>'

     
  • Eric Lafortune
    Eric Lafortune
    2013-11-01

    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

     
  • Eric Chen
    Eric Chen
    2013-11-10

    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!