我已经使用Web API开发了一个Android应用。我正在通过.NET Web API使用HttpDelete
删除一行。应用在调试模式下运行完美。但是,当我发布签名发布模式apk时,该应用在删除Web API时崩溃。
请为我提供解决方案。
附加要删除的android代码
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;
}
}