|
45 | 45 | Add the dependency in your `build.gradle`: |
46 | 46 |
|
47 | 47 | ```gradle |
48 | | -debugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.2.0' |
49 | | -releaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.2.0' |
| 48 | +debugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.5.0' |
| 49 | +releaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0..0' |
50 | 50 | ``` |
51 | 51 |
|
52 | 52 | > 💡 Always use the latest version from the [GitHub Releases](https://github.com/Husseinhj/LogTap/releases). |
@@ -93,6 +93,56 @@ http://<device-ip>:8790/ |
93 | 93 | > |
94 | 94 | > (If you don't see the IP, ensure your app has `ACCESS_NETWORK_STATE` or LogTap will fall back to best-effort interface detection.) |
95 | 95 |
|
| 96 | +### Multiple apps at once (auto‑port increment) |
| 97 | +
|
| 98 | +If you run LogTap from **multiple apps on the same device** at the same time, LogTap will automatically try the next port when the base port is busy. By default it starts at **8790**; if that’s taken, it tries **8791**, **8792**, and so on until it finds a free port (a small, bounded range). |
| 99 | +
|
| 100 | +You’ll see the chosen address printed to **Logcat** when the server is ready, for example: |
| 101 | +
|
| 102 | +``` |
| 103 | +… I LogTap server ready at http://192.168.178.66:8790/ |
| 104 | +… I LogTap server ready at http://192.168.178.66:8791/ |
| 105 | +``` |
| 106 | +
|
| 107 | +> Tip: You can also **pick different base ports** per app to avoid clashes entirely. |
| 108 | +
|
| 109 | +#### Example |
| 110 | +
|
| 111 | +**App A** – use default base port (8790): |
| 112 | +```kotlin |
| 113 | +class AppA : Application() { |
| 114 | + override fun onCreate() { |
| 115 | + super.onCreate() |
| 116 | + LogTap.start(this) // tries 8790, then 8791, ... if needed |
| 117 | + } |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +**App B** – set an explicit base port (e.g., 8795): |
| 122 | +```kotlin |
| 123 | +class AppB : Application() { |
| 124 | + override fun onCreate() { |
| 125 | + super.onCreate() |
| 126 | + LogTap.start( |
| 127 | + this, |
| 128 | + LogTap.Config( |
| 129 | + port = 8795, // base port; LogTap will auto‑increment if 8795 is in use |
| 130 | + capacity = 5000 |
| 131 | + ) |
| 132 | + ) |
| 133 | + } |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +Then open in your browser from the same network: |
| 138 | + |
| 139 | +``` |
| 140 | +http://<device-ip>:8790/ // App A |
| 141 | +http://<device-ip>:8791/ // App A (if 8790 was busy) |
| 142 | +http://<device-ip>:8795/ // App B |
| 143 | +http://<device-ip>:8796/ // App B (if 8795 was busy) |
| 144 | +``` |
| 145 | + |
96 | 146 | ### 5. Advanced: Automatic Logcat collection |
97 | 147 |
|
98 | 148 | For more settings and to automatically collect logs from Android's logger, you can use `LogTapLogcatBridge` together with a `LogTapSinkAdapter`: |
@@ -129,8 +179,8 @@ You can restrict LogTap only to a specific build flavor (e.g., `dev`) by declari |
129 | 179 |
|
130 | 180 | ```gradle |
131 | 181 | dependencies { |
132 | | - devDebugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.2.0' |
133 | | - devReleaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.2.0' |
| 182 | + devDebugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.5.0' |
| 183 | + devReleaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.5.0' |
134 | 184 | } |
135 | 185 | ``` |
136 | 186 |
|
@@ -158,9 +208,9 @@ android { |
158 | 208 | - If you want the library only in the `dev` flavor, keep: |
159 | 209 |
|
160 | 210 | ```gradle |
161 | | -devDebugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.2.0' |
| 211 | +devDebugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.5.0' |
162 | 212 | // (Optional) If you also build devRelease, use the noop artifact there: |
163 | | -devReleaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.2.0' |
| 213 | +devReleaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.5.0' |
164 | 214 | ``` |
165 | 215 |
|
166 | 216 | - If you prefer **no dependency at all** on release variants (including prod/staging), **do not** add a release dependency. We’ll provide **stubs** instead. |
|
0 commit comments