Monitoring App doesn't work due to "Cleartext HTTP traffic to localhost not permitted" error
- Dominant language
- C#
- Stars
- 62
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
I'm having issues using the monitoring app, I'm getting the following error: `java.io.IOException: Cleartext HTTP traffic to localhost not permitted`
I have already added `android:usesCleartextTraffic="true"` to the main AndroidManifest.xml file. I have also added `android:networkSecurityConfig="@xml/network_security_config"` to it.
**Assets/Plugins/Android/res/xml/network_security_config.xml** file content is:
```
localhost
```
What am I doing wrong?
Even though I performed all these steps, I still get the following error:
```
2021/10/01 11:25:37.125 26048 30167 Info Unity [PlotAndroidPerformanceTunerStarter] Telemetry uploaded with request name: applications/com.explot.gouda/apks/32
2021/10/01 11:25:37.524 26048 30167 Info Unity [AndroidNotificationsPlatform.OnLocalNotificationReceived] Received notification with null AndroidNotificationIntentData, skipping this.
2021/10/01 11:25:38.070 26048 1288 Info TuningFork:Web Connecting to: http://localhost:9000/applications/com.explot.gouda/apks/32:uploadTelemetry
2021/10/01 11:25:38.074 26048 1288 Info System.out (HTTPLog)-Static: isSBSettingEnabled false
2021/10/01 11:25:38.074 26048 1288 Warn TuningFork:Web java.io.IOException: Cleartext HTTP traffic to localhost not permitted
2021/10/01 11:25:38.075 26048 1288 Warn TuningFork.GE Error 15 when sending UPLOAD request
2021/10/01 11:25:38.075 26048 1288 Warn TuningFork.GE {"name": "applications/com.explot.gouda/apks/32", "session_context": {"device": {"brand": "samsung", "build_version": "30", "cpu_core_freqs_hz": [2210000000, 2210000000, 2210000000, 2210000000, 2808000000, 2808000000, 2808000000, 2912000000], "device": "t2s", "fingerprint": "samsung/t2sxxx/t2s:11/RP1A.200720.012/G996BXXU3AUHB:user/release-keys", "gles_version": {"major": 3, "minor": 2}, "model": "SM-G996B", "product": "t2sxxx", "total_memory_bytes": 7536852992}, "game_sdk_info": {"session_id": "3258a3df-f798-46a0-b8bb-201ad3e01a79", "swappy_version": "1.3.0", "version": "1.3.11"}, "time_period": {"end_time": "2021-10-01T14:25:36.983966Z", "start_time": "2021-10-01T14:22:38.222980Z"}}, "telemetry": [{"context": {"annotations": "", "duration": "298.397631671s", "tuning_parameters": {"experiment_id": "", "serialized_fidelity_parameters": ""}}, "report": {"battery": {"battery_event": [{"app_on_foreground": false, "charging": true, "current_charge_microampere_hours": 4156025,
```
Contributor guide
Research direction
Start with Assets/Plugins/Android/res/xml/network_security_config.xml and the main AndroidManifest.xml settings described in the report, then inspect the Android build output used by the monitoring app. Reproduce the TuningFork request to http://localhost:9000 and verify that the built app permits the intended cleartext connection without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, unity
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100