MoPub Android proguard error, plz help! [PROGUARD]

mopub
android

#1

So, when enabling proguard on mopub, I get the following error:

C:\_Projects\SaraHaley\saraHaley\src\main\java\com\sr\feedsapp\sarahaley\DetailViewActivity.java
Error:(37, 38) error: cannot find symbol class Builder
Error:(487, 41) error: cannot find symbol class Builder
Error:(495, 37) error: cannot find symbol class MoPubClientPositioning
Error:(538, 78) error: cannot find symbol class InterstitialAdListener
C:\_Projects\SaraHaley\saraHaley\src\main\java\com\sr\feedsapp\sarahaley\MainActivity.java
Error:(405, 60) error: cannot find symbol class BannerAdListener
Error:(2293, 51) error: cannot find symbol class Builder
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\_Projects\SaraHaley\saraHaley\src\main\java\com\sr\feedsapp\sarahaley\FeedsApp.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:saraHaley:compileAudienceReleaseJavaWithJavac FAILED
Error:Execution failed for task ':saraHaley:compileAudienceReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED

Since this is is a nested class (Builder), I can’t get proguard to keep this classes, has anyone encountered this before?
and then theres the rest of the errors
this happens by just setting minifyEnabled to true

Thanks a lot.


#2

Hi @einschneidend76

Thanks for reaching out and providing these details. Are you still experiencing these errors? If so, we’d appreciate it if you could email us at support@mopub.com so that we can take a deeper look. Please also include the following information:

  1. The MoPub SDK version you are working with.
  2. Snippets of your Proguard integration.
  3. The above error log (as well as any other errors you may be seeing).

You may already be aware, but I’d like to make sure I point out our Proguard documentation located here for additional information.

We’re looking forward to providing a proper resolution for you. Thank you in advance.


#3

Hi, I managed to solve the error, even thou I followed the Proguard documentation this was happening at the end I came up with the solution by reading the Proguard java docs:

# MoPub Proguard Config
# NOTE: You should also include the Android Proguard config found with the build tools:
# $ANDROID_HOME/tools/proguard/proguard-android.txt

# Keep public classes and methods.
-keepclassmembers class com.mopub.** { public *; }
-keep public class com.mopub.**
-keep public class android.webkit.JavascriptInterface {}

# Explicitly keep any custom event classes in any package.
-keep class * extends com.mopub.mobileads.CustomEventBanner {}
-keep class * extends com.mopub.mobileads.CustomEventInterstitial {}
-keep class * extends com.mopub.nativeads.CustomEventNative {}
-keep class * extends com.mopub.mobileads.CustomEventRewardedVideo {}
-keep class * extends com.mopub.mobileads.CustomEventRewardedVideo {}

# Support for Android Advertiser ID.
-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {*;}
-dontwarn com.google.android.gms.**

# Filter out warnings that refer to legacy Code.
-dontwarn org.apache.http.**
-dontwarn com.mopub.volley.toolbox.**

# Missing scripts (my scripts)
-keep class com.facebook.ads.** {*;}
-keepattributes Exceptions,InnerClasses,...
-keep class com.mopub.nativeads.ViewBinder$Builder {*;}

-keepattributes EnclosingMethod

Anyway, thanks a lot for taking some time to attend this!


#4

Thanks for following up @einschneidend76. Glad to hear you were able to solve the errors through the Proguard java docs.

As always, if you have any questions, please feel free to reach out to us!