起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2083|回复: 1

[处理中3] 如何设置gradle 的build script?

[复制链接]

2

主题

4

帖子

18

积分

新手上路

Rank: 1

积分
18
QQ
发表于 2017-7-29 10:29:10 | 显示全部楼层 |阅读模式
Wex5用gradle编译java,如何设置gradle的build script。例如把这段代码加到build.gradle中

apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.ttlock"
        minSdkVersion 18
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            // 设置支持的 SO 库构架
            abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'//, 'mips', 'mips64'
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    //添加本地仓库,并把libs目录作为仓库地址
    repositories {
        flatDir {
            dirs 'libs'
        }
    }
}

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

    //greenDao
    compile 'org.greenrobot:greendao:3.1.1'

    compile 'org.greenrobot:greendao-generator-encryption:2.2.0'
    compile 'net.zetetic:android-database-sqlcipher:3.4.0'

    compile 'com.squareup.okhttp3khttp:3.4.1'

    compile 'com.google.code.gson:gson:2.7'
    compile 'com.jakewharton:butterknife:8.4.0'
    apt 'com.jakewharton:butterknife-compiler:8.4.0'
}

31

主题

1856

帖子

3070

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3070
发表于 2017-7-29 13:29:15 | 显示全部楼层
这个文件不建议修改,你原始意图是想做什么?如果是引入第三方库,建议基于cordova插件方式
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2025-7-9 18:13 , Processed in 0.056250 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表