tuningfork icon indicating copy to clipboard operation
tuningfork copied to clipboard

Monitoring App doesn't work due to "Cleartext HTTP traffic to localhost not permitted" error

Open bilck opened this issue 4 years ago • 0 comments

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:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
	<!-- Reference: https://forum.unity.com/threads/android-9-cleartext-http-traffic-to-my_ip-not-permitted.594298/#post-7215685 -->          
    <domain-config cleartextTrafficPermitted="true">
		<!-- For Android Performance Tuner data monitoring application https://developer.android.com/codelabs/android-performance-tuner-unity?hl=pt-br#7 -->
        <domain includeSubdomains="false">localhost</domain>
    </domain-config>
</network-security-config>

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, 

bilck avatar Oct 01 '21 14:10 bilck