build.gradle 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
  2. def buildAsApplication = !buildAsLibrary
  3. if (buildAsApplication) {
  4. apply plugin: 'com.android.application'
  5. }
  6. else {
  7. apply plugin: 'com.android.library'
  8. }
  9. android {
  10. compileSdkVersion 26
  11. buildToolsVersion "26.0.1"
  12. defaultConfig {
  13. if (buildAsApplication) {
  14. applicationId "org.libsdl.app"
  15. }
  16. minSdkVersion 14
  17. targetSdkVersion 26
  18. versionCode 1
  19. versionName "1.0"
  20. externalNativeBuild {
  21. ndkBuild {
  22. arguments "APP_PLATFORM=android-14"
  23. abiFilters 'armeabi-v7a', 'x86'
  24. }
  25. }
  26. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  27. }
  28. buildTypes {
  29. release {
  30. minifyEnabled false
  31. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  32. }
  33. }
  34. if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
  35. sourceSets.main {
  36. jniLibs.srcDir 'libs'
  37. }
  38. externalNativeBuild {
  39. ndkBuild {
  40. path 'jni/Android.mk'
  41. }
  42. }
  43. }
  44. lintOptions {
  45. abortOnError false
  46. }
  47. if (buildAsLibrary) {
  48. libraryVariants.all { variant ->
  49. variant.outputs.each { output ->
  50. def outputFile = output.outputFile
  51. if (outputFile != null && outputFile.name.endsWith(".aar")) {
  52. def fileName = "org.libsdl.app.aar";
  53. output.outputFile = new File(outputFile.parent, fileName);
  54. }
  55. }
  56. }
  57. }
  58. }
  59. dependencies {
  60. compile fileTree(include: ['*.jar'], dir: 'libs')
  61. androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
  62. exclude group: 'com.android.support', module: 'support-annotations'
  63. })
  64. testCompile 'junit:junit:4.12'
  65. }