Hi. I'm trying to learn how turbo-android should work, so I cloned this repo and the turbo-native-demo repo. I was able to start the android app on an emulator and it loaded the content from the official site. Perfect :)
Then I made this change to hook it up with my local clone of turbo-native-demo:
diff --git a/demo/src/main/kotlin/dev/hotwire/turbo/demo/util/Constants.kt b/demo/src/main/kotlin/dev/hotwire/turbo/
demo/util/Constants.kt
index 1be473e..dfdabb3 100644
--- a/demo/src/main/kotlin/dev/hotwire/turbo/demo/util/Constants.kt
+++ b/demo/src/main/kotlin/dev/hotwire/turbo/demo/util/Constants.kt
@@ -1,6 +1,6 @@
package dev.hotwire.turbo.demo.util
-const val BASE_URL = "https://turbo-native-demo.glitch.me"
+const val BASE_URL = "http://10.0.2.2:45678"
const val HOME_URL = BASE_URL
const val SIGN_IN_URL = "$BASE_URL/signin"
const val NUMBERS_URL = "$BASE_URL/numbers"
Unfortunately it did not work. I checked loading the local server from a browser on the emulator and it loaded everything, so I opened up adb logcat to investigate what's happening and found this pattern:
Finally I found that the error description is net::ERR_CLEARTEXT_NOT_PERMITTED which could happen if you try to load an unencrypted plain text without the proper permissions (docs). I added the missing permission to the debug build type and it fixed it immediately. (I don't think we should add this permission to the release build type to encourage a more secure setup in the demo app.)
I hope this PR helps others to become familiar with this cool project easier :)
Hi. I'm trying to learn how turbo-android should work, so I cloned this repo and the turbo-native-demo repo. I was able to start the android app on an emulator and it loaded the content from the official site. Perfect :)
Then I made this change to hook it up with my local clone of
turbo-native-demo
:Unfortunately it did not work. I checked loading the local server from a browser on the emulator and it loaded everything, so I opened up
adb logcat
to investigate what's happening and found this pattern:Finally I found that the error description is
net::ERR_CLEARTEXT_NOT_PERMITTED
which could happen if you try to load an unencrypted plain text without the proper permissions (docs). I added the missing permission to the debug build type and it fixed it immediately. (I don't think we should add this permission to the release build type to encourage a more secure setup in the demo app.)I hope this PR helps others to become familiar with this cool project easier :)