Reputation: 1629
I am trying to mavenize the android project which uses library projects as well. I have created apklib and done the mvn install:install-file commands successfully. The build fails with compilation error. The error log can be seen below which suggests me if the google maps library project is being referenced properly or not.
MapActivity.java:[320,51] cannot find symbol
symbol: variable CameraUpdateFactory
All the classes in com.google.android.gms.maps cannot be referenced. The pom.xml is as shown below
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.octo.android.robospice</groupId>
<artifactId>robospice</artifactId>
<version>${robospice.version}</version>
</dependency>
<dependency>
<groupId>com.octo.android.robospice</groupId>
<artifactId>robospice-spring-android</artifactId>
<version>${robospice.spring.android.version}</version>
</dependency>
<dependency>
<groupId>com.octo.android.robospice</groupId>
<artifactId>robospice-ormlite</artifactId>
<version>${robospice-ormlite.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${spring.android.jackson.version}</version>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-android</artifactId>
<version>${ormlite.android.version}</version>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.actionbarrefresh.lib</groupId>
<artifactId>refresh-lib</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>apklib</type>
</dependency>
</dependencies>
Also, the classes from android-support-v4 library cannot be referenced. I have added that library in the local repository with mvn install command but still it throws the error. It says SupportMapFragment cannot be found.
Any pointers regarding this will really be helpful.
Upvotes: 2
Views: 473
Reputation: 1629
I have been able to resolve the issue with maven build.
The issue was that apklib actually do not include the jars from the libs folder of the library project. The jars from libs folder needs to be installed through maven install command and then the pom.xml should have a dependency to that too in addition to apklib. So, I installed the jar file from libs folder of google maps and added dependency in pom.xml and it worked.
I should checked first only whether apklib contained jars from libs folder or not but anyways finally this issue is resolved.
Upvotes: 0
Reputation: 430
Just add Maps dependency.
<dependency>
<groupId>com.google.android.maps</groupId>
<artifactId>maps</artifactId>
<version>7_r1</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
Then go to https://github.com/mosabua/maven-android-sdk-deployer and
mvn install -P 4.3 lib. to your m2.
Upvotes: 1