android - 构建 Gradle Android studio 构建缓慢

标签 android performance gradle build

我使用 Android Studio 来构建我的 Android 应用程序。但我的笔记本电脑需要 5 分钟才能构建应用程序。我不知道为什么。构建 gradle 的加载速度总是太慢。这是我的代码构建 Gradle:

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

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    repositories { mavenCentral() }
    defaultConfig {
        applicationId "thsoft.com.sosme"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.wang.avi:library:1.0.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.jakewharton:disklrucache:2.0.2'
    compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
    compile 'com.squareup.okhttp:okhttp:2.5.0'
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.crittercism:crittercism-android-agent:5.5.0-rc-1'
}

你能帮我解决一下吗?谢谢!

最佳答案

gradle 代码没有任何问题,但是依赖项太多。这取决于您的处理器的速度和内存。尝试使用 8GB 内存就可以了。根据官方网站,最低要求是 4GB!!

关于android - 构建 Gradle Android studio 构建缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33886609/

相关文章:

java - 单击按钮时新 Intent 未启动

java - 在数组上调用 .length 与保存 size 变量在性能上有区别吗?

c# - 需要使用多线程,AVX,GPU或其他任何方式在C#中进行快速数据解复用

gradle - 如何使Kotlin Gradle插件不管理版本

java - 使用Gradle在Spring Boot中从环境变量设置spring.profiles.active

android - 在用户不知情的情况下用基于 cordova/phonegap 的应用程序交换现有的 native 应用程序

java - Android 数据绑定(bind) : view does not update when property is changed

android - 将图像而不是字符串标题添加到 react-native-segmented-control-tab

python - 意料之外的 Python 字典行为

android - 当我构建我的应用程序时,如果它们属于另一个模块,导入将成为未解析的引用