Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Sources/SwiftJavaDocumentation/Documentation.docc/Android.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# Android
# Android

## R8/Proguard Rules

Since swift-java uses JNI and reflection APIs, we must tell the R8 optimizer to ignore our wrapped types,
otherwise we will run into runtime crashes, because types are stripped from the APK/AAR.

The `SwiftKit` Java library already contains a [Proguard consumer file](https://developer.anbdroid.com/topic/performance/app-optimization/library-optimization),
which is automatically detected by R8, so any `org.swift.swiftkit` types are already ignored.
However, you must still provide rules for your own types.

For example, if your library is named is `org.swift.exampleapp`, then add the following rules to your proguard file:

```
-keep class org.swift.exampleapp.** { *; }
-keep interface org.swift.exampleapp.** { *; }
```

## Android Core Library Desugaring

Expand Down
Loading