2016-07-21 6 views
-1

많은 문제를 검색했지만 빠른 시작을 위해 onCreate에서 코드를 리팩터링하는 것만으로 해결할 수 있습니다. 하지만 내 경우에는 문제가 달라 보입니다. 나와 내 팀원은 GITHUB를 통해 동기화 된 동일한 코드로 작업하고 있습니다. 그 사람이 만든 빌드는 플래시로 열리고 나에 의해 만들어진 빌드는 시작하는 데 10 초 이상 걸립니다. 또 다른 문제는 그의 빌드가 90MB 정도이고 빌드가 30MB에 불과하다는 것입니다. 어쨌든 응용 프로그램은 완벽하게 작동하지만 시작 시간과 빌드 크기에서 보이는 차이가 너무 큽니다.Android 앱이 시작하는 데 너무 오래 걸립니다.

나는 그의 시스템 구성에 대해 잘 모르겠다.하지만 JAVA8을 컴파일 용으로 SDK 24와 Gradle 2.10을 사용하여 앱을 만든다. 당신은, 실행, 배포> 인스턴트 실행> 인스턴트 실행을

환경 설정을 해제하려고 빌드 할 수 있습니다 만 디버그 모드에서 일어나는 경우 여기

내 Gradle을 파일

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' 
+1

APK의 크기가 서로 다릅니다. 그가 사용하고있는 IDE/버전을 아는 것이 유용 할 수도 있습니다. 또한 두 사람이 같은 리소스를 사용하고있는 경우 등에 유용 할 것입니다. 30 대 90MB 크기가 이상하게 보입니다. – Sufian

+0

예 @Sufian을 알았습니다. 리소스와 일치했습니다. 거의 동일합니다. 그리고 우리 둘 다 Android Studio 2.1.2를 사용하고 있습니다. –

+0

이 스레드도 참조하십시오. http://stackoverflow.com/questions/22064591/apk-size-is-bigger-than-expected-android-studio – Sufian

답변

6

입니다

"Enable Instant Run ..."의 선택을 취소하십시오.

+0

나는 배제하지 않습니다. 이런 이상한 일이 생기는 순간. 그것은 정말 엉망이되었습니다. – Sufian

+0

맞지만 문제가 있는지 확인하기 위해 – Yoni

+0

응용 프로그램이 빠르게 실행되고 크기가 30MB에서 120MB로 변경되었습니다. 잘 작동하지만이 동작에 대한 링크 나 설명을 제공 할 수 있다면 더 유용 할 것입니다. –

-1

가끔 메인 스레드가 수행하는 작업이 더 많기 때문입니다. 앱이 실행되는 속도가 느려집니다. 메인 스레드에서 더 많은 작업을 방지하십시오.

+0

내 질문의 첫 번째 줄에서 언급했듯이, 주 스레드 또는 onCreate 문제 때문이 아닙니다. 그러나 당신의 시도에 감사드립니다. –

관련 문제