build.gradle 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. apply plugin: 'com.android.application'
  2. android {
  3. namespace "io.ionic.starter"
  4. compileSdk rootProject.ext.compileSdkVersion
  5. defaultConfig {
  6. applicationId "io.ionic.starter"
  7. minSdkVersion rootProject.ext.minSdkVersion
  8. targetSdkVersion rootProject.ext.targetSdkVersion
  9. versionCode 1
  10. versionName "1.0"
  11. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  12. aaptOptions {
  13. // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
  14. // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
  15. ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
  16. }
  17. }
  18. signingConfigs {
  19. //签名信息
  20. release {
  21. keyAlias System.getenv('KEY_ALIAS') ?: 'my-key-alias'
  22. keyPassword System.getenv('KEY_PASSWORD') ?: '12345678'
  23. storeFile file(System.getenv('KEYSTORE_PATH') ?: '../my-release-key.keystore')
  24. storePassword System.getenv('STORE_PASSWORD') ?: '12345678'
  25. }
  26. }
  27. buildTypes {
  28. release {
  29. minifyEnabled false
  30. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  31. signingConfig signingConfigs.release
  32. }
  33. }
  34. }
  35. repositories {
  36. flatDir{
  37. dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
  38. }
  39. }
  40. dependencies {
  41. implementation fileTree(include: ['*.jar'], dir: 'libs')
  42. implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
  43. implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
  44. implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
  45. implementation project(':capacitor-android')
  46. testImplementation "junit:junit:$junitVersion"
  47. androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
  48. androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
  49. implementation project(':capacitor-cordova-android-plugins')
  50. }
  51. apply from: 'capacitor.build.gradle'
  52. try {
  53. def servicesJSON = file('google-services.json')
  54. if (servicesJSON.text) {
  55. apply plugin: 'com.google.gms.google-services'
  56. }
  57. } catch(Exception e) {
  58. logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
  59. }