![](/img/trans.png)
[英]Why my (android) phonegap app works on debug mode but not on release mode?
[英]Httpclient not works in release mode but works in debug mode in xamarin android
Httpclient在發布模式下不起作用,但在xamarin android中的調試模式下起作用。 我也嘗試過restsharp,但是沒有運氣
以下是我嘗試過的代碼
LoginViewModel Login = new LoginViewModel();
Login.Username = "admin@gmail.com";
Login.Password = "111111";
Login.Usertype = "D";
var httpClient = new HttpClient();
var json = JsonConvert.SerializeObject(Login);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await httpClient.PostAsync("http://api.confervo.com/api/Account/Login", content);
Toast.MakeText(this, response.Content + "", ToastLength.Long).Show();
我也遇到過同樣的問題,並使用以下代碼修復了該問題,希望這對您有所幫助
<uses-permission android:name="android.permission.INTERNET" />
<application
android:usesCleartextTraffic="true" tools:targetApi="28">
...
</application>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.