3

我是新來的Gradle和Android Studio(基於Intellij Idea的IDE)。我的問題是糾正導入holoeverywhere項目。我讀了很多類似的話題,但他們並沒有給我解決我的問題。添加Holoeverywhere項目在Android Studio

類似主題:

Android Studio not working with HoloEverywhere and ActionBarSherlock

Building Android Studio project with HoloEverywhere fails

How do I add a library project to Android Studio?

下面我的操作方法看跌屏幕:

1首先從頭開始創建新的項目

New project

2創建目錄庫

enter image description here

3導入新模塊 enter image description here

4導入使用Maven模型 enter image description here

5導入設置 holoeverywhere enter image description here enter image description here enter image description here enter image description here

6添加依賴於主應用程序模塊 enter image description here enter image description here enter image description here

7移動Holoeverywhere DIR到庫 enter image description here enter image description here enter image description here

8改變父模塊名稱 enter image description here

9添加的依賴於搖籃文件活動 enter image description here

11運行結果 enter image description here

12的另一種嘗試以 enter image description here

10個更改進口取決於設置 enter image description here

請給我同樣的想法如何糾正進口holoeverywhere

+0

您可以構建您的應用程序而無需gradle,只需提供IDEA。這個對我有用。 – Divers

+0

一個好帖子,我有同樣的問題。 你現在知道修復了嗎?謝謝! – jjalonso

+1

我決定切換回eclipse,而採用gradle集成的Android studio將不會提前訪問預覽。 – granan

回答

2

得到它的工作在最基層的只是跟着這裏給出的建議是:

https://github.com/Prototik/HoloEverywhere/wiki/Import-in-IDE

基本上關閉所有項目,使你進入歡迎屏幕。然後:

- - Git的 - >鍵入庫URL>從版本控制籤:https://github.com/Prototik/HoloEverywhere.git - >按「克隆」,等到庫中檢出 - >點擊「是」以打開一個項目的建議。

這應該給你一個HoloEverywhere項目,可以隨時使用。

打開文件>項目結構並檢查是否有缺失庫的錯誤(例如,我必須手動下載v4 r18 file)。

單擊應用>確定以確保更改已保存並返回到項目。點擊演示,然後點擊運行>編輯配置。點擊+安卓應用程序。稱之爲演示或其他。選擇演示爲模塊,啓動默認活動選中,部署選中,USB設備檢查。

打開小調試花花公子現在應該讓你運行演示。從這裏簡單介紹一下將演示重構爲您自己的項目或在HoloEverywhere項目中創建新的Android應用程序模塊的情況。

換句話說,而不是試圖HoloEverywhere添加到你的項目,你的項目添加到HoloEverywhere :)

5

我同意@ 7wonders,但進口礦項目HoloEverywhere將使更大的問題比它導入HoloEverywhere 。

在克隆HoloEverywhere後,在項目中您有名爲「library」的文件夾。 首先,我將它複製到項目根目錄下的文件夾「庫」中,並將其更名爲「HoloEverywhere」。在HoloEverywhere文件夾

其次,我已經編輯 「的build.gradle」 文件是這樣的:

 apply plugin: 'android-library' 

    android { 
    compileSdkVersion 19 
    buildToolsVersion '19.0.0' 

    defaultConfig { 
    minSdkVersion 7 
    } 

    sourceSets { 

    main { 
     manifest.srcFile 'AndroidManifest.xml' 
     java.srcDirs = ['src'] 
     res.srcDirs = ['res'] 
    } 

} 
} 


dependencies { 
    compile files('libs/support-v4-18.0.4.jar') 
    compile files('libs/nineoldandroids-2.4.0.jar') 
} 

第三,加入到 「settings.gradle」 在project`s根文件夾

include ":libraries:HoloEverywhere" 

之前包括您的項目。

畢竟我們應該在您的ProjectProjectName文件夾內的「build.gradle」文件中添加庫HoloEveryWhere到我們的主項目依賴項。

dependencies {    
      compile project(':libraries:HoloEverywhere') 
    } 

不要忘了從項目依賴的支持-V4 &支持-V7庫中刪除。

最後別忘了清理項目。從Android Studio的菜單構建>清理項目中選擇。 我建議通過終端來做到這一點,因爲在「運行」窗口中看不到所有錯誤。 所以選擇Tools>打開終端 首先你應該導航到項目的根(命令 「CD ..」),並調用:

UNIX: ./gradlew乾淨

的Windows: gradlew.bat乾淨

成功清理後建立您的項目。

構建時我有錯誤,HoloEverywhere庫中的AndroidManifest.xml 中沒有「應用程序」標記。所以只需添加它,現在一切正常。

要做的一件小事,或許是最糟糕的事情:閱讀basic migration,並用HoloEverywhere庫中的類更改所有導入,資源(佈局)和覆蓋方法以忽略ClassCastException。

享受:)

相關問題