Using the split JAR architecture with NDK

57 views
Skip to first unread message

Sylvain

unread,
Jan 30, 2015, 6:07:59 AM1/30/15
to google-adm...@googlegroups.com
Hello,

I have seen the announcement of "split JAR architecture".

https://developers.google.com/mobile-ads-sdk/docs/admob/android/rel-notes

http://googleadsdeveloper.blogspot.fr/2014/12/announcing-v65-of-google-mobile-ads-sdk.html

If I understand correctly, this allows to reduce the .apk size by not including the whole "play services" library.


I am not using Android Studio, neither Eclipse. But only the NDK + commands like "android update project ...", "ndk build".

Is it possible to use this feature, and to include only the Ads part of the Jar.
If so, how should this be done ? which file to modify ? or which args / parameters?


Thanks,

Sylvain


Andrew Brogdon (Mobile Ads SDK Team)

unread,
Jan 30, 2015, 2:17:04 PM1/30/15
to google-adm...@googlegroups.com
Technically, yes, it is possible to use the split JAR files in a command line-built project, but it would be extremely tricky to do so, and it's not something that we recommend or support.

You would have to go into the SDK extras folder, find the artifacts with the JARs inside, extract them, then build a wrapper project to include the resources that AAR files contain but JARs cannot.  If you're the kind of developer who prefers command line tools to an IDE, this may be your kind of thing. As I mentioned, though, it's not something we'd be able to support here, as none of us have tried it. :)

-Andrew

Albert Gazetdinov

unread,
Jan 31, 2015, 2:28:32 AM1/31/15
to google-adm...@googlegroups.com
You can use JarJar for remove unnecessary modules from google-play-services.jar (3,5mb -> 0,8mb)
Example create gps.rules for ADS:
keep com.google.android.gms.ads.InterstitialAd
keep com.google.android.gms.ads.AdActivity
keep com.google.android.gms.ads.AdListener
keep com.google.android.gms.ads.AdRequest
keep com.google.android.gms.ads.AdSize
keep com.google.android.gms.ads.AdView
Create and run gps.bat:
java -jar jarjar.jar process gps.rules google-play-services.jar my_gps.jar

пятница, 30 января 2015 г., 14:07:59 UTC+3 пользователь Sylvain написал:

Sylvain

unread,
Jan 31, 2015, 6:09:09 AM1/31/15
to google-adm...@googlegroups.com
Hi,

Thanks for the responses !

I have tried Albert's solution, which is very easy to set-up.
I confirm that the google play library is then reduced to only 731 ko.

In the end, the .apk is reduced of 0.8 Mo (because of compression).
And it seems to work correctly on the device.

Any idea if there could be a problem in production ? like with x86 or mips device ? or with older android version ?
Will it be always compatible ?

Thanks,

Sylvain
Reply all
Reply to author
Forward
0 new messages