代码之家  ›  专栏  ›  技术社区  ›  Joshua Majebi

渐变构建耗时太长太完整

  •  0
  • Joshua Majebi  · 技术社区  · 6 年前

    我的gradle构建需要9分钟才能完成。

    我尝试了很多调整和建议。

    渐变4.4

    我的项目等级如下

    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
          classpath 'com.android.tools.build:gradle:3.1.3'
          classpath 'com.google.gms:google-services:3.3.1'
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    apply plugin: 'com.android.application'
    
    android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = false
        maxProcessCount 8
    }
    defaultConfig {
        applicationId "com.teamnifi.nifi"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner   "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
    
    }
    
    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:support-vector-drawable:26.1.0'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
    implementation 'io.reactivex:rxandroid:1.2.0'
    implementation 'io.reactivex:rxjava:1.1.8'
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.okhttp3:okhttp:3.8.1'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    implementation 'com.android.support:preference-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    
    implementation 'com.squareup.picasso:picasso:2.5.2'
    
    implementation 'com.github.nkzawa:socket.io-client:0.3.0'
    
    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    
    implementation 'org.greenrobot:eventbus:3.1.1'
    
    implementation "com.andkulikov:transitionseverywhere:1.8.0"
    
    testImplementation 'junit:junit:4.12'
    
    android {
        configurations.all {
            resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
        }
    }
    
    }
    
    apply plugin: 'com.google.gms.google-services'   
    

    我的gradle项目属性如下

       # 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=-Xmx4608m
    
    # 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
    

    在“渐变”下的“设置”中选择“脱机工作”。 我试过关闭它,然后同步,然后再打开,然后构建

    最新版本的输出如下所示,在设置中打开脱机工作。

       Executing tasks: [clean, :app:generateDebugSources,     :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
    
     Parallel execution with configuration on demand is an incubating feature.
    Could not find google-services.json while looking in [src/nullnull/debug,   src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
    registerResGeneratingTask is deprecated, use       registerGeneratedResFolders(FileCollection)
    Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
    registerResGeneratingTask is deprecated, use   registerGeneratedResFolders(FileCollection)
    :clean UP-TO-DATE
    :app:clean
    :app:preBuild UP-TO-DATE
    :app:preDebugBuild
    :app:compileDebugAidl
    :app:compileDebugRenderscript
    :app:checkDebugManifest
    :app:generateDebugBuildConfig
    :app:prepareLintJar UP-TO-DATE
    :app:mainApkListPersistenceDebug
    :app:generateDebugResValues
    :app:generateDebugResources
    :app:processDebugGoogleServices
    Parsing json file: C:\Users\Josh\AndroidStudioProjects\NIFI\app\google-services.json
    :app:mergeDebugResources
    :app:createDebugCompatibleScreenManifests
    :app:processDebugManifest
    :app:splitsDiscoveryTaskDebug
    :app:processDebugResources
    :app:generateDebugSources
    :app:preDebugAndroidTestBuild
    :app:compileDebugAndroidTestAidl
    :app:processDebugAndroidTestManifest
    :app:compileDebugAndroidTestRenderscript
    :app:generateDebugAndroidTestBuildConfig
    :app:mainApkListPersistenceDebugAndroidTest
    :app:generateDebugAndroidTestResValues
    :app:generateDebugAndroidTestResources
    :app:mergeDebugAndroidTestResources
    :app:processDebugAndroidTestResources
    :app:generateDebugAndroidTestSources
    :app:mockableAndroidJar
    
    BUILD SUCCESSFUL in 9m 44s
    26 actionable tasks: 24 executed, 2 up-to-date
    

    我的gradle同步也需要超过15分钟才能完成。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Joshua Majebi    6 年前

    所以问题是我的系统上有一堆病毒和恶意软件。在我的系统上运行了一次启动时扫描之后,我运行了构建,现在它又回到了运行一分钟的状态。