diff --git a/app/build.gradle b/app/build.gradle index b38ca869..15c9ba46 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,10 +14,15 @@ android { setProperty("archivesBaseName", "contacts") } + signingConfigs { + release + } + buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.release } } @@ -42,3 +47,22 @@ dependencies { //debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion" //releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion" } + +Properties props = new Properties() +def propFile = new File('signing.properties') +if (propFile.canRead()) { + props.load(new FileInputStream(propFile)) + + if (props != null && props.containsKey('STORE_FILE') && props.containsKey('KEY_ALIAS') && props.containsKey('PASSWORD')) { + android.signingConfigs.release.storeFile = file(props['STORE_FILE']) + android.signingConfigs.release.storePassword = props['PASSWORD'] + android.signingConfigs.release.keyAlias = props['KEY_ALIAS'] + android.signingConfigs.release.keyPassword = props['PASSWORD'] + } else { + println 'signing.properties found but some entries are missing' + android.buildTypes.release.signingConfig = null + } +} else { + println 'signing.properties not found' + android.buildTypes.release.signingConfig = null +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index e69de29b..4a58e6ee 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -0,0 +1,5 @@ +# Joda +-dontwarn org.joda.convert.** +-dontwarn org.joda.time.** +-keep class org.joda.time.** { *; } +-keep interface org.joda.time.** { *; } diff --git a/signing.properties_sample b/signing.properties_sample new file mode 100644 index 00000000..cf8e2396 --- /dev/null +++ b/signing.properties_sample @@ -0,0 +1,3 @@ +STORE_FILE=/path/to/your.keystore +KEY_ALIAS=projectkeyalias +PASSWORD=yourpass