cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Joe.Catera
AppDynamics Team

 If your build system is Ant-based and you want to build Android apps with the AppDynamics SDK< you must:

  1. Add agent files to the project

  2. Include a post-compile target

 

Note: The Android SDK does not support IBM Worklight or other frameworks that do not use the build.xml file defined in Android projects. 

 

Procedure

1. How do I add the AppDynamics Android Agent files?

  1. Create a libs directory in your application root directory.

    Since this is often "Application and a subdirectory of your project directory,  your libs directory might be located here: ProjectName/Application/libs

  2. Copy ADEumAgent.jar to the libs directory.

  3. Copy ADEumInjector.jar to your application root directory.

 

2. How do I add or edit the post-compile target?

The steps to adding or editing a post-compile target depend on your project's existing structure:

 

What do I do if my project doesn't have  a custom_rules.xml file?

If your project doesn't have a custom_rules.xml:

  1. Create a file in your project's root directory named custom_rules.xml.

  2. Copy and paste the following into that file.

    <project>
        <target name="-post-compile">
            <taskdef name="injector"
                     classname="com.appdynamics.android.ant.EUMAgentInjectorTask"
                     classpath="ADEUMInjector.jar"/>
            <injector classfilespath="${out.classes.absolute.dir}"
                      outputlocation="${out.absolute.dir}/instrumented-jars/"
                      instrumentationjarlocation="${jar.libs.absolute.dir}/ADEUMAgent.jar"
                      jarfilesrefid="project.all.jars.path"
                      androidjarlocation="${project.target.android.jar}"/>
        </target>
    </project>

     

What do I do if my project's existing custom_rules.xml file doesn't contain a "-post-compile" target?

If there is an existing custom_rules.xml file in your project but it does not contain a "-post-compile" target:

  1. In your project's existing custom_rules.xml file, add the following text to the end of it's existing <project> element:
    <target name="-post-compile">
        <taskdef name="injector"
                 classname="com.appdynamics.android.ant.EUMAgentInjectorTask"
                 classpath="ADEUMInjector.jar"/>
        <injector classfilespath="${out.classes.absolute.dir}"
                  outputlocation="${out.absolute.dir}/instrumented-jars/"
                  instrumentationjarlocation="${jar.libs.absolute.dir}/ADEUMAgent.jar"
                  jarfilesrefid="project.all.jars.path"
                  androidjarlocation="${project.target.android.jar}"/>
    </target>​


What do I do if my project's existing custom_rules.xml file already contains a -post.compile target:

If there is an existing custom_rules.xml file in your project and it already contains a -post-compile  target:

  1. Add the following text to the end of the existing "-post-compile" <target> element:
    <taskdef name="injector"
                 classname="com.appdynamics.android.ant.EUMAgentInjectorTask"
                 classpath="ADEUMInjector.jar"/>
        <injector classfilespath="${out.classes.absolute.dir}"
                  outputlocation="${out.absolute.dir}/instrumented-jars/"
                  instrumentationjarlocation="${jar.libs.absolute.dir}/ADEUMAgent.jar"
                  jarfilesrefid="project.all.jars.path"
                  androidjarlocation="${project.target.android.jar}"
    />​

 

Special Considerations

What should I consider if I'm using Eclipse and Ant?

If you're using Eclipse and Ant, do not include android.jar in the list of jar files provided as "jarfilesrefid" to your injector task—for example, if your build.xml looks something like this:

 

 

<taskdef name="injector"
	classname="com.appdynamics.android.ant.EUMAgentInjectorTask"
	classpath="ADEUMInjector.jar"/>
<injector classfilespath="${out.classes.absolute.dir}"
	outputlocation="${out.absolute.dir}/instrumented-jars/"
	instrumentationjarlocation="${jar.libs.absolute.dir}/ADEUMAgent.jar"
	jarfilesrefid="project.all.jars.path"
	androidjarlocation="${project.target.android.jar}"/>

 

 

 

Make sure that android.jar is not included in the list of files specified by the refid "project.all.jars.path". Otherwise, the injector will fail to instrument your build properly.

Version history
Last update:
‎03-12-2020 06:34 PM
Updated by:
On-Demand Webinar
Discover new Splunk integrations and AI innovations for Cisco AppDynamics.


Register Now!

Observe and Explore
Dive into our Community Blog for the Latest Insights and Updates!


Read the blog here