forked from Android500/AndroidLua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
80 lines (69 loc) · 2.35 KB
/
Copy pathbuild.gradle
File metadata and controls
80 lines (69 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 18
targetSdkVersion 19
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//屏蔽gradle检测到c自己调用jni
//http://www.liuling123.com/2016/05/android-studio-gradle-ndk-config.html
sourceSets {
main {
jni.srcDirs = [] //屏蔽gradle的jni生成过程
jniLibs.srcDirs = ['src/main/jniLibs']//设置目标的so存放路径
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
////Compile JNI source via NDK
//task ndkBuild(type: Exec) {
//// def ndkDir = project.plugins.findPlugin('com.android.application').sdkHandler.getNdkFolder()
// def ndkDir = android.ndkDirectory
// //注:在mac下使用ndk-build ,在win下使用ndk-build.cmd
// //notice: in mac use /ndk-build , in win use /ndk-build.cmd
// commandLine "$ndkDir/ndk-build.cmd", '-C', 'src/main/jni',
// "NDK_OUT=$buildDir/ndk/obj",
// "NDK_APP_DST_DIR=$buildDir/ndk/libs/\$(TARGET_ARCH_ABI)"
//}
//
//task copyJniLibs(type: Copy, dependsOn:['ndkBuild']) {
// from fileTree(dir: file(buildDir.absolutePath + '/ndk/libs'), include: '**/*.so')
// into file('src/main/jniLibs')
//}
//
//tasks.withType(JavaCompile) {
// compileTask -> compileTask.dependsOn 'ndkBuild','copyJniLibs'
//}
//
//task cleanNative(type: Exec, description: 'Clean JNI object files') {
// def ndkDir = android.ndkDirectory
// commandLine "$ndkDir/ndk-build.cmd",
// '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source
// 'clean'
//}
//
//clean.dependsOn 'cleanNative'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0'
}