Skip to content

Commit

Permalink
multiDexEnabled & proguard rules added; closes HMS-Core#18.
Browse files Browse the repository at this point in the history
  • Loading branch information
syslogic committed Jan 14, 2023
1 parent 215bb5c commit 3818f3f
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 13 deletions.
29 changes: 23 additions & 6 deletions java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}

signingConfigs {
debug {}
debug {
storeFile new File("${System.properties['user.home']}${File.separator}.android${File.separator}debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
storeFile file("xxx.xxx")
storePassword "xxxxxx"
Expand All @@ -25,15 +32,24 @@ android {
v2SigningEnabled true
}
}

buildTypes {
debug {
signingConfig signingConfigs.debug
minifyEnabled false
}
release {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.release
minifyEnabled true
}
debug {
// signingConfig signingConfigs.debug
minifyEnabled false
shrinkResources true
testCoverageEnabled false
zipAlignEnabled true
pseudoLocalesEnabled false
renderscriptDebuggable false
minifyEnabled true
jniDebuggable false
debuggable false
proguardFile "${project.rootDir}/huawei.pro"
}
}

Expand All @@ -56,6 +72,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar'])
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.huawei.hms:maps:6.8.1.301'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'

Expand Down
5 changes: 3 additions & 2 deletions java/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
Expand Down
5 changes: 5 additions & 0 deletions java/app/src/main/res/raw/keep.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off,@layout/upsdk*"
tools:shrinkMode="strict" />
Empty file added java/huawei.pro
Empty file.
20 changes: 17 additions & 3 deletions kotlin/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}

signingConfigs {
debug {
storeFile new File("${System.properties['user.home']}${File.separator}.android${File.separator}debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
storeFile file("xxx.xxx")
Expand All @@ -28,15 +33,24 @@ android {
v2SigningEnabled true
}
}

buildTypes {
debug {
// signingConfig signingConfigs.debug
signingConfig signingConfigs.debug
minifyEnabled false
}
release {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
testCoverageEnabled false
zipAlignEnabled true
pseudoLocalesEnabled false
renderscriptDebuggable false
minifyEnabled true
jniDebuggable false
debuggable false
proguardFile "${project.rootDir}/huawei.pro"
}
}

Expand All @@ -47,7 +61,6 @@ android {
variant.outputs.all {
outputFileName = fileName
}

}

compileOptions {
Expand All @@ -59,6 +72,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar'])
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.huawei.hms:maps:6.8.1.301'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
//noinspection GradleDependency
Expand Down
5 changes: 3 additions & 2 deletions kotlin/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
Expand Down
5 changes: 5 additions & 0 deletions kotlin/app/src/main/res/raw/keep.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off,@layout/upsdk*"
tools:shrinkMode="strict" />
2 changes: 2 additions & 0 deletions kotlin/huawei.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-sdk-config-obfuscation-scripts-0000001061882229

0 comments on commit 3818f3f

Please sign in to comment.