how to exclude myLib jar library from building APK in Android Studio

2,488 views
Skip to first unread message

Kevin Kim

unread,
Apr 28, 2015, 10:28:43 AM4/28/15
to android-...@googlegroups.com
Hi, all, 

I'd like to find how to exclude myLib jar file from building APK in Android Studio (1.1.0) 
so that main app can reference the interface definition (in myLib jar) but not included in APK.

At eclipse it can be done simply by Properties->Java Build Path->Libraries tab->...jar file to have an extra line on expanding it which says:Excluded from publish/export structure: (None)

I've tried to some but haven't succeeded yet.

Any other tangible ways in Android Studio ?

Thanks,
Kevin 

Michael Moussa

unread,
Apr 28, 2015, 11:28:15 PM4/28/15
to android-...@googlegroups.com
It's a lot better with Gradle/studio. With the old build tools you could only do it in eclipse, there was no way to support it with command line ant build. With studio you set it up in your build.gradle and it works in both.

Put something similar to the following in your app/build.gradle...

dependencies {
provided files('externlibs/myjar.jar')
}

Kevin Kim

unread,
Apr 29, 2015, 11:46:52 PM4/29/15
to android-...@googlegroups.com
Dear Mr. Michael Moussa,

Thank you so much for your kind help.
It worked ^^!

Warm regards,
Kevin
Reply all
Reply to author
Forward
0 new messages