Gradle相关配置

本文介绍了一个具体的Android项目的构建配置文件内容,包括编译SDK版本、构建工具版本、默认配置、依赖项等,并提供了关于混淆、签名配置及NDK配置的相关信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.geng.hello"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        // 在buildConfig.java中自动配置常量字段
        buildConfigField('String', "API_DEBUG_URL", '"http://test.baidu.com"')

        // 开启multidex,突破64k
        multiDexEnabled true

        // ndk cpu架构,生成相应的so包
        ndk{
            abiFilter 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
        }
    }

    // 渠道
    productFlavors {
    }

    signingConfigs {
        relase {
            storeFile file("relase.keystore")
            keyAlias "relase"
            keyPassword "123456"
            storePassword "123456"
        }
        debug {
        }
    }

    buildTypes {
        release {
            // 混淆开启
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
            // 4byte对齐,加快解析效率
            zipAlignEnabled true
            // 移除无用的资源文件
            shrinkResources true
            // 更改包名
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    output.outputFile = new File(output.outputFile.parent,
                            "debug_" + buildTime() + ".apk")
                }
            }
        }
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0'
}



// --------------------------------gradle.properties配置------------------------------

// 加速构建速度
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2048m

// 使用ndk配置
android.useDeprecatedNdk=true


// 其他:
1.查看 keystore 文件的签名信息:

在keystore所在目录下,打开cmd:
keytool -list -v -keystore keystore文件名

再根据提示,输入storepassword即可查看

2.混淆:
https://segmentfault.com/a/1190000004461614
http://www.mayflyask.org/question/247
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值