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++代 ...
随机推荐
- Android源码分析(七)-----如何解决java编译版本问题
一 : 问题描述 Your version is: java version "1.6.0_31" Java(TM) SE Runtime Environment (build 1 ...
- HBase的部署与其它相关组件(Hive和Phoenix)的集成
HBase的部署与其它相关组件(Hive和Phoenix)的集成 一.HBase部署 1.1.Zookeeper正常部署 首先保证Zookeeper集群的正常部署,并启动之: /opt/module/ ...
- RabbitMQ的使用Demo
rabbitmq消息队列,官网有六种,实战常用的也就如下五种. 下面开始demo讲解 大致三步:1.配置消息队列,2.生产者提供消息给队列,3.消费者监听消费队列消息 源码下载:https://pan ...
- 浅谈原子操作、volatile、CPU执行顺序
浅谈原子操作.volatile.CPU执行顺序 在计算机发展的鸿蒙年代,程序都是顺序执行,编译器也只是简单地翻译指令,随着硬件和软件的飞速增长,原来的工具和硬件渐渐地力不从心,也逐渐涌现出各路大神在原 ...
- Flask 开启多进程或多线程
2018-07-15 23:31:20 yang9315 阅读数 7703更多 分类专栏: python 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接 ...
- OneDrive,在云端
应用场景 1.一份文档下班后还没编辑好,发送到自己的QQ/微信回家后继续编辑: 2.由于来回拷贝同一份文件,导致版本太多,忘记那个是最新版本了: 3.出门在外,客户突然需要一份重要文档,这份文件放在办 ...
- PAT 乙级 1004.成绩排名 C++/Java
1004 成绩排名 (20 分) 题目来源 读入 n(>)名学生的姓名.学号.成绩,分别输出成绩最高和成绩最低学生的姓名和学号. 输入格式: 每个测试输入包含 1 个测试用例,格式为 第 1 行 ...
- 斐波那契数性质 gcd(F[n],F[m])=F[gcd(n,m)]
引理1 结论: \[F(n)=F(m)F(n-m+1)+F(m-1)F(n-m)\] 推导: \[ \begin{aligned} F(n) &= F(n-1)+F(n-2) \\ & ...
- IDEA 中 Git Commit message 编写
IDEA安装插件 Git Commit Template 1. HeaderHeader的部分只有一行,包括三个字段: type(必需), scope(可选), subject(必需) 对应到idea ...
- ajax jsonp函数调用
jsonp数据 jsonpHandler({name:"liujinyu",age:"24"}) ajax调用 $.ajax({ type:'GET', ...