由Eclipse创建的我的APK是900K,但Android Studio是1.62MB。代码是一样的。为什么?在Eclipse中,我将facebook-sdk.jar,google-analytics.jar和其他jar添加到我的库中。在Android Studio中,两个build.gradle如下:
项目中的build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.google.gms:google-services:1.3.0-beta1'
}
}
allprojects {
repositories {
jcenter()
}
}
模块中的build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 15
targetSdkVersion 21
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.android.support:support-v4:21.0.3'
// compile 'com.google.android.gms:play-services:7.5.+'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
compile files('libs/stickylistheaders_lib.jar')
}
答案 0 :(得分:1)
在build.gradle
中使用此问题是在gradle build
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}