Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » Android/Aspectj w/Google Maps ant build fail(Android project using Aspectj fails when building with ant and weaving Google api)
Android/Aspectj w/Google Maps ant build fail [message #900604] Tue, 07 August 2012 14:21 Go to next message
Christopher Moore is currently offline Christopher Moore
Messages: 4
Registered: August 2012
Junior Member
My goal is to set up an automated build and test system for an Android project. I'm using MonkeyTalk for testing the android app and it requires the project be converted to Aspectj. In order to build with Jenkins, I'm trying to get the project to build using ant from command line.

When building with ant, weaving goes great except for anything using Google Maps api. I get several errors that look like this:

     [iajc] [error   0]: error at (no source information available)
     [iajc] /Users/me/Developer/projects/android/acompany/workspace/Core/bin/classes/com/example/mobile/android/activity/HouseMap.class:0::0 can't determine superclass of missing type com.google.android.maps.MapActivity
     [iajc] when weaving type com.example.mobile.android.activity.HouseMap
     [iajc] when weaving classes 
     [iajc] when weaving 
     [iajc] when batch building BuildConfig[null] #Files=0 AopXmls=#0
     [iajc]  [Xlint:cantFindType]


I have updated the project to use Google API 10.

Any ideas???

CM

[Updated on: Tue, 07 August 2012 15:32]

Report message to a moderator

Re: Android/Aspectj w/Google Maps ant build fail [message #900620 is a reply to message #900604] Tue, 07 August 2012 15:44 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 368
Registered: July 2009
Senior Member
It looks like you don't have the GoogleMaps jar on your weaving classpath. Are you running the weaver in a second step after the initial compilation, or are you doing the compilation and weaving at once?

Either way, the full classpath with all transitively dependent jars must be available at compile time.
Re: Android/Aspectj w/Google Maps ant build fail [message #900622 is a reply to message #900620] Tue, 07 August 2012 15:57 Go to previous messageGo to next message
Christopher Moore is currently offline Christopher Moore
Messages: 4
Registered: August 2012
Junior Member
Hi Andrew,

Thank you so much for the reply.

I'm using the custom_rules.xml from the MonkeyTalk Demo1 sample project to add Aspectj to the project. Here's what I have for custom_rules.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
	<target name="-post-compile">
		<fail unless="aspectj.dir" message="aspectj.dir is missing. This must point to the AspectJ folder." />

		<property name="classes.woven.dir" value="${out.classes.absolute.dir}/../classes-woven" />

		<!-- make sure aspectj runtime is in libs folder, so it gets included in the APK -->
		<copy todir="${basedir}/libs">
			<fileset file="${aspectj.dir}/lib/aspectjrt.jar" />
		</copy>

		<!-- setup aspectj ant tasks -->
		<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
			<classpath>
				<pathelement location="${aspectj.dir}/lib/aspectjtools.jar" />
			</classpath>
		</taskdef>

		<condition property="android.jar" value="${project.target.android.jar}">
			<isset property="project.target.android.jar" />
		</condition>
		<fail unless="android.jar" message="android.jar is missing. This must point to the target SDK's android.jar." />

		<!-- weave MonkeyTalk into the app -->
		<iajc destDir="${classes.woven.dir}" showWeaveInfo="true">
			<aspectpath>
				<pathelement location="${basedir}/libs/monkeytalk-agent-1.0.11.beta5c.jar" />
			</aspectpath>
			<inpath>
				<pathelement location="${out.classes.absolute.dir}" />
			</inpath>
			<classpath>
				<pathelement location="${out.classes.absolute.dir}" />
				<pathelement location="${android.jar}" />
				<fileset dir="${basedir}/libs">
					<include name="**/*.jar" />
				</fileset>
			</classpath>
		</iajc>

		<!-- remove the old classes dir, and replace with new "woven" classes -->
		<delete dir="${out.classes.absolute.dir}" />
		<mkdir dir="${out.classes.absolute.dir}" />
		<copy todir="${out.classes.absolute.dir}">
			<fileset dir="${classes.woven.dir}" />
		</copy>
	</target>

	<target name="-post-build">
		<!-- cleanup aspectj runtime from libs folder -->
		<delete file="${basedir}/libs/aspectjrt.jar" />
	</target>
</project>
Re: Android/Aspectj w/Google Maps ant build fail [message #900625 is a reply to message #900622] Tue, 07 August 2012 16:00 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 368
Registered: July 2009
Senior Member
Is com.google.android.maps.MapActivity included in android.jar?

Also, try adding android.jar to your inpath.

[Updated on: Tue, 07 August 2012 16:01]

Report message to a moderator

Re: Android/Aspectj w/Google Maps ant build fail [message #900627 is a reply to message #900625] Tue, 07 August 2012 16:13 Go to previous messageGo to next message
Christopher Moore is currently offline Christopher Moore
Messages: 4
Registered: August 2012
Junior Member
I believe com.google.android.maps.MapActivity is in maps.jar that is an add-on located in the android sdk at android-sdk/addon-google_apis-google-10/libs/maps.jar

Do I need to add this path to the iajc class path?
Re: Android/Aspectj w/Google Maps ant build fail [message #900629 is a reply to message #900627] Tue, 07 August 2012 16:40 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 368
Registered: July 2009
Senior Member
Christopher Moore wrote on Tue, 07 August 2012 16:13
Do I need to add this path to the iajc class path?


Yes.
Re: Android/Aspectj w/Google Maps ant build fail [message #900645 is a reply to message #900629] Tue, 07 August 2012 18:53 Go to previous message
Christopher Moore is currently offline Christopher Moore
Messages: 4
Registered: August 2012
Junior Member
Thanks, Andrew!

That fixed the problem with Google Maps.
Previous Topic:AJDT - Bug 290741 - Workspace encoding is ignored
Next Topic:Softening exception in try-with-resources
Goto Forum:
  


Current Time: Sun Aug 31 06:40:55 EDT 2014

Powered by FUDForum. Page generated in 0.01916 seconds