美文网首页Android深入
android-studio_gradle编译加速

android-studio_gradle编译加速

作者: 22a5d2ee8385 | 来源:发表于2017-10-26 06:10 被阅读0次
    gradle.properties
    -----------------------------------------------------------------------------------------------------------------------------------------------
    # 开启单独的Gradle守护进程
    org.gradle.daemon=true
    org.gradle.jvmargs=-Xmx1208m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
    org.gradle.parallel=true
    org.gradle.configureondemand=true
    
    # 使用gradle.cache
    org.gradle.caching = true
    -----------------------------------------------------------------------------------------------------------------------------------------------
    
    build.gradle(progect)
    -----------------------------------------------------------------------------------------------------------------------------------------------
    allprojects {
        gradle.taskGraph.whenReady {
            tasks.each { task ->
                if (task.name.contains("Test")
                        || task.name.contains("lint")
                        || task.name.equals("clean")
                        || task.name.contains("Aidl")
                        || task.name.contains("mockableAndroidJar")
                        || task.name.contains("UnitTest")
                        || task.name.contains("AndroidTest")
                        || task.name.contains("Ndk")
                        || task.name.contains("Jni")) {
                    task.enabled = false
                }
            }
        }
    }
    -----------------------------------------------------------------------------------------------------------------------------------------------
    
    build.gradle(model)
    -----------------------------------------------------------------------------------------------------------------------------------------------
    buildTypes {
            debug {
                signingConfig signingConfigs.debug   // 编译加速
                ext.alwaysUpdateBuildId = false  // 编译加速
                buildConfigField "long", "BUILD_TIMESTAMP", "000000000"  // 编译加速
            }
        }
    
        if (project.hasProperty("devBuild")) {  // 编译加速
            aaptOptions.cruncherEnabled = false  // 编译加速
        }
    
        dexOptions {          // 编译加速
            incremental true  // 编译加速
        }
    
        flavorDimensions "default"  // 编译加速
        productFlavors {  // 编译加速
            development {  // 编译加速
                minSdkVersion 21  // 编译加速
                dimension "default"  // 编译加速
                resConfigs("en", "xxhdpi")  // 编译加速
            }
            production {  // 编译加速
                dimension "default"  // 编译加速
            }
        }
    -----------------------------------------------------------------------------------------------------------------------------------------------
    

    相关文章

      网友评论

        本文标题:android-studio_gradle编译加速

        本文链接:https://www.haomeiwen.com/subject/qdlhpxtx.html