2016-02-12 108 views
0

我嘗試在我的項目中包含aacdecoder(https://github.com/vbartacek/aacdecoder-android)。在解碼器自述說我的依賴是android studio import maven project without gradle

<dependency> 
     <groupId>com.spoledge.aacdecoder</groupId> 
     <artifactId>aacdecoder-lib</artifactId> 
     <version>0.8</version> 
     <type>apklib</type> 
</dependency> 

,但是當我在我的build.gradle使用這樣

compile 'com.spoledge.aacdecoder:aacdecoder-lib:0.8' 

當我嘗試同步它,它失敗。


後jitpack.io(感謝OleGG),像在圖像(下行),它不是像外行人apper。

enter image description here

回答

1

你可以從Maven的庫定義看,它的分佈爲<type>apklib</type>,並且apklib是不支持的搖籃。

最簡單的解決方案是將此庫打包到您的庫中。你也可以按照這個問題How to convert apklib to aar的指示,但無論如何它會導致應用程序重新包裝。

您也可以嘗試使用https://jitpack.io自動打包。在這種情況下,你需要jitpack回購添加到您的根build.gradle文件是這樣的:

allprojects { 
    repositories { 
     jcenter() 
     maven { url "https://jitpack.io" } 
    } 
} 

,然後提供GitHub庫中相應的模塊依賴關係:

dependencies { 
    compile 'com.github.vbartacek:aacdecoder-android:0.8' 
} 
+0

感謝它是工作,但我怎麼能導入我的課,因爲這是工作導入com.spoledge.aacdecoder.AACPlayer;但我不能使用import com.github或com.spoledge。他們不會在com之後來。 – eren

+0

可能是,jitpack無法將github repo轉換爲存檔。所以,當您需要手動創建庫時,我們又回到了這種情況 – OleGG