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. BBC评出的100本最具影响力经典书籍

    今年,英国广播公司(BBC)邀请全球35个国家共108名文化人士,参与其发起的“影响思维和历史的100部虚构故事”的推荐,要求每人最多提名 5 部作品,这些作品最终将根据提名总量排名. 该活动经过一个 ...

  2. SQL 乐色干货笔记

    因为公司基本都是用存储过程所以本来写的干货基本都是存储过程的. SELECT TOP 1 Code,Invitation,Num,Typ FROM SignLog WITH(NOLOCK) WHERE ...

  3. wordpress下一篇next_post_link函数的使用方法

    我们在用wordpress开发时经常会用到上一篇下一篇的功能,<?php previous_post_link('%link') ?> <?php next_post_link('% ...

  4. try catch 小结 , node的回调callback里不能捕获异常 , 不能被v8优化(现在能了),

    <深入浅出Nodejs>时,在第四章 - 异步编程中作者朴灵曾提到,异步编程的难点之一是异常处理,书中描述"尝试对异步方法进行try/catch操作只能捕获当次事件循环内的异常, ...

  5. 封装好的cookie的三个常用函数 cookie的添加、删除、提取操作函数

    function addCookie(name,value,expiresHours){   //添加一个cookie.  三个参数:cookie的名称.值.有效时间(为0时,关闭浏览器cookie消 ...

  6. 滚动加载|页面滑到底部加载数据|jquery.endless-scroll插件|使用demo

    <html> <head> <link rel="dns-prefetch" href="http://i.tq121.com.cn&quo ...

  7. Generative Adversarial Networks overview(4)

    Libo1575899134@outlook.com Libo (原创文章,转发请注明作者) 本文章主要介绍Gan的应用篇,3,主要介绍图像应用,4, 主要介绍文本以及医药化学其他领域应用 原理篇请看 ...

  8. 准确率(Accuracy) 精确率(Precision) 与 召回率(Recall)

    准确率(Accuracy)—— 针对整个模型 精确率(Precision) 灵敏度(Sensitivity):就是召回率(Recall) 参考:https://blog.csdn.net/Orange ...

  9. Linux输入输出重定向练习

    1.date >> 123 date > 123 2.abc 2>123 abc 2>>123 abc 2>/dev/null  标准输出重定向到回收站 3. ...

  10. 7-zip命令行详解

    一.简介 7z,全称7-Zip, 是一款开源软件.是目前公认的压缩比例最大的压缩解压软件. 主要特征: # 全新的LZMA算法加大了7z格式的压缩比 # 支持格式: * 压缩 / 解压缩:7z, XZ ...