2

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.

2
  • I have been able to do a build successfully by adding the library projects as modules in the main pom.xml. I had to copy the library projects inside the main project to make it work. But now, on trying to deploy with mvn android:deploy android:run -Dandroid.device=usb it gives an exception as no launcher activity found for library project. It should not be trying to launch the activity from library project. Any pointers ??? Commented Oct 24, 2013 at 10:54
  • Yes, If you need run. You have to setup main launcher in AndroidManifest.xml <activity android:name=".activity.AstroboyMasterConsole"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> Commented Oct 28, 2013 at 4:28

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Does android-sdk-deployer need library project to be referenced?? I have tried giving this dependency but it fails.
What is your fail. Could you show me full pom.xml and error message.
0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.