gpt4 book ai didi

android - Android SlowGradleBuild

转载 作者:行者123 更新时间:2023-12-03 05:46:16 26 4
gpt4 key购买 nike

您好,在AndroidStudio + Kotlin中进行更新后,我的gradle需要5分钟以上的时间。 gradle Sync进行得很快,但是gradle构建将永远加载。

这是我的build.gradle:

Apply插件:'com.android.application'

Apply插件:'kotlin-android'

请检查以下代码,并提供任何建议以帮助我。

android {

compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "myApp"
minSdkVersion 20
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}


buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { res.srcDirs = ['src/main/res', 'src/main/res/fonts'] } }
}

dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.jkcclemens:khttp:0.1.0'
implementation 'com.github.devlight:infinitecycleviewpager:1.0.2'
implementation 'com.github.kittinunf.fuel:fuel:1.12.1'
implementation ('com.yarolegovich:discrete-scrollview:1.3.0') {
transitive = false

}
implementation 'com.amazonaws:aws-android-sdk-s3:2.6.18'
implementation 'com.github.whalemare:sheetmenu:1.3.3'
implementation 'com.amazonaws:aws-android-sdk-core:2.6.18'

implementation ('com.squareup.picasso:picasso:2.5.2'){
transitive = false

}


}

allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
repositories {
mavenCentral()
}

最佳答案

如果您增加了项目中的堆大小,这可能是解决方案:

为了加快构建速度,请将Gradle守护程序的最大堆大小增加到至少4608 MB(基于dexOptions.javaMaxHeapSize = 4g)。 (这是示例大小,您的可能会有所不同)

为此,请在项目gradle.properties中设置org.gradle.jvmargs = -Xmx4608M。

有关更多信息,请参见https://docs.gradle.org/current/userguide/build_environment.html

关于android - Android SlowGradleBuild,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50023648/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com