Begin Programming FAQs
This step aims to address some of the common problems that have been identified from your comments and questions.
My question is not answered. What should I do?
If you have an error message put your exact error message into a search engine (such as Google) you can often find helpful answers from sites like Stackoverflow. Try using the most voted answer (if it matches your system).
If you have another unaddressed query, using a search engine can help, make sure to include the operating system you are using in the search term.
If you find useful answers do share on the FutureLearn platform.
Sharing images and code on FutureLearn
- I am on a Windows 32-bit machine and when I download the Java JDK the file doesn’t work
- I can’t install Java JDK on my phone
- No Java Virtual Machine was found
- I get error ‘javac is not recognized as internal or external command’
- I have the PATH Problem
- JAVA_HOME issue
- Uninstalling JDK
- I am on a Mac and get error “Java not found Android Studio was unable to find a valid JVM” but my PATH is correct!
- Android SDK path not specified
- How do I properly uninstall Android Studio ?
- I get an error ‘Could not run build action using Gradle installation’
- I get error ‘Android Studio was unable to find a valid JVM’
- I get error ‘ … Android Gradle plug-in requires Gradle . . .’
- I get error ‘the following SDK components were not installed’
- Gradle Sync has not build the manifests folder
- Unable to start the daemon process
- How to I stop the app when it is running?
- I have non-English characters in my username and Android Studio won’t work!
- The rendering library has been automatically updated, and uses a newer version than the code…
- Can I change the font size?
- Android Studio comes up with Parental Controls message!
- How to view line numbers in the editor?
- I get error ‘… This version of %1 is not compatible …’
- My emulator reboots!
- My program doesn’t do what I want it to do!
- My emulator shows a padlock!
- I get error ‘The memory needed by this VM exceeds the driver limit’
- I get error ‘Error: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed’’
- AVD is already running, if this is not the case delete files …
- Failed to create Context 0x3005 could not get wglGetExtensionsStringARB
- PANIC: could not find ….ini file
- When I run the application in the emulator I get “UNEXPECTED TOP-LEVEL EXCEPTION”
- Error: Unknown target
- Something else is happening!•
Setting up the Device
- Will this game break my device if I make a mistake?
- My device is not shown after connecting with the USB cable?
- My game changes do not show in phone?
- I get a dialog showing that the device is unauthorized!
- I get error ‘Application Installation Failed!’
- My device still doesn’t connect!
- ‘signingConfig.storeFile’ is not a file’
- keytool error: java.lang.Exception: Keystore file exists, but is empty
- Tilt won’t work in my device help!’
- My device appears as device ???????????? [nul] and does not work
- I get a “parse error” on my device so cannot install the program after emailing
- I can’t unzip!
- My unzipped folder is missing some files
- I can’t access the sites to download installations!
- The code in the Windows Notepad is not coloured and it all shows on one line!
- The video is too fast!
- When I try to copy and paste I get “Cannot paste the clipboard contents into the selected element”
- Where to find System Details?
- Where can I find screen resolution?
- How can I save my game?
I am on a Windows 32-bit machine and when I download the Java JDK the file doesn’t work
Unfortunately, there currently seems to be an issue with the Windows 32-bit version of the JDK from the Oracle website. If it does not execute, please try and re-download it as that usually solves the problem. You might have to do it a few times before it works.
I can’t install Java JDK on my phone
The JDK only allows you to write Java code on your computer, so it won’t work on your phone.
No java virtual machine was found
I get the error “No java virtual machine was found after searching the following locations”
Go to the step Check your JDK Installation . Open up a command prompt window and type javac -version. A version of the Java you are running should be displayed, if you don’t then you can follow this video to set the Java executable to the PATH variable:
- Windows 7/Vista (Note: this video refers to Eclipse, a different IDE that can be used to develop Java programmes. But the step to setting up Java is the same.)
- Windows 8/10
I get error ‘javac is not recognized as internal or external command’
Follow this video to set the Java executable to the PATH variable:
Remember: NO spaces between path locations and locations are separated by a semicolon
Windows 7/Vista (Note: this video refers to Eclipse, a different IDE that can be used to develop Java programmes. But the step to setting up Java is the same.)
Windows 10 (Note: This video follows installing the JDK 8 whereas for this course you will need the JDK 7 which can be found here otherwise the instructions in the video will help solve the ‘javac not recognized’ issue)
I have the PATH problem
Windows 7: Start menu > Computer > System Properties > Advanced System Properties> Advanced tab > Environment Variables.
Windows 8: Open Windows Explorer > right-click This PC > Properties > Advanced system settings > Environment Variables
Windows 10: Right click the start menu > System > Advanced system settings > Environment Variables
Look for a variable called “JAVA_HOME”. If not found, add it with the location of the SDK-folder (generally :C:\Program Files\Java\jdk1.7.0_XX where XX refers to the version).
If you have a version of the JDK you want to uninstall, the steps vary with operating systems.
Swipe in from the right edge of your screen and then tap or click Settings. Alternatively you can press the Windows key + C to open the charms and then select Settings.
Select: Control Panel->Programs->Uninstall a program
Select the JDK program to uninstall (the program name will be something similar to ‘Java SE Development Kit # Update ’ and ‘Java # Update *’ where ’#’ is the version number and the ‘’ is the update number of the JDK you want to uninstall) and click Uninstall. If you have both these programs installed you will have to uninstall one at a time.
You will be prompted to confirm the uninstall; click Yes.
Click on the Start button, select:
Control Panel->Programs->Uninstall a program
Find and select the entry for Java, for example:
Java SE Development Kit # Update <number>
Then click the Uninstall button (near the top of the page - you may be asked to confirm). If there is another file, called something like:
Java 8 Update <number>
That should also be uninstalled.
and remove the directory whose name matches the version you are trying to remove, for example:
rm -rf jdk1.7.0_79.jdk
Depending on the privileges you have on the computer you may need to use the sudo command:
sudo rm -rf jdk1.7.0_79.jdk
Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software!
The way of doing this varies between Linux distributions, with Ubuntu the specialized version system ( “update -alternatives” that we ran in setting up) means you should not need to uninstall. #Android Studio
I am on a Mac and get error “Java not found Android Studio was unable to find a valid JVM” but my Java is correct!
When installing Android Studio on a Mac, with Java JDK correctly installed, you can get this error message.
“Java not found Android Studio was unable to find a valid JVM”
There is a quick solution that will work immediately but may need to be repeated if the problem re-occurs, and a permanent solution that will stop it re-occurring. We recommend starting with the quick solution.
In a terminal window:
Find your java version using:
it will return something like:
(if you get something other than a number starting 1.8 you have a PATH problem, see the step on checking your JDK install.) Then type:
launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk
replacing 1.8.0_91 with your version number.
The re-launch Android Studio and it will launch. If this works but later on you get the error message “Java not found Android Studio was unable to find a valid JVM” again try the solution below.
Solution (using this answer from StackOverflow)
First locate your JVM
- Open Finder
- Navigate to and open Library
- Open Java
- Open JavaVirtualMachines
- Notice the Java folders name
The Java folder name is then /Library/Java/JavaVirtualMachines/YOURJAVAFOLDERNAME.jdk
Open the Script Editor. Create a new Document and insert this line:
do shell script (apple script) “launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/YOURJAVAFOLDERNAME.jdk”
Change the name to e.g. SetupJavaJDK in the Export As box
Change the Where box to Applications
Change File Format to Application
Tick the Run-only option
Now run the SetupJavaJDK from the launcher. Then run the Android Studio again and it should work.
This solution from stackoverflow has also helped participants.
Android SDK path not specified
You should specify the SDK directory location by going to
File > Project Structure > SDK Location
Note: the location of your SDK path is where the SDK has been saved. To find where this is in your computer search for “AVD Manager” (using Windows Explorer, Finder or similar). This is of the files in the SDK folder. When you find the location add that as the SDK location.
How do I properly uninstall Android Studio?
If you find you need to uninstall Android Studio on any operating system you need to be sure that not only delete Android Studio, but you also delete the hidden files that are associate with it, which does not always happen with normal uninstall processes. The hidden files are .android, .AndroidStudio and .gradle.
Uninstall Android Studio by either using the Control Panel->Programs->Programs and Features
or by deleting the Android folder in Program files.
Locate the .android, .AndroidStudio and .gradle files (these are hidden files so you will have to first allow hidden files to be seen) from your user home directory (likely to be C:\Users<user name>) and delete them.
Open your Applications folder (Finder->Go); move Android Studio to Trash, and empty the trash.
Open your Library folder (Finder->Go – hold down the Alt key if Library is not visible). Look for any files with AndroidStudio in the name in the ~/Library/, ~/Library/Preferences/, and ~/Library/Application Support/ folders and move these to Trash, empty the trash.
Linux: Uninstalling will depend on how you originally installed and the location you chose. In general locate the directory you chose to install in and delete the android-studio directory. Look for the hidden files .android, .AndroidStudio and .gradle in your home directory and delete them.
I get an error ‘Could not run build action using Gradle installation’
When opening MOOC project I get ‘Error:Could not run build action using Gradle installation ’.
Windows: To resolve this you need to reinstall AndroidStudio but before that need to remove Android folder from Program files; .android .gradle and .AndroidStudio from user home – see Uninstalling Android Studio on Windows for details. We haven’t seen the problem with Linux or Mac but a similar solution to Windows should work – let us know if it does.
I get error ‘Android Studio was unable to find a valid JVM’
Have a look at this answer from StackOverflow for the solution.
I get error ‘ … Android Gradle plug-in requires Gradle . . .’
If there had been updates to the systems used by Android Studio you may get messages similar to:
‘Version X.X.X of the Android Gradle plug-in requires Gradle Y.Y.Y or newer. A local Gradle distribution was not found, or was not properly set in the IDE. Would you like your project to use the Gradle wrapper instead? The wrapper will automatically download the latest supported Gradle version’.
Click ‘OK’ and the problem should be automatically resolved.
I get error ‘the following SDK components were not installed’
Following solutions have helped solve this issue
- Install packages
Goto the directory “\AppData\Local\Android\sdk” and run “SDK Manager.exe” as administrator (right-click and select run as administrator). In the SDK manager click “install packages”
- Configure a proxy for Andorid Studio. Here:
Then change the line about proxy configurations like this:
<option name=”USE_HTTP_PROXY” value=”true” />
<option name=”USE_PROXY_PAC” value=”false” />
<option name=”PROXY_HOST” value=”your proxy server” />
<option name=”PROXY_PORT” value=”your proxy port” />
Gradle Sync has not build the manifests folder
Error: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html Please read the following process output to find out more: Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
See this post from stackoverflow to find a solution
Unable to start the daemon process
Error:Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html Please read the following process output to find out more: ———————– Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
Try to run as Administrator (right-click on the program and select ‘Run as administrator’)
On Windows Control Panel > System > Advanced> Environment Variables > System Variables >New Variable name _JAVA_OPTIONS and Variable value -Xmx512M
How do I stop my App when it is running?
- You can stop the app on the phone
- Restart the code from Android Studio – this will stop the app and restart it
- The ultimate kill is to click the 6: Android on the bottom bar of Android Studio screen > select the app by package name and press terminate app
I have non-English characters in my username and Android Studio won’t work!
Unfortunately we have seen this happening with non-English character user names and folder names. Try and move the project folder to a place where there are only alpha-numeric characters in the path. Java does not always work reliably with unusual character sets.
The rendering library has been automatically updated, and uses a newer version than the code…
The full message is: The rendering library has been automatically updated, and uses a newer version than the code. The safest is to change the preview renderer to avoid seeing this error message
The problem comes from the preview functionality of Android Studio. A recent update introduced a new level API 22 (Preview), which seems to be problematic. You need to change the version of the design preview to a lower number, e.g. 21 which is the number that we use in our code. See this stackoverflow answer
Can I change the font size?
To adjust font size of buttons and tools area go to: menu File > Settings > Appearance > tick Override default fonts by (not recommended) and adjust the size to your liking
To adjust the editor font size go to: menu File > Settings… Editor use the drop down arrow > Colors & Fonts use the drop down arrow > Font You will have to use Save As to create a custom profile that you can then edit.
Android Studio comes up with Parental Controls message!
If your computer has a parental control system set up, that could/would be stopping the code from running. These parental systems functions like proxy servers, which are a “middle man” on your internet connection and can then allow/disallow connections.
When you run an Android app from Android Studio you actually create an internet connection in the background between the computer and the phone/emulator. The parental system would see this and possibly disallow it. If this is the case there isn’t much we can do other than say that you need a computer that doesn’t have this installed, and you need full admin rights on the machine to be able to develop Android
How to view line numbers in the editor?
Use the menu options File > Settings. On the Settings dialog on the left hand side under IDE Settings go to > Editor > Appearance. Now on the right hand side tick the box next to ‘Show line numbers’
I get error ‘… This version of %1 is not compatible …’
This error occurs when using the 32bit JDK with the new version of Android Studio (Version 2.2.2). The Gradle plugin that is used to build the project automatically seeks for the 64bit version. To work around this we need to tell Android Studio to use the JDK that has already been installed. Follow these steps:
- Open the Project Structure Dialogue, by clicking on the file menu in the toolbar
- Uncheck the ‘Use Embedded JDK (Recommended)’ option
- Update the JDK location to the one you have installed
- That’s it, Android Studio should now work!
My emulator reboots!
My program doesn’t do what I want it to do!
This is likely to be due to a mistake in the logic you have entered. If you cannot figure out how to correct the logic, post a message giving as much information as possible with a copy of your source code (see how to upload source code here). Say what you are trying to do and what the game is instead doing. This will help someone to spot the mistake and help you.
My emulator shows a padlock!
If the emulator is not interacted with for some time, similar to an inactive Android phone it locks the screen. You can click on the pad lock and drag it out (until the lock opens) to unlock it.
I get error ‘The memory needed by this VM exceeds the driver limit’
Go to installdir\sdk\extras\intel\Hardware_Accelerated_Execution_Manager and run intelhaxm-android. Hit next and then Change. There you will see show much memory the HAXM has. Set it to default /2GB/. After that, on the screen when you name the virtual device, there is a button “Show Advanced Settings”. Scroll down and find RAM. Set the RAM to something lower than the HAXM memory /512-768M is ok/ and it should work.
I get error ‘Error: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed’
The full error message is: Emulator: Error: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable. CPU acceleration status: HAX kernel module is not installed! HAXM only works on very specific hardware.
So if this error comes, it probably doesn’t work on yours. Use ARM emulator. This is explained in the video in the step ‘Setting up an emulator’
AVD is already running, if this is not the case delete files …
A lock file is created to avoid multiple sessions of the same emulator. It is usually maintain automatically. However if something goes wrong it might not be deleted. Restart the computer to ensure everything is back to normal. Try and start the emulator. If the error persists, go and find and delete the lock file from /Users/…/.android/avd/<AVDname>.avd/*.lock
Failed to create Context 0x3005 could not get wglGetExtensionsStringARB
Try to enable shapshot, that might work. If it doesn’t try and increase the RAM level of the emulator. Try a different emulator type and tinker with it. This is frustrating, but unfortunately the way emulators are in Android development. The ultimate solution will be to use a real device
PANIC: could not find ….ini file
If your user name contains non-standard English characters this can happen. Make sure your user name and directory paths do not contain these special characters.
When I run the application in the emulator I get “UNEXPECTED TOP-LEVEL EXCEPTION”
We have seen this happening when non-English characters are involved in username or folder names. See answer for I have non-English characters in my username and Android Studio won’t work!
Error: Unknown target
Open SDK Manager (robot behind down arrow box icon). Select the API level your error message says is missing (for example: for unknown target android-19 you need to select API 19). Now install the selected API level.
Something else is happening!
Post your problem in the comments for the step you are on. Give as much detail as possible. Are there error messages? Any other messages that might be relevant? Did something unexpected happen? The more you give the easier it is for the team to help. Perhaps add a link to a screenshot (See here how to post screenshots).
Setting up the device
Will this game break my device if I make a mistake?
When writing apps it is almost impossible to write code that will destroy you phone. There are many “safety nets” in place from Google that needs to be removed in order to do anything damaging. So generally speaking, do NOT change anything in the AndroidManifest.xml file that is have given to you. This is where a “safety net” can be removed from. Only change it if you know what you are doing. Even then there is an even stronger “safety net” that means that apps cannot cause real havoc, and that is that devices are delivered as “unrooted” devices. That means you do not have access to the really vital parts of the device.
If the device does not show up in the list of devices after connecting, it could be that you are using a ‘charging USB cable’ rather than a ‘data USB cable’. The package of the USB cable should say what it is.
If you are using the APK file method to get the game to your device you may have forgotten to resend the APK file to the phone and install it. Each time a change is made, the APK file needs to be sent to the phone and installed.
I get a dialog showing that the device is unauthorized!
When the device is connected there will be a pop-up on the device asking for authorization. But if you have missed authorizing the device this dialog will show up. Reconnect the USB cable and pay attention to the device screen. When the authorization message pops up authorize the device.
I get error ‘Application Installation Failed!’
This may happen if you are developing on two different machines and running the app on the same phone.
The message will say ‘Installation failed since the device already has an application with the same package but a different signature. In order to proceed, you have to uninstall your existing application. WARNING: Uninstalling will remove the application data!. Do you want to uninstall the existing application?’.
Click ‘OK’ to uninstall the app.
My device still doesn’t connect!
This post may help you
‘signingConfig.storeFile’ is not a file
Error:A problem was found with the configuration of task ‘:app:packageRelease’. File ‘D:\My Programming\Key Store Path’ specified for property ‘signingConfig.storeFile’ is not a file.
Try this stackoverflow solution
keytool error: java.lang.Exception: Keystore file exists, but is empty
Try this stackoverflow solution
Tilt won’t work in my device help!
Google recently changed how the tilting is done, which we are now using to remove warnings that our old code base had. Unfortunately some of the very cheap phones therefore lose the tilt functionality. We have checked Google’s resources but they do not have any fixes for this problem yet. You can still follow the course and complete all the exercises by sticking to touch screen interaction.
My device appears as device ???????????? [nul] and does not work
?????? usually happens when the connection is not approved. If you take out the USB and put it in again then a pop-up should appear on your phone. Be quick, it goes away quite fast. You need to approve the connection and the device will be identified.
I get a “parse error” on my device so cannot install the program after emailing
You don’t necessarily have to e-mail it. If you use a cloud app (like Dropbox, Google Drive, SugarSync, Box, etc.) you can just simply save the APK file in a shared folder and then after the file synchronization you can just access the APK from your phone and install it.
I can’t unzip!
- This can happen due to a downloaded file being corrupt – if this is the case you can re-download the file and then unzip it.
- I get asked for a password! – If this happens please use a different software tool to unzip the package. On Windows machines you can download 7Zip.
- I don’t know how to do it – a step-by-step guide for Windows users is available.
This can happen due to a downloaded file being corrupt – if this is the case you can re-download the file and try again. If on Windows we recommend using 7Zip free software to unzip.
I can’t access the sites to download installations!
- If you have trouble with downloads try using a different browser. Eg. if Android Studio is not downloading in your Windows machine on Chrome browser try Internet Explorer.
- Some participants informed us that they could not access the links we had provided. From China searching for the download in Baidu and then downloading it from the links shown in the search engine had helped.
The code in the Windows Notepad is not coloured and it shows the code on one line!
Notepad is not good for coding purposes. Try an alternative, e.g. Notepad++ or Wordpad for Windows, TextWrangler for Mac OSX or Kate for Linux. Feel free to suggest your favourites in the comments.
The video is too fast!
- Try downloading the transcripts and reading along.
- You can play the video at reduced speed by hovering over the video and selecting ‘0.5x’. Karsten will sound funny though.
When I try to copy and paste I get “Cannot paste the clipboard contents into the selected element”
You probably haven’t unzipped the file. Try and do that first. You may want to look at I Can’t Unzip!
Where to find System Details?
- Ubuntu: to find 32 bit or 64 bit - Open a terminal (Ctrl + Alt + T) and type:
interpret your result to see whether it is 32 bit or 64 bit using this post
To find available hard disc space – on a terminal type:
- Mac: Click the Apple icon on the top left and select About this Mac. Click on More Info… in the About this Mac window
To find available disc space go to Apple icon on top left > about this Mac > System Report > Storage.
Where can I find screen resolution?
How can I save my game?
This blog post will show you how to save a copy of your game code. Note: if you want to use a proper version solution you could use Git or Subversion.
© University of Reading