如何克服错误“DEBUG_TAG无法解析为变量”

问题描述 投票:-3回答:1

这是我在eclipse中的代码:它正在尝试建立与URL的连接

URL url = new URL(dataString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000 /* milliseconds */);
conn.setConnectTimeout(15000 /* milliseconds */);
conn.setRequestMethod("GET");
conn.setDoInput(true);
conn.connect();
int response = conn.getResponseCode();
Log.d(DEBUG_TAG, "The response is: " + response);

最后一行给出了一个错误,说“DEBUG_TAG无法解析为变量”我该怎么办?

android eclipse debugging
1个回答
6
投票

你还没有宣布DEBUG_TAG。在你的班级上宣布它。

例如:

字符串DEBUG_TAG =“YOUR_APP_NAME”

© www.soinside.com 2019 - 2024. All rights reserved.