λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
πŸ’š 개발/μ•ˆλ“œλ‘œμ΄λ“œ

[μ•ˆλ“œλ‘œμ΄λ“œ] java.net.SocketException: socket failed: EACCES (Permission denied)

by devshin.kr 2021. 9. 14.
728x90

 

java.net.SocketException: socket failed: EACCES (Permission denied)

이전 κΈ€μ—μ„œ HttpURLConnection μƒ˜ν”Œ μ½”λ“œλ₯Ό μ§œλŠ”λ° μœ„μ™€ 같은 μ—λŸ¬κ°€ λ°œμƒν–ˆλ‹€.

κΆŒν•œμ΄ κ±°λΆ€λ˜μ—ˆλ‹€κ³  ν•΄ 문제의 원인을 ꡬ글링 ν•΄ λ³΄λ‹ˆ, AndroidManifest.xml 에 uses-permission 을 λΉΌ λ¨Ήμ—ˆμ—ˆκ΅°...

 

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.devshin93.asynctasktest">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>   <!-- μΆ”κ°€ -->
    <uses-permission android:name="android.permission.INTERNET"/>   <!-- μΆ”κ°€ -->

    <application
        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.AsyncTaskTest"
        android:usesCleartextTraffic="true">   <!-- μΆ”κ°€ -->
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

 

이 λΆ€λΆ„! 이닀

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>   <!-- μΆ”κ°€ -->
    <uses-permission android:name="android.permission.INTERNET"/>   <!-- μΆ”κ°€ -->

λŒ“κΈ€