123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- apply plugin: 'com.android.library'
- android {
- compileSdkVersion 28
- buildToolsVersion '28.0.3'
- defaultConfig {
- minSdkVersion 19
- targetSdkVersion 28
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- externalNativeBuild {
- cmake {
- arguments '-DANDROID_TOOLCHAIN=clang'
- }
- }
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- externalNativeBuild {
- cmake {
- path "src/main/cpp/CMakeLists.txt"
- }
- }
- }
- dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:28.0.0'
- testImplementation 'junit:junit:4.13'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
- androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- }
- // 生成 jar 包并修改名字
- task makeJar(type: Copy) {
- // 删除已经存在的 jar 包,如果有的话
- delete 'build/libs/SerialPort.jar'
- // 从该目录下加载要打包的文件,注意文件夹名称有可能为 default,也可能是 release
- from('build/intermediates/bundles/release/')
- // jar 包的保存目录
- into('build/libs/')
- // 设置过滤,只打包classes文件
- include('classes.jar')
- // 重命名 jar 包
- rename('classes.jar', 'SerialPort.jar')
- }
- makeJar.dependsOn(build)
|