Skip to content

Commit 4ea4f1f

Browse files
authored
Protect Android native bindings from stripping (#918)
1 parent 80f53cd commit 4ea4f1f

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

android/crt/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ android {
122122
}
123123
release {
124124
minifyEnabled false
125-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
126125
versionNameSuffix ""
127126
buildConfigField("String", "VERSION_NAME", "\"" + gitVersionName() + "\"")
128127
}

android/crt/consumer-rules.pro

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Prevent shrinking and minification of aws-crt-android library
2+
-keep class software.amazon.awssdk.crt.** { *; }
3+
-keepclassmembers class software.amazon.awssdk.crt.** { *; }
4+
5+
# Keep CrtResource subclasses (native resource management)
6+
-keep class * extends software.amazon.awssdk.crt.CrtResource
7+
8+
# Keep all interfaces (callback interfaces used by native code)
9+
-keep interface software.amazon.awssdk.crt.** { *; }
10+
11+
# Keep enum methods (used by JNI)
12+
-keepclassmembers enum software.amazon.awssdk.crt.** {
13+
public static **[] values();
14+
public static ** valueOf(java.lang.String);
15+
}
16+
17+
# Keep JNI methods
18+
-keepclasseswithmembernames class * {
19+
native <methods>;
20+
}

0 commit comments

Comments
 (0)