Ich suchte viel nach dem Problem, aber die einzige Antwort, die ich finden konnte, ist das Refactoring des Codes von onCreate, um einen schnellen Start zu ermöglichen. Aber das Problem sieht in meinem Fall anders aus. Ich und mein Teammitglied arbeiten an demselben Code, der durch GITHUB synchronisiert wird, Builds, die von ihm gemacht werden, öffnen sich im Handumdrehen und Builds, die von mir gemacht werden, brauchen mehr als 10 Sekunden, um zu starten. Ein anderes Problem, seine Builds sind 90MB oder so und meine Builds sind nur 30MB. App ist auf jeden Fall voll funktionsfähig, aber der Unterschied in Startzeit und Build-Größe ist zu groß.Android App dauert zu lange zum Starten
Ich bin mir nicht sicher über seine Systemkonfiguration, aber ich verwende JAVA8 zum Kompilieren, SDK 24 und Gradle 2.10 zum Erstellen der App.
Hier ist meine gradle Datei
buildscript {
repositories {
jcenter()
/*flatDir {
dirs 'libs'
}*/
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//compile(name:'library-release', ext:'aar')
classpath 'io.realm:realm-gradle-plugin:0.88.0'
classpath 'io.fabric.tools:gradle:1.21.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
useLibrary 'org.apache.http.legacy'
dexOptions {
maxProcessCount 4 // this is the default value
javaMaxHeapSize "4g"
dexInProcess = false
}
defaultConfig {
applicationId "com.sample.app"
minSdkVersion 21
targetSdkVersion 24
versionCode 31
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
/*debug {
minifyEnabled true
useProguard false
}*/
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java']
}
robolectric {
java.srcDir file('src/test/java/')
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.twitter.sdk.android:twitter:[email protected]') {
transitive = true;
}
testCompile 'org.robolectric:shadows-play-services:3.0'
testCompile 'org.robolectric:shadows-support-v4:3.0'
testCompile 'org.powermock:powermock-module-junit4:1.6.2'
testCompile 'org.powermock:powermock-module-junit4-rule:1.6.2'
testCompile 'org.powermock:powermock-api-mockito:1.6.2'
testCompile 'org.powermock:powermock-classloading-xstream:1.6.2'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.0'
testCompile 'org.assertj:assertj-core:1.7.0'
androidTestCompile 'com.android.support:support-annotations:24.0.0'
androidTestCompile 'com.android.support.test:runner:0.4'
androidTestCompile 'com.android.support.test:rules:0.4'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
transitive = true;
}
// compile(group: 'com.google.gms', name: 'google-services', version: '2.0.0-beta4', ext: 'pom')
//apply plugin: 'com.android.application'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.google.android.gms:play-services-location:9.2.1'
compile 'com.google.android.gms:play-services-gcm:9.2.1'
compile 'com.mcxiaoke.volley:library:1.0.15'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.coinbase.android:coinbase-android-sdk:1.0.1'
compile 'org.roboguice:roboguice:2.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.14'
compile 'com.sprylab.android.texturevideoview:texturevideoview:1.1.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.android.gms:play-services-ads:9.2.1'
compile 'com.google.android.gms:play-services-auth:9.2.1'
}
//put 'com.google.gms.google-services' plugin at the bottom
apply plugin: 'com.google.gms.google-services'
Die Größe der APK sollte nicht so unterschiedlich sein! Es könnte nützlich sein, zu wissen, welche IDE/Version er benutzt und auch wenn Sie beide die gleichen Ressourcen benutzen. Die Größe von 30 vs 90MB scheint seltsam. – Sufian
Ja, ich weiß @Sufian, wir haben die Ressourcen abgestimmt, sie sind fast gleich. Und wir beide verwenden Android Studio 2.1.2 –
Siehe auch diesen Thread http://StackOverflow.com/Questions/22064591/APK-Size-IS-bigger-than-Expected-android-Studio – Sufian