안드로이드 프로젝트를 새로 만들면 위와 같은 오류를 만나게 된다.

에러 내용은 대충 아래와 같다.

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g] Found 2 versions of android-support-v4.jar in the dependency list,

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g] but not all the versions are identical (check is based on SHA-1 only at this time).

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g] All versions of the libraries must be the same at this time.

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g] Versions found are:

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g] Path: C:\Users\m\workspace_empty2\appcompat_v7\libs\android-support-v4.jar

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g]  Length: 1157388

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g]  SHA-1: 605c447c20ca216b5556af9f215af5d4bba1b117

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g] Path: C:\Users\m\workspace_empty2\SampleActivityNew003_detect3g\libs\android-support-v4.jar

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g]  Length: 1364299

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g]  SHA-1: b6c138ba72ce38beda559df33d369856854fd6f5

[2015-12-06 15:26:15 - SampleActivityNew003_detect3g] Jar mismatch! Fix your dependencies

[2015-12-06 15:26:18 - SampleActivityNew003_detect3g] ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing

[2015-12-06 15:26:23 - SampleActivityNew003_detect3g] ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing

[2015-12-06 15:28:44 - SampleActivityNew003_detect3g] ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing

[2015-12-06 15:28:47 - SampleActivityNew003_detect3g] ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing


원인은 새 프로젝트를 만들면, 그 프로젝트는 appcompat_v7 라이브러리를 참조하게되며, 더불어 최신 android-support-v4.jar 라이브러를 포함하게 된다.

그런데, appcompat_v7 프로젝트는 이미 (과거버전의) android-support-v4.jar 라이브러를 갖고 있는데, 그렇기 때문에 버전 충돌 문제가 발생하는 것이다.



어찌되었건, 이 두개의 라이버리를 동일하게 맞춰주거나, 둘중 하나를 삭제하거나 하면 되는 것이다.


appcompat_v7 프로젝트의 android-support-v4.jar 라이브러리를 최신버전으로 변경하도록 하자.

위 폴더 이미지에서 최신버전이라 생각되는 2015.12.6 에 수정(생성)된 android-support-v4.jar 파일을 그냥 복사하는 방법도 있겠지만, 이클립스 eclipse 에서 제공하는 방법을 이용하자



위와 같이 appcompat_v7 프로젝트를 마우스로 우클릭하여 Android Tools - Add Support Library 를 해주면 된다

그런데 아마 이것만으로 문제가 해결되지는 않을 것이다 (이클립스 이런 문제는 왜 안 고쳐지는지...)


이제, 여전히 오류상태로 x표시가 되어 있는 나의 프로젝트를 선택하여

Add Support Library -> Project Close -> Project Open -> Project Clean 의 과정을 거쳐줘야 한다.








위의 방법이 제대로 방법인지는 알 수 없으나,

아무튼 나는 위와 같은 방법으로 문제를 해결하였다.


Posted by 잇힝2012
,
Posted by 잇힝2012
,
Posted by 잇힝2012
,