개발/게임) 개발관련
문제해결)Android)error: package org.apache.http does not exist import org.apache.http.NameValuePair;
테샤르
2022. 4. 17. 18:37
error: package org.apache.http does not exist import org.apache.http.NameValuePair;
Android 에서 Apache Http를 지원하지 않는 형태가 바뀌면서 해당 레거시 항목이 문제가 되는 경우이다.
해결방법은 userLibrary를 명시적으로 등록해줘야 한다.
build.gradle에서 다음을 추가한다.
useLibrary 'org.apache.http.legacy'
반응형
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 4
targetSdkVersion 29
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
useLibrary 'org.apache.http.legacy'
}
이렇게 하게되면 해당 org.apache.http 관련된 이슈가 해결된다.
참고로 Unity도 마찬가지로 AndroidManifest.xml에 추가해줘야한다.
참고 StackOverFlow : [ 링크 ]
java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion
I'm encountering this error when I use Android Studio to build my app. The APK is compiled, but when I attempt to run the app on Android P emulator, it will crash and throw the following error. Ple...
stackoverflow.com
★☆☆☆☆
반응형