在我的模擬器上,我可以使用 get/post 請求,一切正常。但是當我部署它并在我的 android 手機上嘗試時 - 似乎什么也沒發生。
我的清單包含:
<uses-permission android:name="android.permission.INTERNET" />
..
<application..
android:networkSecurityConfig="@xml/network_security_config"
>
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
res檔案夾下的xml檔案:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<!-- For React Native Hot-reloading system -->
<!-- If you are running on a device insert your computer IP -->
<domain includeSubdomains="true">localhost</domain>
<domain includeSubdomains="true">mydomain.herokuapp.com</domain>
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</domain-config>
<base-config cleartextTrafficPermitted="false" />
</network-security-config>
我到處尋找,但無法正常作業。
我必須提到,在嘗試進行登錄身份驗證之前,我確實應用了 post/get 呼叫,它們運行良好。但是登錄有問題。它正在我的模擬器上運行。
請如果您有任何線索或可以提供幫助,這將挽救生命!
(我在 mongodb 中有所有 IP 的白名單,所以那里沒有問題)。
*我嘗試使用 Axios 和其他請求方法,但它們都不能在設備上運行。
是因為我試圖運行 app-debug.apk 嗎?或者它與此無關
我錯過了什么?
uj5u.com熱心網友回復:
我認為您已經在除錯模式下構建了您的 apk。嘗試在發布模式下構建它。
如何為 Android 生成 React Native Release 構建 APK
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/441676.html
