As described in Chapter 1 in connection with the system requirements, the number of computers, smartphones, and other hardware systems on which the constantly evolving operating system Android and corresponding apps are used is steadily growing. With more and more heterogeneous system environments becoming available, there is also an increasing initial risk that these options will diverge from, and not be 100 percent compatible with, the Android specifications in their early stages of development. In turn, they may behave differently in connection with the AI development environment.
For many variations, app development with AI is still possible, even if some of the functions in your system environment behave slightly differently from the ones described here. For that reason, as we mentioned in the context of the settings for your Android device, you should not be afraid to skip a step if necessary and try to find your own solution or simply improvise. This book cannot present all existing options—let alone all future possibilities—together with workarounds, so the following variations are meant to be examples of how you can find alternative solutions for some particular cases to get closer to your aim of developing Android apps with App Inventor.
If the Blocks Editor Won’t Start
If you are trying to start the AI Blocks Editor via the AI Designer button labeled “Open the Blocks Editor,” it is possible that your system might neither automatically start the Web Start Launcher (and, therefore, the Blocks Editor), nor ask if you want to start it, as shown in Figure 2.16. Instead, you may be prompted to save the JNLP file locally. Do so, if possible, in a local directory near your other AI files, to ensure you can find the JNLP file easily later on. Now you can go to the directory and double-click on the JNLP file, which should download, verify, and start the Web Start application Blocks Editor, as shown in Figure 2.17.
If the Blocks Editor still does not start, and you instead see only the Java loading time and then an error message “Could not create the Java virtual machine” as shown in Figure 2.34, you can abort the starting process with by clicking OK.
Figure 2.34. Error message if starting the AI Blocks Editor fails
In this case, you can try to trick the local configuration of Java VM on your computer. The JNLP file for starting the Web Start application Blocks Editor requires a certain amount of available memory, which your local system configuration may not have. If you delete this requirement, there is a good chance that the Java applications can make do with the locally available memory space and will no longer abort the loading process. To edit the JNLP file, open a text editor such as Notepad, present on any Windows operating system. Load the JNLP file via the Notepad menu with File > Load, or simply drag the file from the File Explorer into the Notepad window. Now you can see the XML-based content of the JNLP file. Find the text section max-heap-size="1024m" (see Figure 2.35), and delete it completely. Then save the JNLP file under its original name AppInventorForAndroidCodeblocks.jnlp. Now you can double-click on the edited JNLP file and the Web Start application AI Blocks Editor should start.
Figure 2.35. Delete the memory requirement in the JNLP file and save the new setting
If this manipulation of the JNLP file was successful, the start-up problem may still not be permanently fixed. As the AI development environment is permanently evolving, particularly in the beta phase, new versions of the JNLP file are constantly appearing. As a consequence, you may find that the file starts just fine one day, but not at all the next day. In that case, you need to download the current version of the JNLP file and manipulate it again as described previously so that you can start the AI Blocks Editor successfully. Remember that you still have to click the button “Open the Blocks Editor” in AI Designer and that you will usually be asked if you want to download the most current JNLP file. If this start-up problem occurs, you may want to make it a habit to always overwrite the old JNLP file with the new one when starting the AI Blocks Editor and then manipulate the new file as described before double-clicking on it to start the editor. Ideally, this problem will be fixed after the beta-phase AI is superseded by the final version of the program. Your usual starting procedure for the Blocks Editor could look like this:
- In AI Designer, click the button labeled “Open the Blocks Editor.”
- Save the file AppInventorForAndroidCodeblocks.jnlp locally.
- In the JNLP file, delete the text section max-heap-size="1024".
- Save the edited JNLP file and then double-click on it.
If this measure does not fix the problem, consult the online Help for AI where you will find further information on known problems and solutions, including issues encountered during start-up of the Blocks Editor. You can find the links to the Help and Troubleshooting sites in the later section “Other Problems.”
If the Connection to the Smartphone Freezes
Given that the smartphone you connect to your computer and the AI development environment is an Android device for which the dynamics and heterogeneity described previously can sometimes lead to initial incompatibilities, it also poses the greatest risk for potential problems arising. These issues are most likely to involve connection problems in various manifestations; as a result, the current app may fail to display properly on the smartphone screen. While discrepancies between the representation in the AI Designer’s Viewer panel and the smartphone are common and nothing to worry about, you will need to act if significant malfunctions occur.
First you need to ensure that your system environment and all its components fulfill the requirements for preparation and installation, as described in Chapter 1. This includes a complete and successful installation of the AI Setup Software. Installing the USB driver successfully on your computer operating system and ensuring it can detect the smartphone is vital for an error-free connection to your smartphone. You should have tested this connection with the AI Setup Software’s ADB tool and fixed any problems as described in the section on installing the AI Setup Software—for example, by reinstalling manufacturer-specific drivers and the device driver. You should also have adjusted the settings of your smartphone successfully, as described in the section on Android device settings. If you have not yet met one or more of these requirements, please go back to the relevant section of this book and follow the troubleshooting measures described there.
In the early days of AI, connectivity problems with the smartphone were quite common, so the AI Google Group made repeated attempts to catalog the various smartphones and their specific problems. In addition to the smartphone and Android version used, this overview was meant to list the different components of the development environment, such as the computer hardware used and the operating system. To date, however, these efforts have not progressed beyond individual discussion threads.
The Google App Inventor Team also addresses this problem in its many manifestations in several entries on its “Troubleshooting” website.
There is also a dedicated link to a web page titled “Work-Arounds & Solutions for Connecting Phones to the Blocks Editor” that deals exclusively with connection issues.
Browse this page, and try out the solution for a system or smartphone configuration even if it does not exactly match yours. Perhaps you will be lucky and this solution will also help resolve the problem with your particular setup. If you still cannot find a solution for your connection issue here, you also have the accumulated knowledge of thousands of members of the AI Forum at your disposal. You can search the countless contributions for existing solutions or ask for assistance with your problem, as described in the next section.
If there really is no solution for your individual connection problems and the system components cannot be changed, you still have the option of carrying out your development work using the emulator as an alternative to the smartphone. Once you have developed your Android app with the AI Designer, Blocks Editor, and the emulator, you can get it to your smartphone from the AI Designer in various ways by clicking the button “Package to Phone” and the alternative menu items “Show Barcode” or “Download to this Computer.” As you can see, there is (almost) always a solution!
If you run into any other special problems or difficulties during your development work, first confirm that all of the system requirements have really been fulfilled and that all installations and settings are working correctly and tested. Then have a look in the AI online documentation, which may describe new solutions and approaches that were not yet available at the time of printing of this book.
If you are having problems other than the ones described here, refer to the online Help on AI under “Troubleshooting.” There, you will find further notes on common issues and their solutions.
In some cases, the problem might trace back to the provider. Please refer to the specific information sites of your AI provider to find tips, help, hints, and FAQs.
The AI Forum
If the specific problems of your individual system environment are not covered in the AI documentation and “Troubleshooting” page, you can turn to the App Inventor Forum. Here, like-minded users exchange their experiences with AI and discuss various topics on app development. Surely you will find someone here who can offer tips or even solutions for your current problem. Just as the AI IDE keeps evolving, so the AI Forum has also changed during the course of AI’s beta phase. With the constantly growing number of members and their myriad contributions, the Google moderators found it increasingly more difficult to keep track of their input, structure the topics, and pass the information on for further editing in an organized way. In addition to other measures, such as introducing an Issues List (see Chapter 3), the previously centralized AI Forum “Coffee Shop” was divided into five subforums on November 17, 2010, to better organize this information:
- “AI Announcements”: Official announcements by Google developers
- “Getting Set Up and Connecting Your Phone to AI”: Questions and answers on problems with preparation and installation of AI IDE plus connecting smartphones (If you have questions on the topics in this chapter, this is the right place to look!)
- “Programming with AI”: Questions on app development with AI (Check here if you are having problems during development with AI!)
- “AI in Education”: A special forum on topics about using AI in the classroom (aimed primarily at educators, following the original intention of AI to be an entry platform for programming newbies)
- “AI Coffee Shop”: General discussions on using AI, its future, and its potential as an extension of the former AI Google Group
In addition to immediately seeing the most recent three posts, as shown in Figure 2.36, you can access all posts in each forum by clicking on the forum name. To post your own contributions, you can simply register for the desired forum and submit your posts (except in the “Announcements,” which are reserved for Google developers).
Figure 2.36. Overview of subforums within AI Forum
Above the forum overview, you can find the links to further sources of information (see the top of Figure 2.37) such as the User-FAQ, the “Troubleshooting” website, the AI documentation, and the Issues List. It’s worth visiting this page regularly.
Figure 2.37. Subforum with search field and example posts
Before posting a new question, you should check whether it has not already been asked, discussed, and answered. To search all the posts of the relevant subforum, enter a search term in the box above the forum posts and click the Search button (see Figure 2.37). If posts on the topic you searched for were found, the links are displayed.
Please use appropriate search terms first to look for tips and help. Only if the problem has really not yet been discussed should you describe it in a new post and ask the other members for help with fixing it. Describe your problem as accurately as possible and submit your post. To do so, you first need to register in the relevant subforum. Then you just have to wait for an answer from the group, which usually does not take long. Together with the helpful and dedicated group members, you will certainly soon find one or more answers to your particular questions.