1. 程式人生 > >AndroidStudio 3.0升級之compile、implementation簡要說明

AndroidStudio 3.0升級之compile、implementation簡要說明

技術 active col 圖片 body pre itl cti ont

1.現象

androidStudio 升級至3.0後 之前引用庫所使用的complie默認變成implementation
如以下:
    3.0之前
    compile ‘io.reactivex.rxjava2:rxandroid:2.0.1‘
    compile ‘io.reactivex.rxjava2:rxjava:2.1.3‘

    3.0之後
    implementation ‘io.reactivex.rxjava2:rxandroid:2.0.1‘
    implementation ‘io.reactivex.rxjava2:rxjava:2.1.3‘
除以上之外,還有以下:

 androidTestCompile(前)  
 androidTestImplementation(後)  


 testCompile(前)
 testImplementation (後)

截圖所示:

技術分享圖片

以上兩指令說明

compile: 如有模塊之間存在依賴的話,引用是正常的。
implementation: 引用的庫只能在當前模塊中使用,即便模塊之間存在依賴關系的話,也不可以引用。

說到以上,舉一個不是很恰當的例子,有點像:Java中 public 與 private

AndroidStudio 3.0升級之compile、implementation簡要說明