即使不需要,Android Studio 是否也使用 appcompat v7?

Does Android Studio use appcompat v7 even if not required?

从 Eclipse 迁移后,我的 APK 大小大约增加了 1.5MB。 签入我看到的 .iml 文件:<orderEntry type="library" exported="" name="appcompat-v7-22.0.0" level="project" /> 我想 AS 总是包含 appcompat。即使 build.gradle 脚本不需要并且不在应用程序中使用。

R.java 也有大量对 appcompat 的引用。

我重复我的 build.gradle 没有引用 appcompat:

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

有人遇到这个问题吗?

检查模块中的 build.gradle

如果 dependencies 块包含

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

这意味着您的应用正在使用 AppCompat。

如果您不使用它,请从 build.gradle 中删除此行并同步项目。

Google Play Services 版本com.google.android.gms:play-services:7.5.0 或更高版本现在使用appcompat-v7,您必须使用以前版本的Play Services:

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

在这个post中描述得更好