这是自己在项目中用到的bulid.gradle设置,有需要的可以参考一下
apply plugin: 'com.android.application' android { compileSdkVersion rootProject.ext.android.compileSdkVersion buildToolsVersion rootProject.ext.android.buildToolsVersion defaultConfig { applicationId rootProject.ext.android.applicationId minSdkVersion rootProject.ext.android.minSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion versionCode rootProject.ext.android.versionCode versionName rootProject.ext.android.versionName //启用multidex的支持 multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" //版本名后面添加一句话,意思就是flavor dimension 它的维度就是该版本号,这样维度就是都是统一的了 flavorDimensions "versionCode" /** * 当引用so文件时,部份手机会报这个错 * java.lang.UnsatisfiedLinkError: ...arm64, /vendor/lib64, /system/lib64]]] couldn't find "libstlport_shared.so"这个错误 * 原因是这部份手机是64位处理器的,所以找so的时候先从/lib/arm64, /vendor/lib64, /system/lib64这几个目录找。 * 解决方法: * 在gradle.properties加上“android.useDeprecatedNdk=true”,然后在本文的这个位置加上下面这句话“abiFilters "armeabi"” * --------------------- * 作者:冯人唐 * 来源: * 原文:https://blog.csdn.net/fengyeNom1/article/details/83304330 * 版权声明:本文为博主原创文章,转载请附上博文链接! */ ndk { abiFilters "armeabi" } } buildTypes { release { // 不显示Log buildConfigField "boolean", "LOG_DEBUG", "false" //启用混淆代码的功能 minifyEnabled false //压缩对齐生成的apk包 zipAlignEnabled true //指定混淆规则,需要压缩优化的混淆要把proguard-android.txt换成proguard-android.txt proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { //正常debug测试打开log打印 buildConfigField "boolean", "LOG_DEBUG", "true" } } //AndroidStudio,想用libs下的“.SO库”,还需要手动去指定库的位置: sourceSets { main { jniLibs.srcDirs = ['libs'] } } //禁止AS对png图片进行校验 aaptOptions { cruncherEnabled = false useNewCruncher = false } //批量打包 productFlavors { xiaomi { manifestPlaceholders = [UMENG_CHANNEL_VALUE: "xiaomi"] } } } dependencies { api project(':personlibray') api fileTree(include: ['*.jar'], dir: 'libs') api rootProject.ext.dependen["appcompat-v7"] api rootProject.ext.dependen["design"] api rootProject.ext.dependen["permission"] api rootProject.ext.dependen["recyclerview"] api rootProject.ext.dependen["kprogresshud"] api rootProject.ext.dependen["lottie"] api rootProject.ext.dependen["butterknife"] api rootProject.ext.dependen["glide"] //RecyclerView api 'cn.bingoogolapple:bga-refreshlayout:1.1.7@aar' annotationProcessor rootProject.ext.dependen["butterknife-compiler"] annotationProcessor rootProject.ext.dependen["glide_compiler"] api rootProject.ext.dependen["constraint-layout"] testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation project(':OCR') implementation project(':anrong_jilu') implementation files('libs/ysidcard.jar') }