Skip to content

Commit 7e64e9b

Browse files
authored
Android 16 KB page size support (#650)
* changes related to Android 16 KB page size support
1 parent e6ad5e9 commit 7e64e9b

File tree

11 files changed

+116
-44
lines changed

11 files changed

+116
-44
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,18 @@ jobs:
290290
uses: actions/checkout@v2
291291
with:
292292
submodules: true
293-
# Setup JDK 11
294-
- name: set up JDK 11
295-
uses: actions/setup-java@v3.14.1
293+
# Setup JDK 17
294+
- name: set up JDK 17
295+
uses: actions/setup-java@v4
296296
with:
297-
java-version: '11'
297+
java-version: '17'
298298
distribution: 'temurin'
299299
cache: 'gradle'
300+
# Ensure Gradle uses this JDK (important when toolchains are present)
301+
- name: Point Gradle at JDK 17
302+
run: echo "ORG_GRADLE_JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
303+
- name: Mirror ANDROID_HOME → ANDROID_SDK_ROOT
304+
run: echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> "$GITHUB_ENV"
300305
- name: Configure AWS credentials for Device Farm
301306
uses: aws-actions/configure-aws-credentials@v2
302307
with:
@@ -314,6 +319,21 @@ jobs:
314319
cd sdk/tests/android/testapp/src/main/assets
315320
python3 -m pip install boto3
316321
python3 ./android_file_creation.py
322+
323+
- name: Set Android keystore home
324+
run: |
325+
echo "ANDROID_SDK_HOME=$GITHUB_WORKSPACE/.android-home" >> "$GITHUB_ENV"
326+
echo "ANDROID_PREFS_ROOT=$GITHUB_WORKSPACE/.android-home" >> "$GITHUB_ENV"
327+
mkdir -p "$GITHUB_WORKSPACE/.android-home/.android"
328+
- name: Create debug keystore
329+
run: |
330+
keytool -genkeypair \
331+
-keystore "$ANDROID_SDK_HOME/.android/debug.keystore" \
332+
-storepass android -keypass android \
333+
-alias androiddebugkey \
334+
-dname "CN=Android Debug,O=Android,C=US" \
335+
-keyalg RSA -keysize 2048 -validity 14000
336+
317337
- name: Build Test App
318338
run: |
319339
cd sdk/tests/android/testapp

android/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ buildscript {
66
mavenCentral()
77
}
88
dependencies {
9-
classpath "com.android.tools.build:gradle:7.1.2"
9+
// AGP 8.5.1+ aligns uncompressed .so at 16KB automatically
10+
// Requires JDK 17+
11+
classpath "com.android.tools.build:gradle:8.5.1"
1012

1113
// NOTE: Do not place your application dependencies here; they belong
1214
// in the individual module build.gradle files
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

android/iotdevicesdk/build.gradle

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,33 @@ ext {
4343
}
4444

4545
android {
46-
compileSdkVersion 30
47-
buildToolsVersion "30.0.3"
46+
namespace "software.amazon.awssdk.iotdevicesdk" // REQUIRED on AGP 8+
47+
48+
compileSdkVersion 35
4849

4950
defaultConfig {
5051
minSdkVersion 24
51-
targetSdkVersion 30
52+
targetSdkVersion 33
5253
versionCode = gitVersionCode()
5354
versionName = gitVersionName()
5455
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
5556
consumerProguardFiles 'consumer-rules.pro'
57+
58+
aarMetadata {
59+
// Keeps from referencing newer resources/manifest attributes introduced after 30
60+
minCompileSdk = 30
61+
}
62+
}
63+
64+
buildFeatures {
65+
// AGP 8 disables buildConfig generation by default. We set this to true
66+
// to resstore BuildConfig.VERSION_NAME for both debug and release build types.
67+
buildConfig true
68+
}
69+
70+
// Make the 'release' SoftwareComponent available for publishing on AGP 8
71+
publishing {
72+
singleVariant("release") { withSourcesJar() }
5673
}
5774

5875
sourceSets {
@@ -97,7 +114,7 @@ repositories {
97114
}
98115

99116
dependencies {
100-
api 'software.amazon.awssdk.crt:aws-crt-android:0.38.7'
117+
api 'software.amazon.awssdk.crt:aws-crt-android:0.38.11'
101118
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
102119
implementation 'org.slf4j:slf4j-api:1.7.30'
103120
implementation 'com.google.code.gson:gson:2.9.0'
@@ -145,7 +162,10 @@ afterEvaluate {
145162

146163
publications {
147164
release(MavenPublication) {
148-
from components.release
165+
def comp = components.findByName("release")
166+
if (comp != null) {
167+
from comp
168+
}
149169

150170
groupId = 'software.amazon.awssdk.iotdevicesdk'
151171
artifactId = 'aws-iot-device-sdk-android'

documents/ANDROID.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ a dependency of the aws-iot-device-sdk-android library.
3434
## Installation
3535

3636
### Minimum requirements
37-
* Java 11+ ([Download and Install Java](https://www.java.com/en/download/help/download_options.html))
37+
* Java 17+ ([Download and Install Java](https://www.java.com/en/download/help/download_options.html))
3838
* [Set JAVA_HOME](./PREREQUISITES.md#set-java_home)
39-
* Gradle 7.4.2 ([Download and Install Gradle](https://gradle.org/install/))
39+
* Gradle 8.5.1+ ([Download and Install Gradle](https://gradle.org/install/))
4040
* Android SDK 24 ([Download SDK Manager](https://developer.android.com/tools/releases/platform-tools#downloads))
4141
* [Set ANDROID_HOME](./PREREQUISITES.md#set-android_home)
4242

samples/Android/app/build.gradle

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath "com.android.tools.build:gradle:7.1.2"
7+
classpath "com.android.tools.build:gradle:8.5.1"
88
}
99
}
1010

@@ -17,19 +17,38 @@ repositories {
1717
apply plugin: 'com.android.application'
1818

1919
android {
20-
compileSdkVersion 30
21-
buildToolsVersion "30.0.3"
20+
namespace "software.amazon.awssdk.iotsamples"
21+
compileSdk 35
2222

2323
defaultConfig {
2424
applicationId "software.amazon.awssdk.iotsamples"
2525
minSdkVersion 24
26-
targetSdkVersion 30
26+
targetSdkVersion 33
2727
versionCode 1
2828
versionName "1.0"
2929

3030
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3131
}
3232

33+
// Make sure JNI libs are packaged UNCOMPRESSED (so AGP can align them)
34+
packagingOptions {
35+
jniLibs {
36+
useLegacyPackaging false
37+
}
38+
}
39+
40+
buildFeatures {
41+
buildConfig true
42+
}
43+
44+
publishing {
45+
// Creates the 'release' SoftwareComponent used by maven-publish
46+
singleVariant("release") {
47+
withSourcesJar()
48+
}
49+
// If you also need debug: singleVariant("debug")
50+
}
51+
3352
sourceSets {
3453
main {
3554
java.srcDir '../../Utils/CommandLineUtils'
Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="software.amazon.awssdk.iotsamples">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

5-
<application
6-
android:allowBackup="true"
7-
android:icon="@mipmap/ic_launcher"
8-
android:label="@string/app_name"
9-
android:roundIcon="@mipmap/ic_launcher_round"
10-
android:supportsRtl="true"
11-
android:theme="@style/AppTheme">
12-
<activity android:name=".MainActivity">
13-
<intent-filter>
14-
<action android:name="android.intent.action.MAIN" />
4+
<application
5+
android:allowBackup="true"
6+
android:label="@string/app_name"
7+
android:supportsRtl="true">
158

16-
<category android:name="android.intent.category.LAUNCHER" />
17-
</intent-filter>
18-
</activity>
19-
</application>
9+
<activity
10+
android:name="software.amazon.awssdk.iotsamples.MainActivity"
11+
android:exported="true">
12+
<intent-filter>
13+
<action android:name="android.intent.action.MAIN" />
14+
<category android:name="android.intent.category.LAUNCHER" />
15+
</intent-filter>
16+
</activity>
2017

18+
</application>
2119
</manifest>

samples/Android/app/src/main/java/software/amazon/awssdk/iotsamples/MainActivity.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,16 @@ protected void onCreate(Bundle savedInstanceState) {
105105

106106
sampleSelect = findViewById(R.id.sampleSelect);
107107
ArrayAdapter<String> samplesAdapter = new ArrayAdapter<>(
108-
this, R.layout.support_simple_spinner_dropdown_item, SAMPLES.keySet().toArray(new String[0])
108+
this,
109+
android.R.layout.simple_spinner_dropdown_item,
110+
SAMPLES.keySet().toArray(new String[0])
109111
);
112+
samplesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
110113
sampleSelect.setAdapter(samplesAdapter);
111114
sampleSelect.setOnItemSelectedListener(this);
112115

116+
117+
113118
loadAssets();
114119
context = this;
115120
}

sdk/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<dependency>
6161
<groupId>software.amazon.awssdk.crt</groupId>
6262
<artifactId>aws-crt</artifactId>
63-
<version>0.38.7</version>
63+
<version>0.38.11</version>
6464
</dependency>
6565
<dependency>
6666
<groupId>org.slf4j</groupId>

sdk/tests/android/testapp/build.gradle

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
buildscript {
2-
ext.kotlin_version = '1.5.0'
2+
ext.kotlin_version = '1.9.24'
33
repositories {
44
google()
55
mavenCentral()
66
}
77
dependencies {
8-
classpath "com.android.tools.build:gradle:7.1.2"
8+
classpath "com.android.tools.build:gradle:8.5.1"
99
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1010
}
1111
}
@@ -22,8 +22,8 @@ apply plugin: 'com.android.application'
2222
apply plugin: 'kotlin-android'
2323

2424
android {
25-
compileSdkVersion 30
26-
buildToolsVersion "30.0.3"
25+
namespace "software.amazon.awssdk.iottest" // required on AGP 8+
26+
compileSdkVersion 35
2727

2828
defaultConfig {
2929
applicationId "software.amazon.awssdk.iottest"
@@ -54,9 +54,17 @@ android {
5454
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
5555
}
5656
}
57+
58+
packagingOptions { jniLibs { useLegacyPackaging false } }
59+
5760
compileOptions {
5861
sourceCompatibility = 1.8
5962
targetCompatibility = 1.8
63+
coreLibraryDesugaringEnabled true
64+
}
65+
66+
kotlinOptions {
67+
jvmTarget = "1.8"
6068
}
6169
}
6270

@@ -68,6 +76,7 @@ dependencies {
6876
implementation 'androidx.core:core:1.2.0'
6977
implementation 'androidx.core:core-ktx:1.2.0'
7078
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
79+
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
7180

7281
testImplementation 'junit:junit:4.13'
7382

0 commit comments

Comments
 (0)