ProGuard: Warning: org.apache.commons.beanutils.BeanMap$2: can't find superclass or interface org.apache.commons.collections.Transformer
android, java, maven, proguard
Solution
I solved the problem. It was being caused by a configuration problem in my IntelliJ installation:
Project right click -> Open module settings -> Facets option -> Compiler tab:
- Make sure Proguard is enabled
- Make sure the config file paths should show:
- the proguard-project.txt file from our project
- the proguard-android.txt from the SDK.
In my case it was only showing the one from the SDK, so the changes that I was making to the file in my project weren't being taken into account.
After this change, I could use Proguard options shown in the Proguard documentation and fix those warnings.
The file project.properties is automatically generated by IntelliJ and shouldn't be modified by hand. Even if this file shows it is using both files for the configuration, it is not necessarily true, please check out the Settings dialog.
Problem
I am getting the following error while using Proguard on an Android app. ``` ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$2: can't find superclass or interface org.apache.commons.collections.Transformer ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$3: can't find superclass or interface org.apache.commons.collections.Transformer ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$4: can't find superclass or interface org.apache.commons.collections.Transformer ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$5: can't find superclass or interface org.apache.commons.collections.Transformer ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$6: can't find superclass or interface org.apache.commons.collections.Transformer ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$7: can't find superclass or interface org.apache.commons.collections.Transformer ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$8: can't find superclass or interface org.apache.commons.collections.Transformer ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$9: can't find superclass or interface org.apache.commons.collections.Transformer ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$Entry: can't find superclass or interface org.apache.commons.collections.keyvalue.AbstractMapEntry ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanPredicate: can't find superclass or interface org.apache.commons.collections.Predicate ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanPropertyValueChangeClosure: can't find superclass or interface org.apache.commons.collections.Closure ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate: can't find superclass or interface org.apache.commons.collections.Predicate ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanToPropertyValueTransformer: can't find superclass or interface org.apache.commons.collections.Transformer ProGuard: [sand] Warning: org.apache.commons.beanutils.MappedPropertyDescriptor: can't find superclass or interface java.beans.PropertyDescriptor ProGuard: [sand] Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find superclass or interface javax.servlet.ServletContextListener ProGuard: [sand] Warning: roboguice.activity.RoboMapActivity: can't find superclass or interface com.google.android.maps.MapActivity ProGuard: [sand] Warning: roboguice.test.shadow.ShadowFragmentActivity: can't find superclass or interface com.xtremelabs.robolectric.shadows.ShadowActivity ProGuard: [sand] Warning: library class org.apache.http.auth.AuthenticationException extends or implements program class org.apache.http.ProtocolException ProGuard: [sand] Warning: library class org.apache.http.auth.MalformedChallengeException extends or implements program class org.apache.http.ProtocolException ProGuard: [sand] Warning: library class org.apache.http.auth.params.AuthParamBean extends or implements program class org.apache.http.params.HttpAbstractParamBean ... keeps going till 743 errors (warnings) ``` I've tried several options to prevent this from happening (-dontskipnonpubliclibraryclassmembers, -keep, -dontwarn, -ignorewarnings) without success. Maybe I am not using these options correctly. I am using IntelliJ and targeting android-19 (Android 4.4.2). The app builds with some 3rd party libraries: some are included in the libs folder, some others are included through a Maven pom.xml. I suspect the libraries included through the pom.xml are not being included in the -libraryjars option. My project.properties looks like this: ``` # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt # Project target. target=android-19 ``` My proguard-project.txt looks like this: ``` -dontskipnonpubliclibraryclassmembers # Libraries -dontwarn org.apache.** -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } # WebView with JS: specify the fully qualified class name to the JavaScript interface class: -keepclassmembers class fqcn.of.javascript.interface.for.webview { public *; } # Database model -keep class com.mycompany.model.db.** -keepclassmembers class com.mycompany.model.db.** { *; } # Project target. target=android-19 ``` Any ideas why this is happening?