2014/10/25

Android projectをtutorial通りに作るとエラーになる

環境
Android SDK + Eclipse
API19と21をダウンロード済み
どうも,21が出てからのエラーっぽい?

公式ページにあるtutorial通りにAndroid projectを作ると,
作ったMyFirstAppの他に,appcompat_v7というのができ,
これが
appcompat_v7\res\values-v21\styles_base.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
みたいなエラーを大量にはく.

下記のページ通り,http://developer.android.com/sdk/index.htmlから全部が入ったbundle-xxx.zipをダウンロードし,unzip.その中の,sdk\extras\android\support\v7を\android-sdk\extras\android\support\v7と置き換える.
これで,再度Android projectを作り直せば,appcompat_v7のエラーはなくなる
(Android projectごと作り直すのではなく,appcompat_v7のみimportし直すでも可)

んで,今度はこんなエラーが出る
[2014-10-24 21:20:00 - MyFirstApp] Found 2 versions of android-support-v4.jar in the dependency list,
[2014-10-24 21:20:00 - MyFirstApp] but not all the versions are identical (check is based on SHA-1 only at this time).
[2014-10-24 21:20:00 - MyFirstApp] All versions of the libraries must be the same at this time.

android-support-v4.jarというjarが違うらしい.
上記で置き換えたv7\appcompat\libsにあるものと
v4\にあるものが
違うとな
とりあえず,v4の下にあるものの方が,サイズが大きかったので,v4の下にあるものをv7\appcompat\libsの下にコピー
これでAndroid projectを作り直したら,エラーはなくなった.



参考
http://stackoverflow.com/questions/26521922/error-in-running-android-application-project-api-19