I have a project which contains two modules; the main
app module and another module which I include in the app module, let's call this module myModule.
I want to use SphericalUtil in myModule, which is included in android-maps-utils, so I've added compile 'com.google.maps.android:android-maps-utils:0.5+'
to the build.gradle file belonging to myModule
.
The strange thing is that I cannot import any classes belonging to the android-maps-utils library, it seems to just not exist in myModule, even though I get no gradle errors. When I type SphericalUtil in any of the classes belonging to myModule I get the suggestion to 'Add library android-maps-utils to classpath
', but it doesn't seem to be doing anything.
When I add the exact same line in the app module gradle file, it does seem to work. I can type SphericalUtil
in any class belonging to the app module and Android Studio recognizes the class and allows me to auto-import it.
I've also tried with a different library, e.g. okhttp, but no issues there, I can autoimport and use it in myModule, so the issue seems to be correlated to android-maps-utils
. Maybe following the suggestion to add the library to the classpath broke things? I'm really out of guesses, so any help is really appriciated.
If it helps, myModule gradle file looks like this:
apply plugin: 'java-library'
repositories {
maven { url "https://maven.google.com" }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// https://mvnrepository.com/artifact/com.google.android/android
compileOnly group: 'com.google.android', name: 'android', version: '4.1.1.4'
compile 'com.google.maps.android:android-maps-utils:0.5+'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile files('libs/experiment.resultlogger-0.0.2.jar')
}
sourceCompatibility = "1.7"
targetCompatibility = "1.7"