Frequently Asked Questions
FAQs
This page contains tip and solutions to common problems students experience in Android development
-
How do I create a Java project in Android Studio?
- Run Android Studio and create a new project (File -> New -> New Project).
The default options should be sufficient. This will create a new project with a single module named "app".
The "app" module is, of course, an Android app. For a non-Android project, this module is not needed, but having it there doesn't hurt anything either.
- Within the new project create a new module (File -> New -> New Module). For the module type select "Java Library".
This new module will contain the non-Android code for the project, and should be named accordingly. (For example,
if you were developing the Family Map Server, you might call this module "server".)
- Android Studio should have created a package in the new module named com.example, we recomend deleting this package and its contents. Then create your own new package and class. Add a main method to this class.
- To run the new main method, in the tree view on the left, navigate to the new class (e.g., "MyClass"), right-click on it,
and select either "Run MyClass.main" or "Debug MyClass.main" to either run or debug the program.
- To insert command line arguments, on Android Studio's top bar, click on the down arrow next to the play button, then "Edit Configurations". Then type the arguments in the "Program Arguments" field.
-
How do I receive TA help?
- Go here to get in the queue.
- For a full list of policies go here.
- If you are asking for clarification, please read the specifications in full before asking for help.
- If you are asking for help in debugging you must do each the following: Spend at least 30 min. working on your own, Google the question, READ YOUR BOOK.
- Also, if they are in the labs other than during their posted hours, they're doing homework for other classes.
- Remember one purpose of this class is for you to learn how to learn. If we feel you are not putting forth your full effort or for any other reason we may ask you to return later when you ave fulfilled these requirements.
-
How do I pass off the first three labs?
- We will be running a test driver from the TA machines, in order to do this we will need to know the file path to the source files from your home directory on the lab machines.
- We recommend copying all .java files you have created into a temporary folder in your home directory on the lab machines.
- Make a note of the file path then enter the queue for pass off.
- Remember any changes you make to your code will not affect the code in the temporary file so you will need to re-copy them over.
-
My Javadocs are not showing up even though they are in my public_html
- Be sure you have changed the file permissions so that the public can view them. To do this try using "chmod 755 -R ~/public_html"
-
How do I look at my SQLITE database?
- Here is a usefull Application you can use for Windows, Mac and Linux here
-
I have no idea how to use SQLITE, what should I do?
- This website here has great java examples for most SQLITE commands.
-
How do I use GSON in my project?
- The solution is to download a copy of the GSON .jar file from the web.
- Put it in the root folder of your project (or anywhere else you like).
- Create a "New Module" in your project of type "Import .JAR/.AAR File", and point it at the GSON .jar file in your project.
- In the "Project Structure" dialog, to your "server" module add a module dependency on the new GSON module you created in the previous step.
- Your server should now be able to find the Gson class (assuming you have an appropriate import statement in your server code such as import com.google.gson.Gson;
OR
- The solution is to download a copy of the GSON .jar file from the web.
- Put it in the libs folder of the server module
- In the "Project Structure" dialog, to your "server" module add a jar dependency on the new GSON jar from the previous step.
- Your server should now be able to find the Gson class (assuming you have an appropriate import statement in your server code such as import com.google.gson.Gson;
-
How do I generate a personID, eventID, or Authorization Token?
- You can use UUID.randomUUID.toString() to generate a string of length 36 consisting of uppercase letters, lowercase letters, and numbers.
-
My URL looks right, but it says I can't connect to the server. Fix it? Please. #thankyou
- Make sure your server is running
- Make sure your
AndroidManifest.xml
to allow access to the internet (see here)
- Make sure your device is on the same network as the computer running the server. We find it works best if both machines are on the CS dept. WiFi. This is what the lab machines run on.
- The server gives several options for IP addresses; try different ones if it is still not working.
-
My map shows up as a gray box with the google symbol in the bottom left. What is going wrong?
- Check your android monitor to see if it is reporting a invalid key error. If so go here and get a new key. Replace the key in your manifest with this key.
- If you are on campus be sure your device is on the CS Department WiFi. When you sign in it will ask for your netId and CS password. BYU Secure will work for some people. BYU guest does not work.
-
How do I use Google Maps with Android Studio?
- Google itself has a great tutorial here.
- We recommend that you create a new project to follow the tutorial then apply it to your own code.
- To create the Google maps activity we recommend you use New-> Activity-> Gallery-> Google Maps Activity. This will update the Android manifest and generate an XML for you.
- Follow the instructions in the generated XML and android manifest as to how to add the app to the registry.
- If you are on campus we find it works best if you are connected to the CS dept. WiFi.
-
How do I use Amazon Maps with Android Studio?