Skip to content

Commit d27936b

Browse files
authored
Merge pull request #16 from aspose-barcode/BARCODEANDROID-1189-Configure-signed-apk
Barcodeandroid 1189 configure signed apk
2 parents af01b74 + 7ee1b73 commit d27936b

5 files changed

Lines changed: 34 additions & 12 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ local.properties
1616
local.environment
1717
github.properties
1818
/.idea/
19+
/signing/generate.cmd

app/build.gradle

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ apply plugin: 'maven-publish'
33

44
project.description = 'Aspose Barcode Android Application'
55
def proguardFileName = "gradles/proguard.app.conf"
6-
//def githubProperties = new Properties()
7-
//githubProperties.load(new FileInputStream(rootProject.file("github.properties")))
86

9-
//def githubProperties = GradleAssist.readProperties("$rootDir/github.properties");
107
def githubCredentials = GradleAssist.readGitHubCredentials("$rootDir/local.environment");
118

129
publishing {
@@ -25,15 +22,17 @@ publishing {
2522
url = uri("https://maven.pkg.github.com/aspose-barcode/Barcode_Android_Application")
2623

2724
credentials {
28-
// username = githubProperties['github.user']
29-
// password = githubProperties['github.key']
3025
username = githubCredentials.userName;
3126
password = githubCredentials.password;
3227
}
3328
}
3429
}
3530
}
3631

32+
def keystorePropertiesFile = rootProject.file("keystore.properties")
33+
def keystoreProperties = new Properties()
34+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
35+
3736
android {
3837
namespace 'com.aspose.barcode.component.example'
3938
compileSdk 33
@@ -48,16 +47,34 @@ android {
4847
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
4948
}
5049

50+
signingConfigs {
51+
basic {
52+
storeFile file(keystoreProperties['storeFile'])
53+
storePassword keystoreProperties['storePassword']
54+
keyAlias keystoreProperties['keyAlias']
55+
keyPassword keystoreProperties['keyPassword']
56+
}
57+
release {
58+
storeFile file(keystoreProperties['storeFile'])
59+
storePassword keystoreProperties['storePassword']
60+
keyAlias keystoreProperties['keyAlias']
61+
keyPassword keystoreProperties['keyPassword']
62+
}
63+
}
64+
5165
buildTypes {
5266
basic {
53-
// signingConfig signingConfigs.release
67+
signingConfig signingConfigs.basic
5468
versionNameSuffix '.basic'
5569
minifyEnabled true
5670
proguardFiles "$proguardFileName"
5771
}
5872
release {
59-
minifyEnabled false
60-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
73+
signingConfig signingConfigs.release
74+
versionNameSuffix '.release'
75+
minifyEnabled true
76+
proguardFiles "$proguardFileName"
77+
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
6178
}
6279
}
6380
compileOptions {
@@ -90,9 +107,9 @@ dependencies {
90107
}
91108

92109
task copyApk(type: Copy) {
93-
from("$buildDir/outputs/apk/basic") {
94-
include("app-basic-unsigned.apk")
95-
rename("app-basic-unsigned.apk", "$apkFinalName")
110+
from("$buildDir/outputs/apk/release") {
111+
include("app-release.apk")
112+
rename("app-release.apk", "$apkFinalName")
96113
}
97114
destinationDir(file("$publishPath"))
98115
doFirst {
@@ -137,5 +154,5 @@ task clearGeneratedFiles {
137154

138155
clean.dependsOn 'clearGeneratedFiles'
139156
preBuild.dependsOn('echoBuildParameters')
140-
copyApk.dependsOn 'check'
157+
copyApk.dependsOn 'assemble'
141158
build.dependsOn 'copyApk'

keystore.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
storeFile=../signing/keystore.jks
2+
storePassword=cbD8mX3dP46TM
3+
keyAlias=apkSigningKey
4+
keyPassword=cbD8mX3dP46TM
10.2 MB
Binary file not shown.

signing/keystore.jks

2.68 KB
Binary file not shown.

0 commit comments

Comments
 (0)