本教程內(nèi)容來源于:http://fresco-cn.org
采用 知識共享 署名 4.0 國際 許可協(xié)議 進(jìn)行許可
類庫發(fā)布到了Maven中央庫:
dependencies {
compile 'com.facebook.fresco:fresco:0.6.0+'
}
這是一個在 Intellij IDEA 的工程簡單示例: ,可供參考。
在這個 issue 解決之前,pom 中相關(guān)依賴缺少 type 字段,通過以下方式無法直接引入:
<dependency>
<groupId>com.facebook.fresco</groupId>
<artifactId>fresco</artifactId>
<version>LATEST</version>
</dependency>
需要這樣:
<!-- use this version, exclude all the other version from the other libraries. -->
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>21.0.3</version>
<type>aar</type>
</dependency>
<!-- begin of fresco -->
<dependency>
<groupId>com.facebook.fresco</groupId>
<artifactId>fresco</artifactId>
<version>0.6.0</version>
<type>aar</type>
<exclusions>
<exclusion>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
</exclusion>
<exclusion>
<groupId>com.facebook.fresco</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.facebook.fresco</groupId>
<artifactId>fbcore</artifactId>
<type>aar</type>
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>com.facebook.fresco</groupId>
<artifactId>drawee</artifactId>
<type>aar</type>
<version>0.6.0</version>
<exclusions>
<exclusion>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
</exclusion>
<exclusion>
<groupId>com.facebook.fresco</groupId>
<artifactId>fbcore</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.facebook.fresco</groupId>
<artifactId>imagepipeline</artifactId>
<type>aar</type>
<version>0.6.0</version>
<exclusions>
<exclusion>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
</exclusion>
<exclusion>
<groupId>com.facebook.fresco</groupId>
<artifactId>fbcore</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- end of fresco -->
很丑陋對吧,抱歉目前暫時只能這樣,有更好的辦法請一定告訴我。
刷新 Maven 工程,下載引用,下載完成之后,將:
gen-external-apklibs/com.facebook.fresco_imagepipeline_{版本號}/jni
目錄下的三個文件夾:armeabi
,armeabi-v7a
,x86
這三個文件夾拷貝到 libs
文件夾下。
首先,下載這個文件.
解壓后,你會看到一個目錄:frescolib,注意這個目錄。
現(xiàn)在,fresco 就導(dǎo)入到項目中了,你可以開始編譯了。如果編譯不通過,可以嘗試清理資源,或者重啟 Eclipse。
如果你想在網(wǎng)絡(luò)層使用 OkHttp,請看[這里][3].
如果 support-v4 包重復(fù)了,刪掉 frescolib/imagepipeline/libs 下的即可。
建議盡早使用 Android Studio。