I was previously using https://gist.github.com/dmarcato/d7c91b94214acd936e42 to strip down Google Mobiele Services, but the build times for my project in Android Studio consistently exceeded 75 seconds; this solution is much less dynamic (and even a little ugly) but keeps my build times less than 15s.
- Your app module has a directory named aars that will work as a project specific Maven repository; this directory should be placed under version control.
- Once https://code.google.com/p/android/issues/detail?id=55863 is resolved and released things might get a little cleaner,
- Maven (mvn) is installed and available on your path when running this script.
cd $ANDROID_HOME
cd extras/google/m2repository/com/google/android/gms/play-services/
ls
will show you what versions are installed (ex:6.1.11
)
- Go to your app module
- Place the Python script below next to
build.gradle
(for the app module, not the project module) - Make sure the Python script is executable (
chmod +x stripPlayServices.py
) - Run something like
./stripPlayServices 6.1.11
I make absolutely NO claim the Python script follows typical Python code style, is clean, or is even safe. It is just a dumb, brute force script.
- "looking good.... down to 1 sec build time as opposed to 17 sec!"