build.gradle 1.9 KB

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