android studio生成junitLibs

时间:2024-11-22 23:33:38
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "25.0.0"

sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}

defaultConfig {
applicationId "com.lt.bottomtabdemo"
minSdkVersion 9
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.android.support:support-v4:25.0.1'
testCompile 'junit:junit:4.12'

}

默认android studio的defaultConfig节点在android节点内部,将defaultConfig节点提出来放外面,然后在android节点里面增加sourceSets节点。然后在dependencies里面增加编译代码testCompile 'junit:junit:4.12'