SDK stops working after proguard build with Android Studio

1,150 views
Skip to first unread message

Hans van der Gragt

unread,
Dec 20, 2013, 6:24:01 PM12/20/13
to ima...@googlegroups.com
I have succesfully completed the integration of the Android SDK 3.0.4 version and everything runs fine while in debug mode.
When building a release version with proguard including the following line:
-keep class com.google.ads.interactivemedia.**

The application crashes with an AssertionError like below:
java.lang.AssertionError
at com.google.ads.interactivemedia.v3.a.b.a.l$a.<init>(SourceFile:733)
at com.google.ads.interactivemedia.v3.a.b.a.l$19.a(SourceFile:762)
at com.google.ads.interactivemedia.v3.a.f.a(SourceFile:356)
at com.google.ads.interactivemedia.v3.a.b.a.h$1.<init>(SourceFile:82)
at com.google.ads.interactivemedia.v3.a.b.a.h.a(SourceFile:118)
at com.google.ads.interactivemedia.v3.a.b.a.h.a(SourceFile:72)
at com.google.ads.interactivemedia.v3.a.f.a(SourceFile:356)
at com.google.ads.interactivemedia.v3.a.b.a.f.a(SourceFile:126)
at com.google.ads.interactivemedia.v3.a.f.a(SourceFile:356)
at com.google.ads.interactivemedia.v3.a.b.a.h$1.<init>(SourceFile:82)
at com.google.ads.interactivemedia.v3.a.b.a.h.a(SourceFile:118)
at com.google.ads.interactivemedia.v3.a.b.a.h.a(SourceFile:72)
at com.google.ads.interactivemedia.v3.a.f.a(SourceFile:356)
at com.google.ads.interactivemedia.v3.a.f.a(SourceFile:802)
at com.google.ads.interactivemedia.v3.a.f.a(SourceFile:689)
at com.google.ads.interactivemedia.v3.b.r.a(SourceFile:132)
at com.google.ads.interactivemedia.v3.b.t.b(SourceFile:83)
at com.google.ads.interactivemedia.v3.b.t$1.shouldOverrideUrlLoading(SourceFile:46)
at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:293)
at com.android.org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:96)
at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)

I have tried Android Studio versions 0.3.2, 0.3.7 and 0.4.0 and all yield the same result, a non working ad player.

Please help in resolving this issue.

Hans van der Gragt

unread,
Dec 23, 2013, 8:00:31 AM12/23/13
to ima...@googlegroups.com
I have converted the sample project to Android Studio to help with debugging the issue: https://www.dropbox.com/s/yx1lx82bbnnfoqu/ReleaseIMA.zip
When running in release mode with proguard enabled (as defined in build.gradle) the project crashes.

Shawn Busolits (IMA SDK Team)

unread,
Dec 26, 2013, 11:42:29 AM12/26/13
to ima...@googlegroups.com
Hey Hans,

Thanks for the additional info. We'll take a look at this one and let you know what we find.

Thanks,
Shawn Busolits
IMA SDK Team

Shawn Busolits (IMA SDK Team)

unread,
Dec 26, 2013, 12:59:37 PM12/26/13
to ima...@googlegroups.com
Hey Hans,

Are you running proguard via the signed APK wizard in Android Studio or through a command line interface? Also, could you include the proguard config you're using when you see the issue? I've tried building with the code you sent me using the wizard and the default proguard config file and my apk is still working fine, so we must be doing something differently.

Thanks,
Shawn Busolits
IMA SDK Team

Hans van der Gragt

unread,
Dec 27, 2013, 6:19:35 AM12/27/13
to ima...@googlegroups.com
Hey Shawn,

Proguard is part of the release process when calling: assembleRelease from the commandline. (But we have testen the Generate signed APK as well, this yields the same results)
I have updated the sample project (now includes the full workspace) with a keystore: https://www.dropbox.com/s/3d0ddfrpt7mimkg/ReleaseIMA2.zip

The simplest way to test is: 
Select: View - Tool Windows - Build Variants
Select: Release as build variant.
Press the Run button.

Best regards,

Hans

Shawn Busolits (IMA SDK Team)

unread,
Dec 27, 2013, 12:32:07 PM12/27/13
to ima...@googlegroups.com
Hey Hans,

Thanks for the updated project file. I took a look and was able to replicate your issue. I'll let the rest of the team know and we'll look into it.

Thanks,
Shawn Busolits
IMA SDK Team

Hans van der Gragt

unread,
Feb 17, 2014, 3:15:22 AM2/17/14
to ima...@googlegroups.com
Hi Shawn,

Do you have an update regarding this issue?

Thanks,

Hans

Shawn Busolits (IMA SDK Team)

unread,
Feb 17, 2014, 4:15:20 AM2/17/14
to ima...@googlegroups.com
Hey Hans,

We're still working on this one. As soon as we have a solution I'll let you know.

Thanks,
Shawn Busolits
IMA SDK Team

Jacob Tabak

unread,
Feb 23, 2014, 5:29:30 PM2/23/14
to ima...@googlegroups.com
W/System.err﹕ java.lang.AssertionError
W/System.err﹕ at com.google.b.a.a.a.b.a.bg.<init>(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.b.a.ak.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.k.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.b.a.q.<init>(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.b.a.p.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.b.a.p.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.k.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.b.a.k.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.k.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.b.a.q.<init>(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.b.a.p.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.b.a.p.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.k.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.k.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.a.k.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.c.x.a(Unknown Source)
W/System.err﹕ at com.google.b.a.a.c.ah.b(Unknown Source)
W/System.err﹕ at com.google.b.a.a.c.ai.shouldOverrideUrlLoading(Unknown Source)
W/System.err﹕ at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:293)
W/System.err﹕ at com.android.org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:96)
W/System.err﹕ at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err﹕ at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err﹕ at android.os.Looper.loop(Looper.java:136)
W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5017)
W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
A/libc﹕ Fatal signal 6 (SIGABRT) at 0x00004fb6 (code=-6), thread 20406

We are having the same issue, we cannot release the app with proguard enabled without a fix.

Jacob Tabak

unread,
Feb 23, 2014, 5:37:38 PM2/23/14
to ima...@googlegroups.com
I was able to fix it by adding the following to my proguard-rules.txt:

-keep class com.google.** { *; }
-keep interface com.google.** { *; }

Shawn Busolits (IMA SDK Team)

unread,
Feb 24, 2014, 12:32:57 PM2/24/14
to ima...@googlegroups.com
Hey Jacob,

Thanks for that info. To the other folks on the thread - does that addition solve your problems as well?

Thanks,
Shawn Busolits
IMA SDK Team

Hans van der Gragt

unread,
May 12, 2014, 4:28:16 PM5/12/14
to ima...@googlegroups.com
Hi Shawn,

Sorry for the late response, we decided to release the previous version with a very old version of the sdk which did not have this issue and are now picking up where we left off.
The issue is still present in the beta6 sdk.

I do not think that the keep com.google.** is the right solution.
Google has other projects which do work with proguard, but are now kept because the IMA SDK does not.

Are you going to fix the problem permanently?

Best regards,

Hans

Shawn Busolits (IMA SDK Team)

unread,
May 12, 2014, 4:56:02 PM5/12/14
to ima...@googlegroups.com
Hi Hans,

Can you send me the error you're seeing with keep com.google.** in your proguard config? That has been working for us, so I'm wondering if you're seeing a different problem than we were.

Thanks,
Shawn Busolits
IMA SDK Team

Hans van der Gragt

unread,
May 13, 2014, 11:02:50 AM5/13/14
to ima...@googlegroups.com
Hi Shawn,

I do not see an error, in my opinion adding the "keep com.google.**" is not the solution to the problem.
Other Google project that work nicely are now kept by proguard (for instance the entire support package, google analytics sdk and google gson).
Perhaps the entire source can be placed in com.google.ads.interactivemedia.v3?

Best regards,

Hans

Shawn Busolits (IMA SDK Team)

unread,
May 14, 2014, 10:16:58 AM5/14/14
to ima...@googlegroups.com
Hi Hans,

I can relay this information to the rest of the team to let them know your concern. Currently the IMA SDK has other dependencies outside of its own package, which requires the broader scope on proguard keeps. I'll talk to the rest of the team to see if there's something we can do to improve this.

Thanks,
Shawn Busolits
IMA SDK Team

Shawn Busolits (IMA SDK Team)

unread,
May 14, 2014, 10:46:33 AM5/14/14
to ima...@googlegroups.com
Hey Hans,

Can you try the following in your proguard file and let me know if it works? It appears to work for me:

-keep class com.google.ads.interactivemedia.** { *; }
-keep interface com.google.ads.interactivemedia.** { *; }

This should preserve only the IMA classes and interfaces.

Thanks,
Shawn Busolits
IMA SDK Team

Hans van der Gragt

unread,
May 23, 2014, 4:09:56 AM5/23/14
to ima...@googlegroups.com
Hi Shawn,

That worked, thanks!

Best regards,

Hans
Reply all
Reply to author
Forward
0 new messages