When I build my app and try connecting to my API through (http://ip_address/8080/) am getting this error "There was a networking error in the connection to http://ip_address:8080/". But from my IDE is working perfectly. What could be the problem and can it be sorted out. Kindly help
Asked
Active
Viewed 85 times
1 Answers
2
Android 9 stopped working on HTTP by default, it supports HTTPS only. To enable HTTP, use the build hint:
android.xapplication_attr=android:usesCleartextTraffic="true"
Reference: https://stackoverflow.com/a/57130188
Also iOS doesn't support HTTP by default. To enable HTTP, use the build hint:
ios.plistInject=<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict>
Reference: https://www.codenameone.com/blog/ios-http-urls.html

Francesco Galgani
- 6,137
- 3
- 20
- 23
-
Kindly how do I do it kindly? – Marko Mulwa Feb 25 '20 at 10:54
-
You can set these hints by right clicking the project in the IDE and selecting Codename One → Codename One Settings → Build Hints. The hints use the key=value style of data. More information: https://www.codenameone.com/manual/advanced-topics.html#_sending_arguments_to_the_build_server – Francesco Galgani Feb 25 '20 at 18:00
-
So in this case what is our key and value? – Marko Mulwa Feb 25 '20 at 18:41
-
`android.xapplication_attr` is a key, `android:usesCleartextTraffic="true"` is its value. `ios.plistInject` is a key, `
NSAppTransportSecurity ` is its value. However simply copy and paste the build hints as I reported them in the answer. – Francesco Galgani Feb 25 '20 at 18:50NSAllowsArbitraryLoads -
These are build hints. You need to open the Codename One Settings/Preferences application and go to the build hints section within the app – Shai Almog Feb 26 '20 at 02:24