2016-09-02 58 views
0

我想添加一個jar文件到我現有的應用程序。當我嘗試以下 絕對路徑到我的build.gradle時,它工作正常。添加相對路徑的Android jar文件

compile files('C:/Users/julia/AndroidStudioProjects/TestProject/libs/MyPo.jar') 

但是,當我試圖將其更改爲相對路徑時,它不起作用。

compile files('libs/MyPo.jar'), I also tried 
compile project('libs:MyPo.jar') 
compile project(':libs:MyPo.jar') 

什麼是使用相對路徑將此jar文件添加到我的應用程序的正確方法?謝謝。

+0

這裏是解決方案已經在stackoverflow中:。 http://stackoverflow.com/q/16608135/3595514 – Rajendra

+0

是的,我看到了答案,但無法理解第二部分(右鍵單擊它並點擊「添加爲庫」)我沒有看到選項添加爲庫當我在Android Studio中右鍵點擊jar文件時。 – Julia

回答

0

File - >Project Structure - >Dependencies - > 「+」 - >File dependency

1

放罈子上的APP-文件> lib文件夾 和項目的build.gradle使用編譯( '庫/ filename.jar' ) 然後同步您的項目 這將工作