ProGuard : 라이브러리 클래스의 중복 정의?
Android 프로젝트 용 ProGuard를 실행하면 다음과 같은 경고가 표시됩니다.
Note: duplicate definition of library class [org.apache.http.conn.scheme.HostNameResolver]
Note: duplicate definition of library class [org.apache.http.conn.scheme.SocketFactory]
Note: duplicate definition of library class [org.apache.http.conn.ConnectTimeoutException]
Note: duplicate definition of library class [org.apache.http.params.HttpParams]
Note: duplicate definition of library class [android.net.http.SslCertificate$DName]
Note: duplicate definition of library class [android.net.http.SslError]
Note: duplicate definition of library class [android.net.http.SslCertificate]
Note: there were 7 duplicate class definitions.
나는 이것을 무시하고 이것을 고치기 위해 여기 에서 발견 했다 .
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-keep class android.net.http.** { *; }
-dontwarn android.net.http.**
사용 된 라이브러리에서 중복을 제거하는 방법을 찾지 못했습니다. 사용 후에도 dontwarn
경고가 사라지지 않습니다.
이 경고를 무시하고이 경고를 처리하는 올바른 방법입니까, 아니면 문제를 일으킬 수 있습니까?
proguard 옵션을 추가하면 proguard가 추가되는 -printconfiguration config.txt
것을 볼 수 있습니다.
-libraryjars 'D : \ tools \ android \ platforms \ android-23 \ android.jar'
-libraryjars 'D : \ tools \ android \ platforms \ android-23 \ optional \ org.apache.http.legacy.jar'
중복 된 클래스 (예 : SslError)는 android.jar 및 org.apache.http.legacy.jar 모두에 표시됩니다.
Proguard는 두 번째 jar를 추가하지 않아도 추가합니다. useLibrary 'org.apache.http.legacy'
여기 에 문제를 설명 하는 공개 버그 가 있습니다.
이제 우리는이 문제에 대해 아무것도 할 수 없습니다. 그냥 무시하세요 :
-dontnote android.net.http.*
-dontnote org.apache.commons.codec.**
-dontnote org.apache.http.**
라이브러리 jar (실제로 전화의 라이브러리)에있는 한 클래스를 보관할 필요가 없습니다. dontwarn은 경고가 아니기 때문에 작동하지 않습니다. 메모입니다.
아마도 proguard-project.txt에서 "-injars"와 -libraryjars "를 언급 하셨을 것입니다. 최신 빌드 시스템이 그들을 언급하는 것을 고려한다면 다시 언급 할 필요가 없습니다.
출처 : http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass
나는 이것이 도움이 될 것이라고 생각한다. :)
build.gradle에 다음을 추가하여 중복 클래스를 허용하지 않도록 gradle에 알릴 수 있습니다.
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
로그에서 중복으로 표시된 모든 항목에 대해 build.gradle에서이를 시도 할 수 있습니다. 이것이 작동하는지 확실하지 않으므로 시도해보고 작동하는지 알려주십시오.
packagingOptions {
exclude 'android.net.http.SslCertificate'
}
참고 URL : https://stackoverflow.com/questions/33047806/proguard-duplicate-definition-of-library-class
'IT박스' 카테고리의 다른 글
Linux에서 Windows 대상으로의 교차 컴파일을 위해 Qt를 구성하려면 어떻게해야합니까? (0) | 2020.10.15 |
---|---|
내부에서 약속을 거부하고 기능하는 방법 (0) | 2020.10.15 |
TensorFlow 모델로 예측하기 (0) | 2020.10.15 |
Clojure 함수가 가변 개수의 매개 변수를 사용하도록 만드는 방법은 무엇입니까? (0) | 2020.10.14 |
@Override와 같은 주석은 Java에서 내부적으로 어떻게 작동합니까? (0) | 2020.10.14 |