diff --git a/android/app/build.gradle b/android/app/build.gradle index 4d08364..53619d7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -93,6 +93,21 @@ def myAppUploadStorePassword = System.getenv("MYAPP_UPLOAD_STORE_PASSWORD") def myAppUploadKeyAlias = System.getenv("MYAPP_UPLOAD_KEY_ALIAS") def myAppUploadKeyPassword = System.getenv("MYAPP_UPLOAD_KEY_PASSWORD") +task readPackageJson { + doLast { + def packageJson = new groovy.json.JsonSlurper().parseText(file('package.json').text) + project.ext { + versionFromPackageJson = packageJson.version + versionCodeFromPackageJson = packageJson.versionCode + } + } +} + +preBuild.dependsOn readPackageJson + +version = project.versionFromPackageJson +versionCode = project.versionCodeFromPackageJson + android { ndkVersion rootProject.ext.ndkVersion @@ -103,8 +118,8 @@ android { applicationId "com.opticarbu" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 6 - versionName "0.0.1" + versionCode versionCode + versionName version } aaptOptions { cruncherEnabled = false @@ -119,25 +134,23 @@ android { } } signingConfigs { - // debug { - // storeFile file('debug.keystore') - // storePassword 'android' - // keyAlias 'androiddebugkey' - // keyPassword 'android' - // } + debug { + storeFile file('debug.keystore') + storePassword 'android' + keyAlias 'androiddebugkey' + keyPassword 'android' + } release { - // if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) { storeFile file(myAppUploadStoreFile) storePassword myAppUploadStorePassword keyAlias myAppUploadKeyAlias keyPassword myAppUploadKeyPassword - // } } } buildTypes { - // debug { - // signingConfig signingConfigs.debug - // } + debug { + signingConfig signingConfigs.debug + } release { ndk { debugSymbolLevel 'FULL'