简体   繁体   English

无法连接到 /127.0.0.1:443 - ANDROID STUDIO

[英]FAILED TO CONNECT TO /127.0.0.1:443 - ANDROID STUDIO

i have this kind of problem when i try to run my app project in android studio it keeps give me an error " failed to connect to /127.0.0.1:443 ".当我尝试在 android 工作室中运行我的应用程序项目时,我遇到了这种问题,它一直给我一个错误“无法连接到 /127.0.0.1:443 ”。 im using local ip for that.我为此使用本地 ip。 but when i try using 192.168.1.10 or 10.0.2.2 it doesn't work too.但是当我尝试使用 192.168.1.10 或 10.0.2.2 时它也不起作用。

this is my retro code这是我的复古代码

public class RetroServer {
private static final String baseURL = "https://127.0.0.1/laundry/";
private static Retrofit retro;
public static Retrofit konekRetrofit(){
    if(retro == null){
        retro = new Retrofit.Builder()
                .baseUrl(baseURL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
    return retro;
}

in my retro code there's 2 of this symbols }}在我的复古代码中有 2 个这样的符号}}

and this is my androidmanifest.xml code这是我的 androidmanifest.xml 代码

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
    android:usesCleartextTraffic="true"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.Laundry">
    <activity
        android:name=".Activity.MainActivity"
        android:exported="true"
        tools:ignore="MissingClass">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

if you guys can help me with this problem, thank you so much如果你们能帮我解决这个问题,非常感谢

If you are running in localhost you should use http://10.0.2.2:8080/ as a base url, you need to specify the port, otherwise it won't work.如果你在 localhost 中运行,你应该使用http://10.0.2.2:8080/作为基础 url,你需要指定端口,否则它将不起作用。

Can you do simple test in your emulator.你能在你的模拟器中做简单的测试吗? From your emulator.从你的模拟器。 Can you open your browser.能不能打开浏览器。 After that, open your URL.之后,打开您的 URL。 (10.0.2.2) If everything good. (10.0.2.2) 如果一切顺利。 Then you need to setup network_config in your android manifest.然后您需要在 android 清单中设置 network_config。 Please checkhttps://developer.android.com/training/articles/security-config请查看https://developer.android.com/training/articles/security-config

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">10.0.2.2</domain>
    </domain-config>
    <base-config cleartextTrafficPermitted="false" />
</network-security-config>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Studio 中的“jcenter.bintray.com:443 failed to respond”错误 - “jcenter.bintray.com:443 failed to respond” error in Android Studio Appium:连接到127.0.0.1:4723 [/127.0.0.1]失败:连接被拒绝:connect - Appium: Connect to 127.0.0.1:4723 [/127.0.0.1] failed: Connection refused: connect Android - 10000 毫秒后无法连接到 settings.crashlytics.com/54.83.49.38(端口 443) - Android - failed to connect to settings.crashlytics.com/54.83.49.38 (port 443) after 10000ms Android Studio-无法连接到LDAP服务器 - Android studio - Failed to connect to LDAP server Cassandra nodetool:无法连接到“ 127.0.0.1:7199” - Cassandra nodetool: Failed to connect to '127.0.0.1:7199' java.net.ConnectException:无法连接到/10.0.2.2:443 - java.net.ConnectException:Failed to connect to /10.0.2.2:443 org.apache.http.conn.HttpHostConnectException:连接到127.0.0.1:7055 [/127.0.0.1]失败:连接被拒绝:connect - org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:7055 [/127.0.0.1] failed: Connection refused: connect HttpHostConnectException:连接到 localhost:2375 [localhost/127.0.0.1] 失败:连接被拒绝 - HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1] failed: Connection refused TestRestTemplate HttpHostConnectException:连接到本地主机:8082 [localhost/127.0.0.1] 失败:连接被拒绝 - TestRestTemplate HttpHostConnectException: Connect to localhost:8082 [localhost/127.0.0.1] failed: Connection refused IOException java.net.ConnectException:无法连接到/127.0.0.1(port 5000):connect failed:ECONNREFUSED(Connection Refused) - IOException java.net.ConnectException: failed to connect to /127.0.0.1(port 5000):connect failed:ECONNREFUSED(Connection Refused)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM