我正在尝试在真实设备上调试helloword示例.经过大量的搜索,我设法做了一些设置.
我在真实设备上调试了什么:
LOCAL_APP_ENGINE_SERVER_URL_FOR_ANDROID值更改为http://192.168.1.107:8888(我的计算机IP地址)--address=192.168.1.107运行配置程序参数现在看起来像--address=192.168.1.107 --port=8888 "<path-to-project>/war"http://192.168.1.107:8888/_ah/admin/不幸的是,当我尝试在真实设备上进行通信时我得到的是:
GoogleJsonResponseException:500无法检索状态为404的API配置
附加了堆栈跟踪的完整错误html内容:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Failed to retrieve API configs with status: 404
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 Failed to retrieve API configs with status: 404</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /_ah/api/userendpoint/v1/user/jacek@gmail.com/11224. Reason:
<pre> Failed to retrieve API configs with status: 404</pre></p><h3>Caused by:</h3><pre>java.io.IOException: Failed to retrieve API configs with status: 404
at com.google.api.server.spi.tools.devserver.ApiServlet.getApiConfigSources(ApiServlet.java:102)
at com.google.api.server.spi.tools.devserver.ApiServlet.initConfigsIfNecessary(ApiServlet.java:67)
at com.google.api.server.spi.tools.devserver.RestApiServlet.service(RestApiServlet.java:117)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at …Run Code Online (Sandbox Code Playgroud) 我正在按照Flutter Networking/HTTP教程对我的localhost:8000上运行的服务器执行GET请求.通过我的浏览器访问我的本地主机工作正常.我的代码看起来像这样:
var url = 'http://localhost:8000';
Future<String> getUnits(String category) async {
var response = await httpClient.get('$url/$category');
return response.body;
}
Run Code Online (Sandbox Code Playgroud)
当我指向任何真实的URL时,这可以正常工作,例如https://example.com,当我指向https://localhost:8000或https://localhost(或这些的任何变体)时,我得到一个错误,从以下开始:
E/flutter ( 4879): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 4879): SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 47060
E/flutter ( 4879): #0 IOClient.send (package:http/src/io_client.dart:30:23)
Run Code Online (Sandbox Code Playgroud)
每次重新加载应用程序时,上述错误中的端口都会更改.我查看了http包代码,似乎没有办法为URL指定端口.我如何指向我的本地主机?
我的Android应用程序与php服务器对话.我在WAMP服务器上本地运行Apache/php.我正在运行Windows 7.如果我在Windows 7上访问localhost,该网站会显示但在手机上它会在当前的Android操作系统上查找localhost,因此没有网站显示.
我设法通过打开我的apache配置到互联网然后使用我的外部IP地址来解决这个问题,这很烦人,因为我在动态IP上,有时没有互联网(+不安全).
如何从android访问localhost(或hosts文件中的其他别名)发出http请求?
我是一个使用create-react-app创建应用程序的noob ,yarn start启动服务器http://localhost:3000/,我无法在我的手机上访问此网址.如何在移动设备上预览应用程序?
我的计算机上有一个本地运行的Spring REST api.我想在Android开发中使用这个api.
这是我的获取请求:
public static String sendGet(final String url) {
StringBuilder result = new StringBuilder();
HttpURLConnection urlConnection = null;
try {
String apiUrl = getAbsoluteUrl(url); // concatenate uri with base url eg: localhost:8080/ + uri
URL requestUrl = new URL(apiUrl);
urlConnection = (HttpURLConnection) requestUrl.openConnection();
urlConnection.connect(); // no connection is made
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = reader.readLine()) != null) {
result.append(line);
}
} catch (Exception e) {
e.printStackTrace();
} …Run Code Online (Sandbox Code Playgroud) 我的手机和电脑都在同一个wifi上.当我运行时ng serve,我用我的电脑在Chrome中打开localhost:4200,这有效.
但我用我的手机打开192.168.1.107:4200,它不起作用.
我用的时候create-react-app.有用.
绿色是有棱角的.白色是反应

模拟器可以从本地主机访问Web服务,但我的真实设备不能使用LAN IP地址(192.168.xx.yyy)而不是10.0.2.2.当然,我的Android手机被adb认可,它通过USB端口连接我的笔记本电脑.
我已经在stackoverflow上阅读了一些类似的问题,但仍然不知道如何从真正的Android手机访问webservice.这个问题的答案如何从我的Android设备访问我的localhost?我很有用,但我真的不明白这个答案.
有人帮我吗?谢谢!
我正在使用jquery mobile在移动网站上工作,并希望使用我的Android手机浏览器进行测试.
我的Windows 7机器和Android手机在同一个无线网络上.
我通常从我的机器访问移动网站:" http://localhost/index.php/doctor "
我尝试使用手机上的无线网络IP地址访问它:" http://192.168.1.3/index.php/doctor "
但是,我得到的网页不可用错误.
如何从我的Android手机访问localhost?!
I'm using firebase auth in my application and am implementing other providers, in this case microsoft. Email/password works fine (app is initialised etc.) but trying signInWithPopup, as shown below:
import * as firebaseAuth from 'firebase/auth';
export function signupWithMicrosoft(): Promise<firebaseAuth.UserCredential> {
const auth = firebaseAuth.getAuth();
const provider = new firebaseAuth.OAuthProvider('microsoft.com');
return firebaseAuth.signInWithPopup(auth, provider).catch(Promise.reject);
}
Run Code Online (Sandbox Code Playgroud)
fails inconsistently with:
Uncaught (in promise) Error: INTERNAL ASSERTION FAILED: Pending promise was never set
debugFail assert.ts:256
debugAssert assert.ts:271
reject abstract_popup_redirect_operation.ts:135
onAuthEvent abstract_popup_redirect_operation.ts:104
sendToConsumer auth_event_manager.ts:97
onEvent …Run Code Online (Sandbox Code Playgroud) 我正在按照 Flutter Networking/HTTP 教程对在我的 localhost:8000 上运行的服务器执行 GET 请求。通过浏览器访问我的本地主机工作正常。当我指向任何真实的 URL 时,这也很好用,例如https://example.com,但是当我指向https://127.0.0.1:8000 时,我收到类似“连接被拒绝”的错误
每次我重新加载应用程序时,上述错误中的端口都会发生变化。我查看了 http 包代码,似乎没有办法为 URL 指定端口。我如何指向我的本地主机,这是我第一次使用 flutter 吗?PS:我在我的手机设备上运行,我的电脑和手机用同一个 wifi 连接,我的网络是私有的。
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:http/http.dart' as http;
import 'dart:convert';
class MyHomePage extends StatefulWidget {
const MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
static const url = 'http://127.0.0.1:8000/api/membres/';
// static const url = 'http://10.0.2.2:8000/api/membres/';
//static const url = 'http://localhost:8000/api/membres/';
//static const url= "192.168.1...:8000/association/api/membres";
//static const url = …Run Code Online (Sandbox Code Playgroud)