引言
Android Studio默認(rèn)打出的aar只會(huì)包含本工程的源代碼,不會(huì)攜帶library依賴的源碼;但是我們常用的一些依賴庫(kù)一般都是帶依賴關(guān)系的(通過(guò)設(shè)置 transitive = true ,來(lái)透?jìng)饕蕾嚇?shù))。下面講解下這種帶依賴關(guān)系的aar是怎么生成的
代碼
apply plugin: 'com.android.library'apply plugin: 'maven'apply plugin: 'maven-publish'apply plugin: 'me.vigi.fat-aar'buildscript { repositories { jcenter() maven { url "http://dl.bintray.com/vigidroid/maven" } } dependencies { classpath 'me.vigi:fat-aar-plugin:0.2.8' }}dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:26.1.0' embed 'com.google.auto.service:auto-service:1.0-rc2' embed 'com.squareup:javapoet:1.7.0'}如上代碼,已經(jīng)有人寫(xiě)了一個(gè)專(zhuān)門(mén)的插件,來(lái)完成這個(gè)功能;對(duì)于想要帶依賴關(guān)系的三方庫(kù),可用 embed 的方式引入。 三方插件Github地址
總結(jié)
以上所述是小編給大家介紹的Android帶依賴樹(shù)的aar是如何生成的,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)武林網(wǎng)網(wǎng)站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選