I have an older project that was coded in one of the first releases of Android Studio. The project doesn't have any large assets other than the application icons. The only 3rd party library it used as AdMob SDK 4.3.1. The resulting signed APK was 105 Kb.
Now Google is requiring me to upgrade from AdMob SDK to Google Play Services SDK to continue to serve ads. So I fired up the latest version of Android Studio, converted the project to gradle
, referenced the latest Google Play Services SDK and regenerated a signed SDK (release mode). The size was 1595 Kb.
I can't figure out why it is so large and can't find a way to reduce it. I tried excluding libraries like in this answer, but the resulting file size didn't change.
What am I missing?
Here is my gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.google.android.gms:play-services-ads:9.6.1'
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 24
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}