Where to Place .jar file

104 views
Skip to first unread message

clashw...@gmail.com

unread,
Mar 18, 2019, 9:18:14 AM3/18/19
to App Inventor Open Source Development
Dear all,
Can any one please tell me where to place.jar file i want to use volley library for making an extensions.
where i need to place that jar file and what to be added in build.xml for build to find my library please help me.

i tried this but its is not working.

4h. Including external libraries

Some components, such as Twitter, require external libraries (twitter4j.jar).  Here is how to add a jar file referenced by your component source file.

Adding to appinventor/lib

The appinventor/lib directory contains one subdirectory for each external library.  For example, there is a subdirectory appinventor/lib/twitter.  Each of these subdirectories should contain the following files:

  • LICENSE: a text file with the license under which the library was made available.
  • README: a text file detailing where the library was downloaded from and/or how it was built.
  • one or more jar files

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.xmljavadoc target
  • appinventor/buildserver/build.xmlBuildServer target
  • appinventor/components/build.xmlAndroidRuntime target
  • appinventor/components/build.xmlai.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” />

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”. The toFile 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.

Abhijith Dominic

unread,
Mar 18, 2019, 9:21:50 AM3/18/19
to App Inventor Open Source Development
The New Build.xml Files are different Compared to the Old ones

clashw...@gmail.com

unread,
Mar 18, 2019, 11:40:08 AM3/18/19
to App Inventor Open Source Development
after this fix https://github.com/mit-cml/appinventor-sources/pull/1605 i am not able to find where to place .jar file

Evan Patton

unread,
Mar 19, 2019, 2:01:11 PM3/19/19
to App Inventor Open Source Development
You should place the JAR files you need in the CopyComponentLibraries target in components/build.xml. I'll update the documentation to reflect this change.

Regards,
Evan

Abhijith Dominic

unread,
Mar 19, 2019, 2:08:27 PM3/19/19
to app-inventor-o...@googlegroups.com
So Now only 1 Build File Has to be edited to add a jar file? Yeay

--
You received this message because you are subscribed to a topic in the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-open-source-dev/ZR7KbbqQW-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-inventor-open-so...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at https://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.

clashw...@gmail.com

unread,
Mar 19, 2019, 4:27:03 PM3/19/19
to App Inventor Open Source Development
which one should i add in CopyComponentLibraries 
1 <copy toFile=”${classes.files.dir}/simplifiedNameForJARFile.jar” file=”${lib.dir}/subfolderNameFromStep1/nameOfJARFileToAdd.jar” />
 OR 
2 <copy toFile="${public.deps.dir}/simplifiedNameForJARFile.jar" file="${lib.dir}/subfolderNameFromStep1/nameOfJARFileToAdd.jar" />

which one is correct

Evan Patton

unread,
Mar 19, 2019, 5:13:12 PM3/19/19
to App Inventor Open Source Development
The second option is the correct one now.

Regards,
Evan

Evan Patton

unread,
Mar 19, 2019, 5:16:36 PM3/19/19
to App Inventor Open Source Development
Yes. I have also submitted another PR for review that simplifies this even further by making it so that there is only a single location to change.

Regards,
Evan

On Tuesday, March 19, 2019 at 2:08:27 PM UTC-4, Abhijith Dominic wrote:
So Now only 1 Build File Has to be edited to add a jar file? Yeay

On Tue, 19 Mar, 2019, 11:31 PM Evan Patton, <ewpa...@gmail.com> wrote:
You should place the JAR files you need in the CopyComponentLibraries target in components/build.xml. I'll update the documentation to reflect this change.

Regards,
Evan

On Monday, March 18, 2019 at 11:40:08 AM UTC-4, clashw...@gmail.com wrote:
after this fix https://github.com/mit-cml/appinventor-sources/pull/1605 i am not able to find where to place .jar file

On Monday, 18 March 2019 18:51:50 UTC+5:30, Abhijith Dominic wrote:
The New Build.xml Files are different Compared to the Old ones

--
You received this message because you are subscribed to a topic in the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-open-source-dev/ZR7KbbqQW-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.

clashw...@gmail.com

unread,
Mar 20, 2019, 2:42:53 AM3/20/19
to App Inventor Open Source Development
written second line in CopyComponentLibraries i.e <copy toFile="${public.deps.dir}/volley.jar" file="${lib.dir}/volley/volley.jar" /> and pasted volley.jar file in C:\appinventor-sources\appinventor\lib\volley but still i get error i.e symbol cannot found. please see attach error log image
error log.png

clashw...@gmail.com

unread,
Mar 20, 2019, 9:29:45 AM3/20/19
to App Inventor Open Source Development
after removing .java file which i have made when i write ant extension i get build success and i can see my jar file copied at build\components\deps but when i add back my. java file i am getting error that symbol not found i heard that this error is of classes or lib not found . i checked at  build\components\deps there is my jar file available why then i am getting this error

Jose Dominguez

unread,
Mar 20, 2019, 10:16:23 AM3/20/19
to app-inventor-open-source-dev
Do you have the right import statements in your Java file?

cheers,
José
> --
> You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.
> To post to this group, send email to app-inventor-o...@googlegroups.com.
Message has been deleted
Message has been deleted

clashw...@gmail.com

unread,
Mar 20, 2019, 10:29:05 AM3/20/19
to App Inventor Open Source Development
Please see attach how i am importing library
> To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
importmain.png
import.png

clashw...@gmail.com

unread,
Mar 20, 2019, 1:14:07 PM3/20/19
to App Inventor Open Source Development


On Wednesday, 20 March 2019 19:46:23 UTC+5:30, Jos wrote:
> To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.

clashw...@gmail.com

unread,
Mar 21, 2019, 3:03:17 PM3/21/19
to App Inventor Open Source Development
help me please


On Wednesday, 20 March 2019 19:46:23 UTC+5:30, Jos wrote:
> To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.

Evan Patton

unread,
Mar 21, 2019, 7:53:39 PM3/21/19
to App Inventor Open Source Development
The fact that Context is missing also makes me believe that not all of the correct import statements are there. Context is part of the Android core library, and the whole system wouldn't build if it weren't available (not just your extension). Given that this is an Android library, was it provided as an AAR file instead of a JAR file? If so, you need to extract classes.jar from the AAR file and include that. Otherwise, just renaming the AAR to JAR won't allow the build system to recognize it.

Regards,
Evan

clashw...@gmail.com

unread,
Mar 22, 2019, 2:12:50 PM3/22/19
to App Inventor Open Source Development
the library is here https://github.com/google/volley and i have created jar using command in git bash for making jar files.
i guess there may be problem with my jar. 
Reply all
Reply to author
Forward
0 new messages