Setting up your development environment for App Inventor



Before we get stuck into coding we first have to ensure that we have the correct software installed to be able to compile our code into a working extension.

Summary of required dependencies
  • JDK 7u80
  • Ant 1.9.9
  • Git
  • App Inventor sources
  • Java code editor

  1. The first step is to install the Java Development Kit, for best results stick to the latest version of JDK 7 which should be JDK 7u80. You will need an Oracle account to download it. Download and install JDK 7 here: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
  2. Next you will need to download and install Apache Ant, a Java library and command line tool which assists with building software. Make sure to download version 1.9.9, which is compatible with JDK 7, Version 1.10 of Ant is not compatible with JDK 7. Download Apache Ant here: http://ant.apache.org/bindownload.cgi
  3. Once you have downloaded Apache Ant, Extract the Zip file to "C:\Program Files\" you should have "C:\Program Files\apache-ant-1.9.9" inside you should have various files and folders.
  4. Next we need to set environment variables in Windows, this tells the computer where to look for various libraries and tools contained within JDK and Ant. To make this process easier I have created a .bat file which will set these for you which is included in my App Inventor installation kit, open the installation kit and right-click on the "SetEnvironmentVariables.bat" to Run as Administrator. Download Installation Kit
    To create Environment variables navigate to Control Panel > System > Advanced system settings > Environment Variables
    1. Create JAVA_HOME "C:\Program Files\Java\jdk1.7.0_80"
    2. Create ANT_HOME "C:\Program Files\apache-ant-1.9.9"
    3. Create CLASSPATH "%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar;%ANT_HOME%\lib"
    4. Add to PATH "%JAVA_HOME%/bin;%JAVA_HOME%/jre/bin;%ANT_HOME%\bin"
  5. Next you will need to download and install Git, App Inventor uses this to connect to various repositories and update sources. Install Git using all the default settings. Download Git here: https://git-scm.com/downloads
  6. Lastly you will need to download the App Inventor sources which contains all of App Inventor's open source code and dependencies you will require. Download the App Inventor Sources here: https://github.com/mit-cml/appinventor-sources
    Note: the sources are quite large at over 250MB
  7. On the sources GitHub page, click "Clone or download" in the top right of the screen, then click "Download ZIP"
  8. Extract the ZIP file to "C:\appinventor-sources-master"
  9. Browse to "C:\appinventor-sources-master\appinventor\" and paste the "compile.sh" file from the installation kit.
    Navigate to "C:\appinventor-sources-master\appinventor"
    1. Create a file called compile.sh
    2. Edit the file in notepad and type in "ant extensions"
    3. Press enter and type in "read"
    4. Save and close
  10. Finally, from my setup kit, copy all the links in the shortcuts folder to your desktop or another desired location, these give you quick and easy access to the different locations in the App Inventor sources.
Now if you have completed all these steps correctly you should have a working development environment for developing extensions for App Inventor. The last thing you will need to install is a Java code editor if you don't have one already.

If you are just learning Java jedit might be a good option for you, if you are a more experienced programmer than one of my personal favourites is Notepad++.


Continue Learning

The next lesson in this series goes through App Inventor Coding Conventions, check it out!

(C) ThunkableBlocks 2017

Was this helpful?

Yes No

Comments

  1. hello
    i have problems with ANT HOME
    can you help me?

    ReplyDelete

Post a Comment

Thunkable Components