android studio 创建项目的一些配置
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 创建项目的一些配置的更多相关文章
- 【Android Studio使用教程2】Android Studio创建项目
创建项目 首先,先指出Android Studio中的两个概念. Project 和 Module .在Android Studio中, Project 的真实含义是工作空间, Module 为一个具 ...
- Android Studio创建项目
创建项目 首先,先指出Android Studio中的两个概念. Project 和 Module .在Android Studio中, Project 的真实含义是工作空间, Module 为一个具 ...
- 使用Android Studio创建模拟器,安装配置Android SDK
Android Studio 一个写安卓APP应用的代码编辑器之类的?嗯,应该是... 这里只是需要用到里面的AVD Manager 创建安卓模拟器(也可以用mumu类的安卓模拟器):SDK Mana ...
- Android Studio 创建项目后“Cannot resolve symbol” 解决办法
报错位置显示 “Cannot resolve symbol XXX”, 解决方法如下: 点击菜单中的 “File” -> “Invalidate Caches / Restart”,然后点击对话 ...
- 1.1、Android Studio创建一个项目
Android Studio中的项目包含一个或多个模块.本节帮助你创建一个新的项目. 创建一个新的项目 如果你之前没有打开项目,Android Studio显示欢迎页面,通过点击Start a New ...
- [转]Android Studio创建Xposed模块项目时BridgeApi的正确添加方式
使用Android Studio创建的空项目作为Xposed Module App,对于Api Jar包的引用方式,一开始是按照傻瓜式Jar Lib的处理方式,复制XposedBridgeApi-54 ...
- Android Studio创建库项目及引用
Android Studio创建库项目其实创建的是在主项目下创建Module模块,这个Module模块创建的时候选择库项目模式. 为什么要这样处理呢?因为在Android Studio中一个WorkS ...
- Android Studio 创建/打开项目时一直处于Building“project name”Gradle project info 的解决
最近发现新版的AS,IDEA毛病不断,而且gradle的更新又给墙了,无奈啊! 进入类似如下的目录,发现如果没有对应的gradle解压文件,则在gradle官网下载完整压缩包,放入类似55xxxx串号 ...
- Android Studio向项目添加C/C++原生代码教程
说明:本文相当于官方文档的个人重新实现,官方文档链接:https://developer.android.com/studio/projects/add-native-code 向项目添加C/C++代 ...
随机推荐
- 025:为什么需要将Logger对象声明为private static final类型的
本文阅读时间大约4分钟. 参考答案 就这个问题而言,我总结了三个原因: 设置为private是为了防止其他类使用当前类的日志对象: 设置为static是为了让每个类中的日志对象只生成一份,日志对象是属 ...
- Servlet , GenericServlet和HttpServlet
Servlet是一套规范,表现为一套接口,留给开发人员去实现,Servlet接口定义如下(附加servlet-api source来查看源码) 其中init方法被Servlet容器调用,servlet ...
- IDEA编码时卡顿问题
当代码行数超过2000行,甚至更多时会出现编码时卡顿到无法编译的情况,解决方法如下: 方法1:修改IDEA配置参数 找到D:\ideaIU-2019.1.1.win\bin\idea64.exe.vm ...
- Django简介,请求生命周期,静态文件配置
Web框架 Web框架(Web framework)是一种开发框架,用来支持动态网站.网络应用和网络服务的开发.这大多数的web框架提供了一套开发和部署网站的方式,也为web行为提供了一套通用的方 ...
- mysql查询语句中使用星号真的慢的要死?
前言 之所以写这篇文章,是源于以前看过的关于sql语句优化的帖子,里面明确提到了在sql语句中不要使用 * 来做查询,就像下面的规则中说的 2.尽量避免使用select *,返回无用的字段会降低查询效 ...
- python中requests库get方法带参数请求
起因是想爬五等分的花嫁的漫画.这是其中的一个坑 先上代码 data={ 'cid':567464, , 'key':'', 'language':1, 'gtk':6, '_cid':567464, ...
- 201671010438王奕晗实验十四 团队项目评审&课程学习总结
个人学习总结博客 项目 内容 这个作业属于哪个课程 任课教师博客主页链接 这个作业的要求在哪里 作业链接地址 作业学习目标 完成个人软件心得总结 一.结合本学期课程学习内容,对比<实验一 软件工 ...
- alpha冲刺事后诸葛亮(团队)
alpha冲刺事后诸葛亮(团队) 课程名称:软件工程1916|W(福州大学) 团队名称: 云打印 作业要求: 项目Alpha冲刺(团队) 作业目标:完成Alpha冲刺的事后诸葛亮 团队队员 队员学号 ...
- maven中jar冲突解决
Maven中jar包冲突是开发过程中比较常见而又令人头疼的问题,我们需要知道 jar包冲突的原理,才能更好的去解决jar包冲突的问题.本文将从jar包冲突的原理和解决两个方面阐述Maven中jar包冲 ...
- 关键字explicit的作用(转)
C++中的explicit关键字只能用于修饰只有一个参数的类构造函数, 它的作用是表明该构造函数是显示的, 而非隐式的, 跟它相对应的另一个关键字是implicit, 意思是隐藏的,类构造函数默认情况 ...