androidstudio-ndk-so库-debug签名配置-项目根目录下和app目录下的完整build.gradle示例
项目根目录下 build.gradle示例
//apply plugin: 'android-library'
//apply plugin: 'com.android.application' 这里不能要
buildscript {
// compileSdkVersion 26 这里不能要
repositories {
// 如果有新的库引入,尽量把慢的放在后面
// 前4个推荐的 jitpack.io
mavenLocal()
mavenCentral()
jcenter()
google()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://repo1.maven.org/maven2/' }
maven { url "https://jitpack.io" }
jcenter { url "http://jcenter.bintray.com/" }
maven { url 'http://repo.jfrog.org/artifactory/gradle-plugins' }
maven { url "http://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/central/' }
// 如果有新的库引入,尽量把慢的放在后面
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
//classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
// 如果有新的库引入,尽量把慢的放在后面
// 前4个推荐的 jitpack.io
mavenLocal()
mavenCentral()
jcenter()
google()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://repo1.maven.org/maven2/' }
maven { url "https://jitpack.io" }
jcenter { url "http://jcenter.bintray.com/" }
maven { url 'http://repo.jfrog.org/artifactory/gradle-plugins' }
maven { url "http://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/central/' }
// 如果有新的库引入,尽量把慢的放在后面
}
}
//task clean(type: Delete) {
// delete rootProject.buildDir
//}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
app目录下 build.gradle示例 (配置)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
//buildToolsVersion '26.0.2'
compileOptions {
encoding "UTF-8"
}
defaultConfig {
applicationId "cn.aotusoft.jianantong"
minSdkVersion 15
targetSdkVersion 21
// versionCode 1 这里的设置优先级高于AndroidManifest.xml中的
// versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
//选择要添加的对应cpu类型的.so库。
abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a', 'x86', 'x86_64', 'mips', 'mips64'
}
}
sourceSets {//so文件加载 必须这样写 不在libs文件夹下
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
//处理 DexIndexOverflowException: Cannot merge new index 70035 into a non-jumbo instruction!
jumboMode = true
javaMaxHeapSize "4g"
preDexLibraries = false
threadCount = 8 //加快编译1
}
signingConfigs {
debug {//98d65c343c1a3a90dca568127a3ca3af //来自eclipse的默认debug.keystore签名 默认密码是android
storeFile file("./../debug.keystore") //如果在app文件中 直接传debug.keystore即可
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
//另外自定义签名 https://blog.csdn.net/nimasike/article/details/51457229
}
// release {//发布版本的签名配置 签名类型v1
// storeFile file("./../AotusoftAndroidRelease.keystore")
// keyAlias 'aotusoftandroidapp'
// keyPassword ''
// storePassword ''
// }
}
aaptOptions {//加快编译2
cruncherEnabled false
}
lintOptions {
checkReleaseBuilds false //--------------这样打包特别快, 添加这个是因为国际化的en有点问题
abortOnError false
}
// aaptOptions.cruncherEnabled = false
//
// aaptOptions.useNewCruncher = false
//报错 More than one file was found with OS independent path 'META-INF/DEPENDENCIES'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
configurations.all {//处理com.android.support:support-v4:21.0.3 和test包的27.1.1兼容
resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
//resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
//一般创建项目记得添加v4 和 v7包
compile 'com.android.support:support-v4:21.0.3'
implementation 'com.android.support:appcompat-v7:21.0.3'
//要排除 jar中v4
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//Apache HttpClient 20180623 江节胜 新增
//noinspection DuplicatePlatformClasses
compile 'org.apache.httpcomponents:httpclient:4.5.5'
//三个原始eclipse 依赖库 开始
//江节胜的git仓库
implementation 'com.github.androidlibraries:ImageLoader:1.0.5'
implementation 'com.github.androidlibraries:ColorDialogLib:1.0.5'
implementation 'com.github.androidlibraries:PhotoSelector:1.0.2'
//implementation project(':ImageLoader')
//implementation project(':ColorDialogLib')
//implementation project(':PhotoSelector')
//三个原始eclipse 依赖库 结束
}
正文到此结束
- 本文标签: AndriodStudio 安卓
- 本文链接: https://code.jiangjiesheng.cn/article/184
- 版权声明: 本文由小江同学原创发布,转载请先联系本站长,谢谢。