1

As described in Proguard's troubleshooting page:

In MacOS X, the run-time classes may be in a different place than on most other platforms. You'll then have to adapt your configuration, replacing the path <java.home>/lib/rt.jar by <java.home>/../Classes/classes.jar.

So for instance, on non-Mac environments you might have the following in your Proguard config:

-libraryjars <java.home>/lib/rt.jar

But for Mac environments you would point to classes.jar.


This is fine if this is only ever developed on a Mac, but if this code is checked into version control and shared by developers on multiple OSs and also on a build server running a different OS, it needs to be more flexible.

Is there a way to configure this in Proguard to work no matter what OS it runs on, without requiring users of the code to make filesystem changes?

Community
  • 1
  • 1
cottonBallPaws
  • 21,220
  • 37
  • 123
  • 171

1 Answers1

0

You could define a system variable that depends on the environment and use that:

-libraryjars <runtime.jar>

However, if you are developing for Android:

  • You should not refer to rt.jar or classes.jar, since they contain many java runtime classes that are not present in the Android runtime.
  • You should not specify -libraryjars, since the Ant/Eclipse/Gradle build processes already automatically specify all necessary -injars, -outjars, and -libraryjars for you.

If you see warnings about missing java runtime classes, you should consider an option like -dontwarn javax.**. See the ProGuard manual > Troubleshooting > Warning: can't find referenced class.

Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106