|
18 | 18 | - [x] ✅ Capture WS/WSS Traffic from URLSessionWebSocketTask |
19 | 19 | - [x] Capture gRPC traffic (Advanced) |
20 | 20 | - [x] Support iOS Physical Devices and Simulators, including iPhone, iPad, Apple Watch, Apple TV |
| 21 | +- [x] **NEW:** Support Android with OkHttp, Retrofit, and Apollo |
21 | 22 | - [x] Review traffic log from macOS [Proxyman](https://proxyman.com) app ([Github](https://github.com/ProxymanApp/Proxyman)) |
22 | 23 | - [x] Categorize the log by project and devices. |
23 | 24 | - [x] Ready for Production |
|
29 | 30 | - If you want to use debugging tools, please use normal Proxy. |
30 | 31 |
|
31 | 32 | ## Requirement |
| 33 | + |
| 34 | +### iOS |
32 | 35 | - macOS Proxyman app |
33 | 36 | - iOS 16.0+ / macOS 11+ / Mac Catalyst 13.0+ / tvOS 13.0+ / watchOS 10.0+ |
34 | 37 | - Xcode 14+ |
35 | 38 | - Swift 5.0+ |
36 | 39 |
|
| 40 | +### Android |
| 41 | +- macOS Proxyman app |
| 42 | +- Android API 26+ (Android 8.0 Oreo) |
| 43 | +- OkHttp 4.x or 5.x |
| 44 | +- Kotlin 1.9+ |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +# iOS Integration |
| 49 | + |
37 | 50 | ## 👉 How to use |
38 | 51 | ### 1. Install Atlantis framework |
39 | 52 | ### Swift Packages Manager (Recommended) |
@@ -472,6 +485,160 @@ Atlantis.start() |
472 | 485 |
|
473 | 486 | </details> |
474 | 487 |
|
| 488 | +--- |
| 489 | + |
| 490 | +# Android Integration |
| 491 | + |
| 492 | +Atlantis for Android captures HTTP/HTTPS traffic from OkHttp (including Retrofit and Apollo) and sends it to Proxyman for debugging. |
| 493 | + |
| 494 | +## 1. Install Atlantis Android |
| 495 | + |
| 496 | +### Gradle (Kotlin DSL) |
| 497 | + |
| 498 | +Add to your app's `build.gradle.kts`: |
| 499 | + |
| 500 | +```kotlin |
| 501 | +dependencies { |
| 502 | + debugImplementation("com.proxyman:atlantis-android:1.0.0") |
| 503 | + |
| 504 | + // You must include OkHttp in your project |
| 505 | + implementation("com.squareup.okhttp3:okhttp:4.12.0") |
| 506 | +} |
| 507 | +``` |
| 508 | + |
| 509 | +### Gradle (Groovy) |
| 510 | + |
| 511 | +```groovy |
| 512 | +dependencies { |
| 513 | + debugImplementation 'com.proxyman:atlantis-android:1.0.0' |
| 514 | + implementation 'com.squareup.okhttp3:okhttp:4.12.0' |
| 515 | +} |
| 516 | +``` |
| 517 | + |
| 518 | +### JitPack (Alternative) |
| 519 | + |
| 520 | +Add JitPack repository to your `settings.gradle.kts`: |
| 521 | + |
| 522 | +```kotlin |
| 523 | +dependencyResolutionManagement { |
| 524 | + repositories { |
| 525 | + maven { url = uri("https://jitpack.io") } |
| 526 | + } |
| 527 | +} |
| 528 | +``` |
| 529 | + |
| 530 | +Then add the dependency: |
| 531 | + |
| 532 | +```kotlin |
| 533 | +debugImplementation("com.github.ProxymanApp:atlantis:1.0.0") |
| 534 | +``` |
| 535 | + |
| 536 | +## 2. Initialize Atlantis |
| 537 | + |
| 538 | +### In your Application class |
| 539 | + |
| 540 | +```kotlin |
| 541 | +import android.app.Application |
| 542 | +import com.proxyman.atlantis.Atlantis |
| 543 | + |
| 544 | +class MyApplication : Application() { |
| 545 | + override fun onCreate() { |
| 546 | + super.onCreate() |
| 547 | + |
| 548 | + // Only enable in debug builds |
| 549 | + if (BuildConfig.DEBUG) { |
| 550 | + // Simple start - discovers all Proxyman apps on network |
| 551 | + Atlantis.start(this) |
| 552 | + |
| 553 | + // Or with specific hostname (find it in Proxyman -> Certificate menu) |
| 554 | + // Atlantis.start(this, "MacBook-Pro.local") |
| 555 | + } |
| 556 | + } |
| 557 | +} |
| 558 | +``` |
| 559 | + |
| 560 | +## 3. Add Interceptor to OkHttpClient |
| 561 | + |
| 562 | +```kotlin |
| 563 | +import com.proxyman.atlantis.Atlantis |
| 564 | +import okhttp3.OkHttpClient |
| 565 | + |
| 566 | +// Create OkHttpClient with Atlantis interceptor |
| 567 | +val okHttpClient = OkHttpClient.Builder() |
| 568 | + .addInterceptor(Atlantis.getInterceptor()) |
| 569 | + .build() |
| 570 | +``` |
| 571 | + |
| 572 | +### With Retrofit |
| 573 | + |
| 574 | +```kotlin |
| 575 | +import retrofit2.Retrofit |
| 576 | +import retrofit2.converter.gson.GsonConverterFactory |
| 577 | + |
| 578 | +val retrofit = Retrofit.Builder() |
| 579 | + .baseUrl("https://api.example.com/") |
| 580 | + .client(okHttpClient) // Use the OkHttpClient with Atlantis |
| 581 | + .addConverterFactory(GsonConverterFactory.create()) |
| 582 | + .build() |
| 583 | +``` |
| 584 | + |
| 585 | +### With Apollo Kotlin |
| 586 | + |
| 587 | +```kotlin |
| 588 | +import com.apollographql.apollo3.ApolloClient |
| 589 | + |
| 590 | +val apolloClient = ApolloClient.Builder() |
| 591 | + .serverUrl("https://api.example.com/graphql") |
| 592 | + .okHttpClient(okHttpClient) // Use the OkHttpClient with Atlantis |
| 593 | + .build() |
| 594 | +``` |
| 595 | + |
| 596 | +## 4. Required Permissions |
| 597 | + |
| 598 | +Atlantis requires these permissions (automatically added by the library): |
| 599 | + |
| 600 | +```xml |
| 601 | +<uses-permission android:name="android.permission.INTERNET" /> |
| 602 | +<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| 603 | +<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| 604 | +<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> |
| 605 | +``` |
| 606 | + |
| 607 | +## 5. Start Debugging |
| 608 | + |
| 609 | +1. Open **Proxyman** on your Mac |
| 610 | +2. Make sure your Android device/emulator and Mac are on the **same Wi-Fi network** |
| 611 | + - For emulators: Atlantis automatically connects to `10.0.2.2:10909` |
| 612 | + - For physical devices: Uses Network Service Discovery (NSD/mDNS) |
| 613 | +3. Run your Android app |
| 614 | +4. All HTTP/HTTPS traffic will appear in Proxyman! |
| 615 | + |
| 616 | +## Android Sample App |
| 617 | + |
| 618 | +A sample Android app is included in `atlantis-android/sample/`. To run it: |
| 619 | + |
| 620 | +1. Open `atlantis-android/` in Android Studio |
| 621 | +2. Run the `sample` module |
| 622 | +3. Tap the buttons to make network requests |
| 623 | +4. View the traffic in Proxyman |
| 624 | + |
| 625 | +## Android Troubleshooting |
| 626 | + |
| 627 | +### Traffic not appearing in Proxyman? |
| 628 | + |
| 629 | +1. **Emulator**: Make sure Proxyman is running on your Mac. Atlantis connects to `10.0.2.2:10909`. |
| 630 | + |
| 631 | +2. **Physical device**: |
| 632 | + - Ensure both devices are on the same Wi-Fi network |
| 633 | + - Try specifying the hostname: `Atlantis.start(this, "Your-Mac.local")` |
| 634 | + |
| 635 | +3. **Check logs**: Look for `[Atlantis]` logs in Logcat for connection status. |
| 636 | + |
| 637 | +### OkHttp version compatibility |
| 638 | + |
| 639 | +Atlantis supports OkHttp 4.x and 5.x. If you're using an older version, please upgrade. |
| 640 | + |
| 641 | +--- |
475 | 642 |
|
476 | 643 | ## ❓ FAQ |
477 | 644 | #### 1. How does Atlantis work? |
|
0 commit comments