Skip to content

Android Studio Debugging

Introduction

Android Studio is the official IDE for Android development. It is used to build Android apps using Java and Kotlin. It is also used to debug Android apps. It is the equivalent of Xcode for iOS development.

Debugging webview javascript using Chrome

See Android Debugging

Debugging native code using Android Studio

When running the app in the simulator or device from Android Studio, you can use the Android Studio debugger to debug the native code. Note that unlike with xcode, debugging isn't enabled by default on run. You have you run the app in debug mode. This is useful for debugging plugins, or any native code that is interfacing with the javascript running in the webview. Breakpoints can be added to the native code.

Android Studio Quirks

Some common issues that you may encounter when using Android Studio.

gradle version is too old on build

If you get this error when loading the project he cordova Android project is built with 7.4. You can fix this by going to Project Structure in the file menu, and picking 7.4 in the gradle settings.

You will need to sync the gradle files again. Which is the Elephant(gradle logo) icon with an arrow. This should now clear build errors.

Missing build tools for 33.0.2 or older

If Android studio tells you it is missing build tools for the app you are trying to build, you may need to download the missing build tools version.

Go to the SDK manager and find the Tools tab. You'll see tools selected. At the bottom of the list there's a check box saying Show Package Details. Clicking that will expand the list to show all previous build tools. Check 33.0.2 or whatever build tool gradle build requires and install it. Sync your gradle files by clicking the Elephant icon and this should build okay.

![IMPORTANT] If you find that the most recent SDK you need is not available on your version of Android studio, You may need to update the installed version of Android studio on your machine.

Use the new UI

Not a bug as such, but if you install a recent version there is a "Use Beta UI" option in the settings. It does make Android studio a lot cleaner to manage. Don't worry if you're really used to the old UI, but if you're like me and you occasionally use it, it's a vast improvement.