android - 删除 webAPI 不适用于发布模式 apk
问题描述
我已经使用 Web API 开发了一个 android 应用程序。我正在HttpDelete
通过 .NET Web API 删除一行。应用程序在调试模式下完美运行。但是当我发布签名发布模式 apk 时,该应用程序在删除 Web API 时崩溃。请为我提供解决方案。
附上安卓删除代码
private class DeleteData extends AsyncTask<Integer, Void, Void> {
@Override
protected Void doInBackground(Integer... params) {
int id = params[0];
Log.d("got id",""+id);
try {
URL url = new URL("My URL");
Log.d("URL",""+url);
HttpURLConnection httpURLConnection=(HttpURLConnection)url.openConnection();
httpURLConnection.setRequestMethod("DELETE");
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
httpURLConnection.connect();
InputStream is = httpURLConnection.getInputStream();
int byteCharacter;
String result="";
while ((byteCharacter = is.read()) != -1)
{
result += (char)byteCharacter;
}
Log.d("json api",result);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
解决方案
推荐阅读
- javascript - 更改字段条件的工具提示图标
- python - 从数据帧绘制的两条曲线之间的交点和返回点
- node.js - 如何在 $beforeUpdate 挂钩中获取整个 ObjectionJS 对象?
- excel - 如何使用 VBA 自动单击公司安全弹出窗口上的“发送”按钮
- reactjs - 使用 IIS API 实现 react redux
- java - 从 firebase 检索数据到 recyclerview
- json - FLUTTER : 将 Json 对象转换为模型
- yaml - 管道 - 如果至少一个先前的作业成功,则运行一个作业
- django - 由于 SRV 错误,MongoDB 无法在本地工作(无答案)
- python - 如何对具有同一行值的每一行进行相同的计算:零除法错误