build.gradle 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. defaultConfig {
  12. if (buildAsApplication) {
  13. applicationId "org.tirnanog.app"
  14. }
  15. minSdkVersion 16
  16. targetSdkVersion 26
  17. versionCode 1
  18. versionName "1.0"
  19. externalNativeBuild {
  20. ndkBuild {
  21. arguments "APP_PLATFORM=android-16"
  22. abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  23. }
  24. // cmake {
  25. // arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
  26. // // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  27. // abiFilters 'arm64-v8a'
  28. // }
  29. }
  30. }
  31. buildTypes {
  32. release {
  33. minifyEnabled false
  34. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  35. }
  36. }
  37. if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
  38. sourceSets.main {
  39. jniLibs.srcDir 'libs'
  40. }
  41. externalNativeBuild {
  42. ndkBuild {
  43. path 'jni/Android.mk'
  44. }
  45. // cmake {
  46. // path 'jni/CMakeLists.txt'
  47. // }
  48. }
  49. }
  50. lintOptions {
  51. abortOnError false
  52. }
  53. if (buildAsLibrary) {
  54. libraryVariants.all { variant ->
  55. variant.outputs.each { output ->
  56. def outputFile = output.outputFile
  57. if (outputFile != null && outputFile.name.endsWith(".aar")) {
  58. def fileName = "org.libsdl.app.aar";
  59. output.outputFile = new File(outputFile.parent, fileName);
  60. }
  61. }
  62. }
  63. }
  64. }
  65. dependencies {
  66. implementation fileTree(include: ['*.jar'], dir: 'libs')
  67. }