Reputation: 196
A simplest Hello World app generated from A.S. is almost 5MB! But in Eclipse it is only about 100KB
and when I create a project, The A.S. use the android.support:appcompat-v7
by default. Here is build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "test.elva.testapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
}
In Eclipse, if you set minSdkVersion up to 14, the project doesn't use appcompat-v7 library,and the class is extended to Activity
,not AppCompatActivity
in A.S.
Upvotes: 2
Views: 945
Reputation: 363587
You can't compare the dimension since you are including different libraries.
In Android Studio you are including the appcompat library with has code and resources, and has other dependencies like support-v4
library.
You can customize your build.gradle
script.
For example you can remove the AppCompat
library, commenting on removing the line from the dependencies
block
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:appcompat-v7:23.1.0'
}
AS is using the AppCompatActivity
as standard.
Yes it is true. There are many reasons for that, mainly the backport of material design under api 21.
Without the appcompat, you can't use view like as the Toolbar or views provided by the Design support library.
You can find official info here:
You can also remove the unused resources using:
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
More info here.
Upvotes: 3