0

我刚刚将 AsyncTask 添加到我的 RegisterActivity.java 和 LoginActivity.java 以帮助处理 ANR 错误,这似乎有效。现在,当我运行代码时,我收到 JSON 和 JSONParser 错误。当我点击用户登录界面上的“注册”或“登录”按钮时出现此错误。这是LogCat:

09-04 18:13:39.776: E/JSON(854): <?xml version="1.0" encoding="UTF-8"?>n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"n  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">n<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">n<head>n<title>Object not found!</title>n<link rev="made" href="mailto:postmaster@localhost" />n<style type="text/css"><!--/*--><![CDATA[/*><!--*/ n    body { color: #000000; background-color: #FFFFFF; }n    a:link { color: #0000CC; }n    p, address {margin-left: 3em;}n    span {font-size: smaller;}n/*]]>*/--></style>n</head>nn<body>n<h1>Object not found!</h1>n<p>nnn    The requested URL was not found on this server.nn  nn    If you entered the URL manually please check yourn    spelling and try again.nn  nn</p>n<p>nIf you think this is a server error, please contactnthe <a href="mailto:postmaster@localhost">webmaster</a>.nn</p>nn<h2>Error 404</h2>n<address>n  <a href="/">10.0.2.2</a><br />n  <span>Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4</span>n</address>n</body>n</html>nn
09-04 18:13:39.776: E/JSON Parser(854): Error parsing data org.json.JSONException: Value <?xml of type java.lang.String cannot be converted to JSONObject
09-04 18:13:39.786: E/LoginTask(854): No login response was received

我正在使用 PHP 并连接到本地服务器 (phpmyadmin) 来保存我的数据库值(即用户名、密码、电子邮件等)。我正在使用 XAMPP,并确保 Apache 和 MySQL 都在运行。我正在通过 phpmyadmin 通过 php API 类将我的 Android 连接到数据库,如本教程所示: http ://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite / 任何帮助都会得到帮助。谢谢!

4

1 回答 1

0

阅读错误,修复错误。

您尝试读取的 URL 并未向您发送 JSON 数据,而是向您发送了一个错误网页(可能是 404 响应代码),其中包含如下文本The requested URL was not found on this server

于 2013-09-04T23:10:38.040 回答