我们正在将项目从dagger 1.x升级到dagger 2.x.我们将所有内容转换为符合dagger 2,但是当我们尝试编译时,我们得到以下消息:
error: cannot find symbol
import myapp.DaggerMyComponent;
^
symbol: class DaggerMyComponent
location: package myapp
Note: Generating a MembersInjector for myapp.PageController. Prefer to run the dagger processor over that class instead.
Note: Generating a MembersInjector for myapp.ScrollingItemPageController. Prefer to run the dagger processor over that class instead.
error: cannot access AbstractHttpEntity
class file for org.apache.http.entity.AbstractHttpEntity not found
Consult the following stack trace for details.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for org.apache.http.entity.AbstractHttpEntity not found\
添加useLibrary 'org.apache.http.legacy'
确实可以解决此问题,但我想知道使用AbstractHttpEntity
的内容是什么,并且包含此库有任何副作用吗?
编辑:
有人要求查看网络依赖项。 请注意,在升级之前,这些依赖项已经存在!
compile "com.squareup.okhttp3:okhttp:${okhttpVersion}"
compile ("com.squareup.okhttp3:logging-interceptor:${okhttpVersion}") {
exclude group: 'com.squareup.okhttp3'
}
compile "com.google.dagger:dagger:${daggerVersion}"
apt ("com.google.dagger:dagger-compiler:${daggerVersion}")
compile ("com.squareup.retrofit2:retrofit:${retrofitVersion}") {
exclude group: 'com.squareup.okhttp3'
}
compile ("com.squareup.retrofit2:converter-gson:${retrofitVersion}") {
exclude group: 'com.google.code.gson'
exclude group: 'com.squareup.retrofit2'
}
版本:
ext {
supportVersion = '24.1.1'
playServicesVersion = '9.4.0'
butterknifeVersion = '8.2.1'
daggerVersion = '2.6'
retrofitVersion = '2.1.0'
okhttpVersion = '3.4.1'
}
我确实在github上看到使用相同useLibrary
的其他项目,但它从未解释为什么:
https://github.com/shohrabuddin/Dagger2-ButterKnife-Retrofit-OkHttp-Picasso-Gson_Annotations https://github.com/frogermcs/GithubClient/blob/master/app/build.gradle