Sunday, 5 June 2016

Debugging On-Device from Android Studio

You need to have the appropriate OEM drivers installed for ADB (Android Debug Bridge).

What does a Basic App Look Like in Android Studio?

There are two folders:

1. One for your App - which will be called "YourAppName"
2. One for the Gradle build - which will be called "Gradle Scripts"

What does "YourAppName" I look like?

There's a .idea folder (which relates to IntelliJ settings), an app folder (that's your code), and gradle folder containing gradle-wrapper.jar.

What does "Gradle Scripts" look like?

Bunch of files, most important is gradle.properties.



Failed to Sync Gradle Project in Android Studio

A look at the error detail reveals the following - "Unable to start the daemon process: could not reserve enough space for object heap. Please assign more memory to Gradle in the project's gradle.properties file".

More detail on Gradle's configuration can be found here.

More information about GC configuration can be found here.

To get around this error, try adjusting the -Xmx setting in gradle.properties. Just be careful not to increase it beyond the "maximum representable size".

Why does Android need a Java SDK to run?

The Android build process, which converts an application into an APK (or Android Application Package) relies on the JDK to a large extent.  Also, jarsigner is needed to sign the APK.  Since the JDK is required, ensure that your JAVA_HOME variable is set and that you can run javac from the command line (edit your system PATH to ensure you can do this).