build.gradle 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ext {
  2. androidxActivityVersion = project.hasProperty('androidxActivityVersion') ? rootProject.ext.androidxActivityVersion : '1.7.0'
  3. androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
  4. androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.2.0'
  5. androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.10.0'
  6. androidxFragmentVersion = project.hasProperty('androidxFragmentVersion') ? rootProject.ext.androidxFragmentVersion : '1.5.6'
  7. androidxWebkitVersion = project.hasProperty('androidxWebkitVersion') ? rootProject.ext.androidxWebkitVersion : '1.6.1'
  8. junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
  9. androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
  10. androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
  11. cordovaAndroidVersion = project.hasProperty('cordovaAndroidVersion') ? rootProject.ext.cordovaAndroidVersion : '10.1.1'
  12. }
  13. buildscript {
  14. ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
  15. repositories {
  16. google()
  17. mavenCentral()
  18. maven {
  19. url "https://plugins.gradle.org/m2/"
  20. }
  21. }
  22. dependencies {
  23. classpath 'com.android.tools.build:gradle:8.0.0'
  24. if (System.getenv("CAP_PUBLISH") == "true") {
  25. classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
  26. }
  27. }
  28. }
  29. tasks.withType(Javadoc).all { enabled = false }
  30. apply plugin: 'com.android.library'
  31. if (System.getenv("CAP_PUBLISH") == "true") {
  32. apply plugin: 'io.github.gradle-nexus.publish-plugin'
  33. apply from: file('../scripts/publish-root.gradle')
  34. apply from: file('../scripts/publish-module.gradle')
  35. }
  36. android {
  37. namespace "com.getcapacitor.android"
  38. compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
  39. defaultConfig {
  40. minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
  41. targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
  42. versionCode 1
  43. versionName "1.0"
  44. consumerProguardFiles 'proguard-rules.pro'
  45. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  46. }
  47. buildTypes {
  48. release {
  49. minifyEnabled false
  50. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  51. }
  52. }
  53. lintOptions {
  54. baseline file("lint-baseline.xml")
  55. abortOnError true
  56. warningsAsErrors true
  57. lintConfig file('lint.xml')
  58. }
  59. compileOptions {
  60. sourceCompatibility JavaVersion.VERSION_17
  61. targetCompatibility JavaVersion.VERSION_17
  62. }
  63. publishing {
  64. singleVariant("release")
  65. }
  66. }
  67. repositories {
  68. google()
  69. mavenCentral()
  70. }
  71. dependencies {
  72. implementation fileTree(dir: 'libs', include: ['*.jar'])
  73. implementation platform("org.jetbrains.kotlin:kotlin-bom:$kotlin_version")
  74. implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
  75. implementation "androidx.core:core:$androidxCoreVersion"
  76. implementation "androidx.activity:activity:$androidxActivityVersion"
  77. implementation "androidx.fragment:fragment:$androidxFragmentVersion"
  78. implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
  79. implementation "androidx.webkit:webkit:$androidxWebkitVersion"
  80. testImplementation "junit:junit:$junitVersion"
  81. androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
  82. androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
  83. implementation "org.apache.cordova:framework:$cordovaAndroidVersion"
  84. testImplementation 'org.json:json:20231013'
  85. testImplementation 'org.mockito:mockito-inline:5.2.0'
  86. }