Android studio 2.0 is stable and reduces the application startup speed
•
Android
I'm using Android studio 1.5 (not very fast). Today I updated it to a stable version of 2.0. Now it takes 2-3 minutes to start. After the first start, I immediately checked the application information screen and found that there was 41mb (depending on different devices) in the first cache. I don't know what happened. This is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
packagingOptions {
exclude 'Meta-INF/NOTICE'
exclude 'Meta-INF/LICENSE'
exclude 'Meta-INF/DEPENDENCIES'
exclude 'Meta-INF/DEPENDENCIES.txt'
exclude 'Meta-INF/LICENSE.txt'
exclude 'Meta-INF/NOTICE.txt'
}
sourceSets {
main.jniLibs.srcDirs = ['libs']
}
defaultConfig {
applicationId "com.my.app"
minSdkVersion 17
targetSdkVersion 21
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false;
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "2g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':volley')
compile project(':android-country-picker-master')
compile project(':viewPagerIndicator')
compile ('com.android.support:design:23.1.1') {
exclude module: 'support-v4'
}
compile ('com.google.code.gson:gson:2.5'){
exclude module: 'support-v4'
}
compile ('com.squareup.picasso:picasso:2.5.0'){
exclude module: 'support-v4'
}
compile ('pl.droidsonroids.gif:android-gif-drawable:1.1.10'){
exclude module: 'support-v4'
}
compile ('javax.annotation:javax.annotation-api:1.2'){
exclude module: 'support-v4'
}
compile ('com.google.android.gms:play-services:8.4.0') {
exclude module: 'support-v4'
}
compile ('com.squareup.retrofit:retrofit:1.9.0'){
exclude module: 'support-v4'
}
compile ('com.squareup.okhttp:okhttp:2.4.0'){
exclude module: 'support-v4'
}
compile 'org.apache.httpcomponents:httpclient:4.5.1'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile ('com.google.guava:guava:18.0') {
exclude module: 'support-v4'
}
compile ('org.apache.commons:commons-lang3:3.4'){
exclude module: 'support-v4'
}
}
Any help will be appreciated. Thank you
resolvent:
As stated herein: http://tools.android.com/tech-docs/instant-run
Try to implement it in gradle
android {
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 14
}
}
...
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码