android studio

Android Studio 3 Error: Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly alvin March 6, 2019 - 6:20pm

When I tried to open an Android project with Android 3 that I probably created with Android Studio 2 and haven’t worked on in about two years, I got this error message:

Code snippets for rapid prototyping of Android Studio apps

This is a list of Android code examples I’m starting to allow me to create rapid prototypes of Android applications using Android Studio. This is a very early list, I hope to be adding many more Android code snippets over time.

Android source code to show a popup dialog with a text field

I am working on a way to rapidly mock up Android applications using Android Studio, i.e., to rapidly prototype Android applications on the fly, and little snippets of code help to make this happen. For instance, this snippet of code shows how to show a popup dialog to prompt a user to enter information into a text field:

Android Studio: How to clear logcat output before every run

To clear logcat output in Android Studio before each test run, follow these steps:

  1. Click Run
  2. Click Edit Configurations...
  3. When the “Run/Debug Configurations” dialog shows up, click the Logcat tab
  4. Enable the “Clear log before launch” checkbox, as shown in the image.
  5. Click OK, and your logcat output will be cleared before each new run in Android Studio.

If you wanted to see how to clear logcat output before each test run in Android Studio, I hope this is helpful.

Android Studio on Mac OS X - Unable to find a valid JVM

After doing a little research, it looks like the creators of Android Studio made a quirky decision to want to enforce the use of Java 6 on Mac OS X platforms, presumably to have better font rendering. They did this by putting 1.6* in their Info.plist file instead of 1.6+ (and they’ve done this in more than one version of Android Studio. This image (from this link) shows the suggested way to fix the problem, but you can also edit the Info.plist file to solve the problem.

Android Studio - How to import a jar file (in a libs folder)

I just started using Android Studio 1.x and quickly ran into a problem where I needed to use a Jar file in my Android project. In short, this image shows the steps I followed to import the Jar file into my project. As an important note, I put the Jar file I needed in an app/libs folder, which I created in my project. As the image shows, this affects your Gradle build configuration. (I found this info at this SO link.)