使用实现而不是编译时无法访问库模块依赖项
Not able to access library module dependecies while using implementation instead of compile
使用compile
关键字在gradle
中添加依赖时,我能够访问库模块的所有依赖。
但是在使用 implementation
关键字时,我无法访问应用程序模块中的那些依赖项,它们在库模块 gradle
文件中可用。
我的框架依赖
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
implementation 'org.greenrobot:eventbus:3.1.1'
}
我的App依赖
dependencies {
implementation project(':framework')
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
问题
If i use compile
keyword for compiling dependencies, it works. If i
use implementation
keyword for compiling dependences, it doesn't
work
发布屏幕截图
使用api代替实现。
api 关键字将允许您在所有模块中使用依赖项
使用compile
关键字在gradle
中添加依赖时,我能够访问库模块的所有依赖。
但是在使用 implementation
关键字时,我无法访问应用程序模块中的那些依赖项,它们在库模块 gradle
文件中可用。
我的框架依赖
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
implementation 'org.greenrobot:eventbus:3.1.1'
}
我的App依赖
dependencies {
implementation project(':framework')
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
问题
If i use
compile
keyword for compiling dependencies, it works. If i useimplementation
keyword for compiling dependences, it doesn't work
发布屏幕截图
使用api代替实现。 api 关键字将允许您在所有模块中使用依赖项