2

After migrating from eclipse my APK size grew roughly by 1.5MB. Checking in the .iml file I see: <orderEntry type="library" exported="" name="appcompat-v7-22.0.0" level="project" /> I guess AS includes appcompat always. Even if not required by build.gradle script and not used in the app.

R.java also has tons of references to appcompat.

I repeat my build.gradle has no reference to appcompat:

dependencies {
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.google.android.gms:play-services:7.5.0'
}

Does anybody have this issue?

ivy_the
  • 280
  • 5
  • 14
  • I don't really know why appcompat has been added (maybe as part of play-services?) but to reduce the application size, you can specifically reference only the libs you need in play-services as per https://developers.google.com/android/guides/setup. Should shave off a few mbs if you don't need absolutely everything in play-services. I for instance, only needed the GCM and the ads. Do this and see if the (possibly indirect) dependency on appcompat disappears. – kha Jun 25 '15 at 12:52

2 Answers2

4

Google Play Services version com.google.android.gms:play-services:7.5.0 or above now uses appcompat-v7, you have to use the previous version of play services:

compile 'com.google.android.gms:play-services:7.0.0'.

It's better described in this post https://stackoverflow.com/a/32096389/5135768

Community
  • 1
  • 1
Priya B
  • 96
  • 10
0

Check your build.gradle in your module.

If the dependencies block contains

dependencies {
    compile 'com.android.support:appcompat-v7:XX.X.X'
}

it means that your app is using AppCompat.

If you don't use it, remove this line from the build.gradle and sync the project.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841