build.gradle文件
 apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao' // 使用greenDAO def static releaseTime() {//获取当前时间
return new Date().format("MMdd", TimeZone.getTimeZone("UTC"))
}
android {
compileSdkVersion project.ext.compileSdkVersion//引用统一配置
buildToolsVersion '28.0.3' compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8//支持java8
targetCompatibility JavaVersion.VERSION_1_8
} defaultConfig {
applicationId "xx.xx.xx"
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode 24
versionName "1.0.9.4" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk { // 设置支持的SO库架构
abiFilters 'armeabi-v7a' //设置支持的arm架构
} vectorDrawables.useSupportLibrary = true//是否使用svg } signingConfigs {//使用签名文件
debug {
storeFile file('xx.jks')
storePassword "xxxx"
keyAlias "xxxx"
keyPassword "xxxx"
} release {
storeFile file('xxx.jks')
storePassword "xxx"
keyAlias "xxx"
keyPassword "xxxx"
}
} buildTypes {//打包命名
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "isNative", "false"
applicationVariants.all { variant ->
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
outputFileName = "${defaultConfig.versionName}.apk"
}
}
}
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "isNative", "true"
applicationVariants.all { variant ->
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
outputFileName = "${defaultConfig.versionName}_${versionNameSuffix}.apk"
}
}
}
versionNameSuffix "_debug_${releaseTime()}"
}
} flavorDimensions "api" productFlavors {//个性化配置
dev {
dimension "api"
buildConfigField "String", "BaseURL", '"http://192.168.10.175:3201"'
buildConfigField "String", "APIURL", '"http://192.168.10.175:3201"'
buildConfigField "String", "MQTT_SERVER", '"tcp://192.168.25.209:1883"' } normal {
dimension "api"
buildConfigField "String", "BaseURL", '"http://xxxx.com.cn"'
buildConfigField "String", "APIURL", '"http://xxxx.com.cn"'
buildConfigField "String", "MQTT_SERVER", '"ssl://xxxxx.com.cn:8883"'
}
} sourceSets {//jniLib目录支持app/libs
main.jniLibs.srcDirs = ['libs']
} lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
} } greendao {
schemaVersion 4
daoPackage 'ai.yunji.delivery.greendao.gen'
targetGenDir 'src/main/java'
} repositories {
flatDir {
dirs 'libs'
}
} dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation "com.android.support:appcompat-v7:${supportLibVersion}"
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
// implementation 'org.glassfish.tyrus.bundles:tyrus-standalone-client:1.5'
// implementation('edu.wpi.rail:jrosbridge:0.2.0') {
// exclude group: 'org.glassfish.grizzly'
// exclude group: 'org.glassfish.tyrus'
// }
//log相关
implementation 'com.tencent.bugly:crashreport:latest.release'
//其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如2.1.9
implementation 'com.tencent.bugly:nativecrashreport:latest.release'
//其中latest.release指代最新Bugly NDK版本号,也可以指定明确的版本号,例如3.0
implementation 'com.trello.rxlifecycle2:rxlifecycle:2.1.0'
implementation 'com.trello.rxlifecycle2:rxlifecycle-android:2.1.0'
implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.1.0'
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.3@aar'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation "com.android.support:design:${supportLibVersion}"
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// implementation 'com.github.bumptech.glide:glide:4.7.1'
// annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation "com.android.support:recyclerview-v7:${supportLibVersion}"
// implementation 'com.jcodecraeer:xrecyclerview:1.5.9'
// implementation 'com.orhanobut:logger:2.2.0'
implementation 'com.elvishew:xlog:1.4.0'
implementation 'org.greenrobot:eventbus:3.0.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.3'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.zhy:okhttputils:2.6.2'
//greenDao
implementation 'org.greenrobot:greendao:3.1.0'
//logger
// implementation 'com.orhanobut:logger:2.2.0' implementation 'com.squareup.retrofit2:retrofit:2.4.0'
// Retrofit库
implementation('com.squareup.retrofit2:converter-gson:2.1.0') {
exclude group: 'com.google.code.gson', module: 'gson'
}
implementation 'com.alibaba:fastjson:1.2.58'
implementation 'com.belerweb:pinyin4j:2.5.1' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.1' debugImplementation 'com.amitshekhar.android:debug-db:1.0.3'
implementation project(path: ':logger')
// implementation project(path: ':Water') configurations {
all*.exclude group: 'com.google.code.gson'
} }

项目的build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
google()//如果网络不好,可以使用阿里服务器的镜像地址
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.novoda:bintray-release:0.8.0'
// classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1-rc1' //GreanDao
classpath 'org.greenrobot:greendao-gradle-plugin:3.1.0'
}
}/*
ext { compileSdkVersion = 27
buildToolsVersion = '27.0.3'
minSdkVersion = 14
targetSdkVersion = 27
supportLibraryVersion = '27.0.2'
versionCode = 113
versionName = "1.1.3"
}*/ ext {
minSdkVersion = 8
targetSdkVersion = 27
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
} ext.deps = [
junit : 'junit:junit:4.12',
truth : 'com.google.truth:truth:0.28',
robolectric : 'org.robolectric:robolectric:3.3',
mockito : "org.mockito:mockito-core:2.8.9",
json : "org.json:json:20160810",
supportAnnotations: "com.android.support:support-annotations:27.1.0",
] subprojects {
apply from: "${rootProject.rootDir}/common_config.gradle"
}
allprojects {
repositories {
google()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
jcenter()
mavenCentral()
}
} task clean(type: Delete) {
delete rootProject.buildDir
}

gradle.properties

android.injected.testOnly=false#一般情况下debug包给用户是安装不了的,因为打包的时候会自动在androidmenifest.xml中添加testOnly=true,这种情况下只能使用adb install -t xxx.apk安装,如果加这句话就不会影响安装了

android studio 创建项目的一些配置的更多相关文章

  1. 【Android Studio使用教程2】Android Studio创建项目

    创建项目 首先,先指出Android Studio中的两个概念. Project 和 Module .在Android Studio中, Project 的真实含义是工作空间, Module 为一个具 ...

  2. Android Studio创建项目

    创建项目 首先,先指出Android Studio中的两个概念. Project 和 Module .在Android Studio中, Project 的真实含义是工作空间, Module 为一个具 ...

  3. 使用Android Studio创建模拟器,安装配置Android SDK

    Android Studio 一个写安卓APP应用的代码编辑器之类的?嗯,应该是... 这里只是需要用到里面的AVD Manager 创建安卓模拟器(也可以用mumu类的安卓模拟器):SDK Mana ...

  4. Android Studio 创建项目后“Cannot resolve symbol” 解决办法

    报错位置显示 “Cannot resolve symbol XXX”, 解决方法如下: 点击菜单中的 “File” -> “Invalidate Caches / Restart”,然后点击对话 ...

  5. 1.1、Android Studio创建一个项目

    Android Studio中的项目包含一个或多个模块.本节帮助你创建一个新的项目. 创建一个新的项目 如果你之前没有打开项目,Android Studio显示欢迎页面,通过点击Start a New ...

  6. [转]Android Studio创建Xposed模块项目时BridgeApi的正确添加方式

    使用Android Studio创建的空项目作为Xposed Module App,对于Api Jar包的引用方式,一开始是按照傻瓜式Jar Lib的处理方式,复制XposedBridgeApi-54 ...

  7. Android Studio创建库项目及引用

    Android Studio创建库项目其实创建的是在主项目下创建Module模块,这个Module模块创建的时候选择库项目模式. 为什么要这样处理呢?因为在Android Studio中一个WorkS ...

  8. Android Studio 创建/打开项目时一直处于Building“project name”Gradle project info 的解决

    最近发现新版的AS,IDEA毛病不断,而且gradle的更新又给墙了,无奈啊! 进入类似如下的目录,发现如果没有对应的gradle解压文件,则在gradle官网下载完整压缩包,放入类似55xxxx串号 ...

  9. Android Studio向项目添加C/C++原生代码教程

    说明:本文相当于官方文档的个人重新实现,官方文档链接:https://developer.android.com/studio/projects/add-native-code 向项目添加C/C++代 ...

随机推荐

  1. redis-Jedis连接集群

    关闭防火墙或把端口加入防火墙 一.通过代码 @Test public void testJedisCluster() throws Exception { //创建一连接,JedisCluster对象 ...

  2. 详解CentOS6.7部署Tomcat及主配置文件

    Java程序实现部署及应用 POSIX :可移植操作系统,编程操作系统接口规范,实现跨平台编译运行. API:应用程序编程接口 ABI:应用程序二进制接口 描述了应用程序和操作系统之间,一个应用和它的 ...

  3. 【解决】Error: ENOSPC: no space left on device, watch

    发现问题: 启动 node 项目ReactNative时候出现报错Error: ENOSPC: no space left on device, watch [root@iz2zeihk6kfcls5 ...

  4. (七)Kubernetes Service资源

    Service概述 为什么要使用Service Kubernetes Pod是平凡的,由Deployment等控制器管理的Pod对象都是有生命周期的,它们会被创建,也会意外挂掉.虽然它们可以由控制器自 ...

  5. SQL注入中的WAF绕过

    1.大小写绕过 这个大家都很熟悉,对于一些太垃圾的WAF效果显著,比如拦截了union,那就使用Union UnIoN等等绕过. 2.简单编码绕过 比如WAF检测关键字,那么我们让他检测不到就可以了. ...

  6. 32、MySQL简介

    一.MySQL简介 1.数据库管理软件分类 主要分为关系型和非关系型. 可以简单的理解为,关系型数据库需要有表结构,非关系型数据库是key-value存储的,没有表结构. 关系型:如sqllite,d ...

  7. 【Java】SpringBoot-Ajax-Json:Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported for @RequestBody XXX

    1.重新组装数据 var params=JSON.stringify({"userword":XXXXX,"password":"XXXXX" ...

  8. curl多线程下载类

    <?php /** * curl多线程下载类 */class MultiHttpRequest{ public $urls = array (); private $res = array () ...

  9. HTTP协议通信过程

    1. 了解HTTP HTTP(HyperText Transfer Protocol)是一套计算机通过网络进行通信的规则.计算机专家设计出HTTP,使HTTP客户(如Web浏览器)能够从HTTP服务器 ...

  10. ent 基本使用十五 一个图遍历的例子

    以下是来自官方的一个user group pet 的查询demo 参考关系图 环境准备 docker-compose mysql 环境 version: "3" services: ...