Help Regarding Extension Building Process

How Can I Use External Library To Build An Extensions…

I AM USING IN MY PC .I M NOT USING IDE. I ALREADY KNOW CUSTOM LIB NOT SUPPORTED IN IDE. SO, tELL mE tO uSE IN MY PC

If you are building on your own you need to provide the Jar files.

i have jar file with me but how to loacte jar file for building extensions

In your App Inventor Source there will be a lib folder inside that make a folder and name it whatever you want and inside that place your jar file. After that follow these steps

Adding to build.xml

The path to the new library should be added to the build.xml files wherever there are references to the Twitter library:

<pathelement location=${lib.dir}/twitter/twitter4j-2.0.10-SNAPSHOT.jar” />

At the time of the writing of this document, these locations are:

  • appinventor/build.xml: javadoc target
  • appinventor/buildserver/build.xml: BuildServer target
  • appinventor/components/build.xml: AndroidRuntime target
  • appinventor/components/build.xml: ai.apt macro definition

If the Javadoc in your component links to the Javadoc for the external library, you should also add a link entry to the javadoc target in appinventor/build.xml.

You will also need to modify the build.xml file in the /buildserver/ directory (this is the file at appinventor/buildserver/build.xml) to include a line for your jar file in the list of <copy> tags under the “BuildServer” target.

Only one modification should be necessary to add your jar file to the list of <copy> tag declarations.

The format for this <copy> entry should be the following:

<copy toFile=”${classes.files.dir}/simplifiedNameForJARFile.jar”

      file=”${lib.dir}/subfolderNameFromStep1/nameOfJARFileToAdd.jar” /&gt;

Note: in each <copy> tag, the file attribute refers to the path at which you placed your jar file in appinventor/lib. The “${lib.dir}” equates to “appinventor/lib”. ThetoFile attribute states the path into which the file will be copied during the ant build process. The “${classes.files.dir}” refers to the path “appinventor/buildserver/build/classes/BuildServer/files”. After the ant script finishes executing the BuildServer ant target, you should be able to navigate to appinventor/buildserver/build/classes/BuildServer/files and verify that your jar file did indeed get copied.

Note that all these changes are necessary to use the ant build system in the command line. If you use an IDE such as Eclipse, you will also need to add the new jar files in the Build Path or your project.

Using the library in your component

Your component should contain a “@UsesLibraries” annotation, for example:

@UsesLibraries(libraries = “library1.jar,” + “library2.jar,” + … + “libraryN.jar”)

Hope you understood it or read it a few times which helped me understand it at first

5 Likes

i found the xml where to past the phatelement under buildserver target please tell me i dont know it

remain 2 lines i have to add to buildserver.xml but where i am confuse please help me placing these 2 line

<pathelement location="${lib.dir}/volley/volley.jar"/
<copy toFile=”${classes.files.dir}/volley.jar” file=”${lib.dir}/volley/volley.jar” /