본문 바로가기
공부/안드로이드

error: package org.apache.http does not exist

by 단순한 프로그래머 2025. 9. 9.

error: package org.apache.http does not exist import org.apache.http 등의 오류가 발생할 때

2가지 방법으로 해결할 수 있다.

 

1. implementation을 통해 의존성을 정의

버전은 나중에 더 올라갈 수도 있지만 implementation에 의존성을 정의해 주면 오류가 해결된다.

implementation ("org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2")

 


 

2. Gradle과 Manifest에 정의

Gradle과 Manifest에 아래와 같이 정의해 주면 오류가 해결된다.

AndroidManifest
Gradle
AndroidManifest.xml
<uses-library android:name="org.apache.http.legacy" android:required="false"/>



build.gradle
useLibrary ("org.apache.http.legacy")