Android Studio cannot find package when importing org.robolectric
I am using butterknife: 8.5.1 package, when I want to add robolectric gradle says com.google.guava has conflit:
Error: Conflict with dependency 'com.google.guava: guava' in project ': app'. Permitted versions for app (18.0) and test app (20.0) are different. See http://g.co/androidstudio/app-test-app-conflict for details .
I checked the dependencies, and because ButterKnife uses guava
18, so I use
configurations.all {
resolutionStrategy {
force 'com.google.guava:guava:20.0'
}
}
try to avoid, now gradle will build without errors.
However, when I want to use a package, Android Studio always complains about
import org.robolectric.Robolectric;
It says he cannot find org.robolectric
. I have no idea what is going on, can anyone help? Thank you so much.
Then I also tried
exclude group: 'com.google.guava', module: 'guava'
also the same result
I suspect it has something to do with com.google.guava
, but I can't figure out why it can't find the package. I see the robolectric package under "external libraries"
source to share