I have downloaded an 3rd party Android library project, the project contains no java class file but an jar file under libs/
folder:
libs/
- CustomService.jar
res/
-…
pom.xml
This library project can be maven built to apklib archive. I built it & I have installed this archive into my local maven repository.
Then in my own Android project, I have added the dependency of this apklib project:
<dependency>
<groupId>com.custom.service</groupId>
<artifactId>custom-service</artifactId>
<type>apklib</type>
<version>1.0</version>
</dependency>
In my Java code, I have used the class from the CustomService.jar , but when I maven build my project I constantly get the following error:
[ERROR] package com.custom.service.user does not exist
[ERROR] location: class com.my.app.MyClass
[ERROR] /Users/Johon/MyApp/src/main/java/com/my/app/MyClass.java:[34,17] cannot find symbol
[ERROR] symbol: variable UserService
The above error complains that it cannot find the UserService
class from the library apklib archive. Then, I checked the content of the library jar file by command:
jar tf CustomService.jar
I see that the class is in CustomService.jar of the library project
com/custom/service/user/UserService.class
This class is in the jar, Why I get the error then????