2016-10-06 19 views
17

Sau khi nâng cấp dự án của tôi để kích hoạt tính năng Jack và Java8, macbook 16GB của tôi dường như không thể xây dựng dự án của tôi nữa. Tôi thấy việc sử dụng bộ nhớ ngày càng cao hơn nhưng quá trình này luôn bị kẹt ở cùng một điểm.Jack biên dịch lấy mãi mãi

My Gradle console:

Executing tasks: [:app:assembleDebug] 

Configuration on demand is an incubating feature. 
Incremental java compilation is an incubating feature. 
:app:preBuild UP-TO-DATE 
:app:preDebugBuild UP-TO-DATE 
:app:compileDebugNdk UP-TO-DATE 
:app:checkDebugManifest 
:app:preReleaseBuild UP-TO-DATE 
:app:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE 
:app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE 
:app:prepareComAndroidSupportCardviewV72421Library UP-TO-DATE 
:app:prepareComAndroidSupportCustomtabs2340Library UP-TO-DATE 
:app:prepareComAndroidSupportDesign2421Library UP-TO-DATE 
:app:prepareComAndroidSupportRecyclerviewV72421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE 
:app:prepareComBluelinelabsConductor203Library UP-TO-DATE 
:app:prepareComFacebookAndroidFacebookAndroidSdk4160Library UP-TO-DATE 
:app:prepareComGithubJkwiecienEasyImage130Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAuth940Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase940Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesBase940Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesBasement940Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesTasks940Library UP-TO-DATE 
:app:prepareComGoogleFirebaseFirebaseAnalytics940Library UP-TO-DATE 
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl940Library UP-TO-DATE 
:app:prepareComGoogleFirebaseFirebaseAuth940Library UP-TO-DATE 
:app:prepareComGoogleFirebaseFirebaseAuthCommon940Library UP-TO-DATE 
:app:prepareComGoogleFirebaseFirebaseAuthModule940Library UP-TO-DATE 
:app:prepareComGoogleFirebaseFirebaseCommon940Library UP-TO-DATE 
:app:prepareComGoogleFirebaseFirebaseCore940Library UP-TO-DATE 
:app:prepareComGoogleFirebaseFirebaseIid940Library UP-TO-DATE 
:app:prepareComHannesdorfmannMosbyMvp201Library UP-TO-DATE 
:app:prepareComHannesdorfmannMosbyMvpConductor082Library UP-TO-DATE 
:app:prepareComHannesdorfmannMosbyViewstate201Library UP-TO-DATE 
:app:prepareComHannesdorfmannMosbyViewstateConductor082Library UP-TO-DATE 
:app:prepareComJakewhartonButterknife840Library UP-TO-DATE 
:app:prepareComJakewhartonRxbindingRxbinding040Library UP-TO-DATE 
:app:prepareComJakewhartonRxbindingRxbindingAppcompatV7040Library UP-TO-DATE 
:app:prepareComJakewhartonRxbindingRxbindingDesign040Library UP-TO-DATE 
:app:prepareComJakewhartonRxbindingRxbindingRecyclerviewV7040Library UP-TO-DATE 
:app:prepareComJakewhartonRxbindingRxbindingSupportV4040Library UP-TO-DATE 
:app:prepareComJakewhartonTimberTimber431Library UP-TO-DATE 
:app:prepareComKelvinappsRxfirebase0015Library UP-TO-DATE 
:app:prepareComSquareupLeakcanaryLeakcanaryAndroid14Library UP-TO-DATE 
:app:prepareIoReactivexRxandroid121Library UP-TO-DATE 
:app:prepareDebugDependencies 
:app:compileDebugAidl UP-TO-DATE 
:app:compileDebugRenderscript UP-TO-DATE 
:app:generateDebugBuildConfig UP-TO-DATE 
:app:generateDebugResValues UP-TO-DATE 
:app:processDebugGoogleServices 
Parsing json file: /Users/leonardo/AndroidStudioProjects/Kluster/app/google-services.json 
:app:generateDebugResources 
:app:mergeDebugResources UP-TO-DATE 
:app:processDebugManifest UP-TO-DATE 
:app:processDebugResources 
:app:generateDebugSources 
:app:unzipJacocoAgent 
:app:transformClassesWithPreJackPackagedLibrariesForDebug 
:app:transformClassesWithPreJackRuntimeLibrariesForDebug 

build của tôi:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "24.0.3" 

    dexOptions { 
     maxProcessCount 2 
     javaMaxHeapSize "2g" 
    } 

    defaultConfig { 

     jackOptions { 
      enabled = true 
     } 

     applicationId "com.kluster" 
     minSdkVersion 16 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    compileOptions { 
     targetCompatibility 1.8 
     sourceCompatibility 1.8 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 


    compile 'com.facebook.stetho:stetho:1.3.1' 
    compile rootProject.ext.supportV4 
    compile rootProject.ext.supportDesign 
    compile rootProject.ext.supportAnnotations 
    compile rootProject.ext.supportAppCompat 
    compile rootProject.ext.supportRecyclerView 
    compile rootProject.ext.supportCardview 
    compile(rootProject.ext.butterknife) 
      { 
       exclude group: "com.android.support" 
      } 
    compile rootProject.ext.conductor 

    compile(rootProject.ext.easyImage) { 
     exclude group: "com.android.support" 
    } 

    compile rootProject.ext.glide 
    compile rootProject.ext.dagger 
    compile rootProject.ext.rxJava 
    compile rootProject.ext.rxAndroid 
    compile rootProject.ext.mosby 
    compile rootProject.ext.mosbyViewState 
    compile rootProject.ext.mosbyConductor 
    compile rootProject.ext.mosbyViewStateConductor 
    compile rootProject.ext.rxBinding 
    compile rootProject.ext.rxBindingV4 
    compile rootProject.ext.rxBindingV7 
    compile rootProject.ext.rxBindingDesign 
    compile rootProject.ext.rxBindingRecyclerView 
    debugCompile rootProject.ext.leakCanary 
    compile rootProject.ext.timber 

    compile rootProject.ext.firebaseAuth; 
    compile rootProject.ext.googleAuth 
    compile rootProject.ext.rxFirebase 
    compile rootProject.ext.facebook 

    provided rootProject.ext.butterknifeCompiler 
    provided rootProject.ext.daggerCompiler 
    provided rootProject.ext.javaxAnnotation 

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 


    compile 'com.android.support:appcompat-v7:24.2.1' 
    testCompile 'junit:junit:4.12' 
} 

apply plugin: 'com.google.gms.google-services' 

gradle.properties:

# Project-wide Gradle settings. 

# IDE (e.g. Android Studio) users: 
# Gradle settings configured through the IDE *will override* 
# any settings specified in this file. 

# For more details on how to configure your build environment visit 
# http://www.gradle.org/docs/current/userguide/build_environment.html 

# Specifies the JVM arguments used for the daemon process. 
# The setting is particularly useful for tweaking memory settings. 
org.gradle.jvmargs=-Xmx2048m 

# When configured, Gradle will run in incubating parallel mode. 
# This option should only be used with decoupled projects. More details, visit 
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 
# org.gradle.parallel=true 

Trước khi sử dụng Jack trình biên dịch sẽ xây dựng trong vòng chưa đầy 20s hoặc lâu hơn, điều gì có thể sai? Cảm ơn

+0

Tôi vừa gặp sự cố tương tự trên Windows. Với jack xây dựng đã> 2m, mà không cần jack nó đã ~ 11s –

+0

Điều này hút, tôi loại bỏ cũng Jack và nó làm việc ... Không biết nếu tôi nên nộp một lỗi hoặc một cái gì đó để Gooogle ... – Leonardo

+0

Tôi đã học rằng Jack đã không được phát hành như là phiên bản cuối cùng và do đó bạn phải chuẩn bị sẵn sàng cho bất kỳ lỗi nào. –

Trả lời

1

Hãy thử tăng kích thước Java Heap

dexOptions { 
    javaMaxHeapSize "4g" 
    } 

Với 16gb MacBook Pro, bạn thậm chí có thể bump nó lên đến 8g

2

Có vẻ như thế này đã được triaged acknowledged as a "Critical" bug và hy vọng các "2.4" Gradle Plugin nên mang lại cho chúng tôi thời gian xây dựng nhanh hơn :)

Không phải điều này có thể tạo ra sự khác biệt lớn, nhưng hãy thử cập nhật ứng dụng build.gradle của ứng dụng sau

android { 
    . 
    . 
    . 


    defaultConfig { 

    . 
    . 
    . 
    . 
    jackOptions { 
      enabled true 
      additionalParameters('jack.incremental': 'true') 
    } 
    . 
    . 
    } 

    dexOptions { 
     javaMaxHeapSize '4096m' 
    } 

    compileOptions { 
    incremental true 
    . 
    . 
    . 
    } 
} 
Các vấn đề liên quan