Knowledge Base

cancel
Showing results for 
Search instead for 
Did you mean: 

Use Ant to Build Android Apps with the AppDynamics Android SDK

 If your build system is ant-based you must:

  1. Add agent files to the project.

  2. Add 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. 

Add the AppDynamics Android Agent files

  1. Create a libs directory in your application root directory. This is often Application and a subdirectory of your project directory. Thus, this is where your libs directory might be located: ProjectName/Application/libs
  2. Copy ADEumAgent.jar to the libs directory.
  3. Copy ADEumInjector.jar to your application root directory.

Add a post-compile target

Do one of the following:

 -- If there is no custom_rules.xml file in your project:

  1. Create a file in your project's root directory named custom_rules.xml.
  2. Copy and paste the following text 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>

     

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

Add the following text to the end of the 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>


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

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}"
/>

 


I
f you are using Eclipse + 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
Revision #:
19 of 19
Last update:
‎10-10-2017 02:18 PM
Updated by:
 
Contributors
0 Kudos