简体   繁体   English

Gradle Build花费的时间太长,太完整了

[英]Gradle Build taking too long too complete

My gradle build is taking over 9 minutes to complete. 我的gradle版本需要9分钟以上才能完成。

It was taking about less than a minute before which was ok. 大约不到一分钟就可以了。 I dont know what went wrong. 我不知道出了什么问题。

I have tried a lot of adjustments and recommendations. 我尝试了很多调整和建议。

Gradle 4.4 摇篮4.4

my project level gradle is as follows 我的项目级别gradle如下

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
}

My app gradle build file is as follows 我的应用程序gradle构建文件如下

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'   

And my gradle project properties is as follows 我的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

Offline work is selected in settings under gradle. 在gradle下的设置中选择了离线工作。 i have tried turning that off and syncing then turning it back on and building 我试图关闭它并同步然后重新打开并构建

The output off the latest build is as follows with offline work on in settings. 最新版本的输出如下,并在设置中进行脱机工作。

   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

My gradle sync also takes over 15 minutes to complete. 我的gradle同步也需要15分钟以上才能完成。

All the while i have another project in android studio that runs normally and takes significantly less time to sync and build. 一直以来,我在android studio中都有另一个项目,该项目可以正常运行,并且花费更少的时间进行同步和构建。

So the problem was a bunch of viruses and malware on my system. 因此问题出在我的系统上,是一堆病毒和恶意软件。 After running a boot time scan on my system i ran the build and now its back to taking a minute to run. 在我的系统上运行启动时间扫描后,我运行了构建,现在运行需要一分钟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM