首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> 更多程式語言 >> 程式設計綜合問答

Android 開源專案導入 Eclipse 大量報錯:缺少 Library 專案依賴

     編輯:程式設計綜合問答

錯誤現象

導入 GitHub 專案 https://github.com/NoahY/q2android 後,出現大量:

  • No resource found that matches the given name: attr 'actionBarStyle'
  • Theme.Sherlock.Light、Widget.Sherlock.* 找不到
  • ActionBar cannot be resolved to a type

根本原因

專案依賴 ActionBarSherlock 與 Android Support Library v7 AppCompat,但 Eclipse 專案屬性中 Library 專案顯示紅叉或未關聯。

解決步驟

  1. 下載 ActionBarSherlock 原始碼,匯入 Eclipse 作為 Library 專案。
  2. 下載 Android Support Library(SDK Manager → Extras → Android Support Library),將 android-support-v7-appcompat 匯入為 Library 專案。
  3. 右鍵專案 → Properties → Android,在 Library 區域 Add… 兩個 Library 專案,確保無紅叉。
  4. 專案 → Clean… 重新建置。

遷移建議

ActionBarSherlock 已停止維護,建議將專案遷移至 AndroidX / AppCompat,並使用 Android Studio + Gradle 管理依賴,避免手動 Library 關聯問題。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved