Building Mobile Apps with AI: My Cordova Development Journey

Over the past few weeks, I’ve been using Claude (an AI assistant from Anthropic) to help me build several mobile applications using Apache Cordova. The experience has been eye-opening – both for what worked remarkably well and what proved frustratingly difficult. If you’re considering using AI to help with mobile development, here’s what I learned.

Understanding the Cordova Toolchain

Before diving into my experience, let me briefly explain what Cordova is and why its toolchain is complex. If you’re already familiar with mobile development, feel free to skip ahead.

Apache Cordova is a framework that lets you build mobile apps using web technologies (HTML, CSS, JavaScript) that you already know. Instead of learning Swift for iOS or Kotlin for Android, you write once and deploy everywhere. Your web code runs inside a native wrapper that provides access to device features like camera, Bluetooth, GPS, etc.

The catch? You still need the native build tools:

  • Node.js and npm: JavaScript runtime and package manager for Cordova itself
  • Java Development Kit (JDK): Required for Android development
  • Android SDK: Google’s software development kit containing build tools, platform APIs, and emulators
  • Gradle: The build automation tool that compiles your code, packages resources, and creates the final APK (Android app file)
  • Cordova CLI: Command-line tool that orchestrates everything

All of these tools need to be compatible versions that work together. When they are, Cordova is magical – you type cordova build android and get a working mobile app. When they’re not compatible, you get cryptic error messages and hours of troubleshooting.

The Promise: Rapid Mobile App Development

The pitch for using AI in development is compelling: describe what you want, get working code, iterate quickly. For Cordova specifically – a framework that lets you build cross-platform mobile apps using web technologies – this seemed like a perfect match. I had several project ideas:

  • An OBD-2 diagnostic app that connects to my car’s Bluetooth adapter and displays real-time gauge data (speed, RPM, coolant temperature)
  • Several card magic applications featuring digital versions of classic tricks
  • Various utilities and tools I wanted to test on my Android phone

The AI could handle the HTML/CSS/JavaScript, help with the Cordova-specific configurations, and guide me through the Android build process. In theory.

The Reality: Setup Hell

Here’s the uncomfortable truth about Cordova development with AI assistance: getting the toolchain set up and working is absolute torture. And this is where AI struggles the most.

The Gradle Nightmare

Every single project started the same way: endless Gradle errors. Here’s a sampling of what we encountered:

  • Version conflicts: Cordova would install Gradle 8.13, which had metadata parsing issues. We’d need to manually downgrade to 8.7.
  • Missing wrapper files: The gradlew executable would simply not exist after adding the Android platform. This turned out to be a known bug in cordova-android 14.x that required using version 13.0.0 instead.
  • SDK mismatches: The app would be configured for Android SDK 33, but dependencies required SDK 34. Or build tools 34.0.0 were installed but Gradle wanted 35.0.0.
  • Corrupted caches: Even after fixing configuration issues, Gradle would cache corrupted metadata requiring nuclear options like deleting ~/.gradle/caches/

The typical pattern looked like this:

$ cordova build android
BUILD FAILED
[Some cryptic Gradle error]

$ cordova platform remove android
$ cordova platform add android@13.0.0
$ cordova build android
BUILD FAILED
[Different cryptic Gradle error]

$ rm -rf platforms/android
$ rm -rf ~/.gradle/caches/
$ cordova platform add android@13.0.0
$ nano platforms/android/gradle/wrapper/gradle-wrapper.properties
[Manually edit version number]
$ cordova build android
BUILD FAILED
[Yet another error...]

Rinse and repeat. For hours.

Why AI Struggles Here

The problem is that Cordova toolchain issues are:

  • Environmental: They depend on what versions of Node, Java, Gradle, Android SDK, and Cordova you have installed
  • Non-deterministic: The same commands can produce different results based on cached state
  • Poorly documented: Error messages are cryptic and solutions are scattered across GitHub issues, Stack Overflow, and forum posts
  • Rapidly changing: Cordova releases, Android SDK updates, and Gradle versions create a moving target

An AI assistant can suggest fixes based on patterns it’s seen, but it can’t directly inspect your environment, can’t run commands to diagnose issues, and is working from training data that may be outdated. Each troubleshooting session involved dozens of back-and-forth messages as we tried different approaches.

The Installation Script Approach

After enough pain, Claude actually generated a comprehensive bash script to set up a clean Cordova development environment from scratch. It included:

  • Node.js and npm installation
  • OpenJDK 17 setup
  • Android SDK command line tools download and configuration
  • Gradle installation
  • Cordova global installation
  • Network security config templates
  • All necessary environment variables

This helped, but even with a clean install, we’d still hit platform-specific quirks and version incompatibilities. The fundamental issue remained: the Cordova build toolchain has too many moving parts.

The Breakthrough: When It Finally Works

Here’s where the story gets interesting. Once – and this is key – once you get past the setup phase and cordova build android successfully completes, everything changes.

Suddenly, development becomes smooth. Remarkably smooth.

What AI Does Really Well

With the toolchain working, I could focus on actually building apps. And this is where Claude excelled:

1. UI Design and Layout

I’d describe what I wanted: “animated gauges that look like classic car instruments with tick marks, colored arcs, and rotating needles.” Within minutes, I’d have beautifully styled HTML and CSS with Canvas-based animations. The designs were clean, professional, and worked correctly on the first try.

2. API Integration

For the OBD-2 app, I needed to:

  • Connect to a Bluetooth device using cordova-plugin-bluetooth-serial
  • Send AT commands to configure the ELM327 adapter
  • Request specific PIDs (Parameter IDs) for speed, RPM, and temperature
  • Parse the hex responses according to OBD-2 specifications
  • Convert units (km/h to mph, Celsius to Fahrenheit)
  • Update three separate gauge visualizations

Claude handled all of this. It understood the Cordova plugin APIs, knew the OBD-2 protocol specifics, got the parsing formulas right, and structured the code cleanly with proper error handling.

3. Iterative Refinement

When something wasn’t quite right, fixes were quick:

“The gauge needles are getting clipped at the top”
“The digital value display is too large”
“Can you make the device list scrollable?”
“The app goes to sleep while showing gauges”

Each request resulted in precise code changes. Claude would use str_replace to modify specific sections, test the logic, and provide updated files. The back-and-forth was efficient.

4. Documentation and Debugging

When the gauges weren’t updating with real data from the car, Claude suggested adding an in-app debug console that would display all Bluetooth communication in real-time. This made it possible to diagnose issues while sitting in my driveway:

→ TX: 010D
← RX: 41 0D 3C
🚗 SPEED: 3C hex = 60 km/h = 37 mph
📊 Updated speed gauge

→ TX: 010C  
← RX: 41 0C 1A F8
⚙️ RPM: 1AF8 hex = 6904 / 4 = 1726 rpm
📊 Updated rpm gauge

This kind of thoughtful tooling made debugging actually pleasant.

The End Results

Within a few hours of focused work (after setup), I had:

  • OBD-2 Speedo: A fully functional diagnostic app with three animated gauges, Bluetooth device pairing, real-time data updates, and a screen wake-lock to prevent the display from sleeping while driving
  • Card magic apps: Several digital versions of mathematical card tricks with clean interfaces and smooth interactions
  • Working APKs: Installable apps on my phone that actually worked

The code quality was high. The apps performed well. The UIs looked professional.

Development Workflow Discoveries

Beyond the AI assistance, I discovered several tools and techniques that made the development process much smoother.

Chrome Remote Debugging

One of the coolest discoveries was that Chrome can debug your Android app remotely via USB. Connect your phone, enable USB debugging in developer options, and navigate to chrome://inspect in your desktop Chrome browser. Your Cordova app appears in the list of inspectable pages.

Click “inspect” and you get the full Chrome DevTools experience:

  • Console showing all your console.log() statements
  • Network tab showing HTTP requests
  • Elements inspector for examining the DOM
  • JavaScript debugger with breakpoints
  • Performance profiling

This was invaluable for debugging the OBD-2 app. I could see the Bluetooth communication in real-time, inspect gauge values, and debug JavaScript issues – all from my comfortable desktop setup with a large screen and keyboard.

The Linux Advantage

I developed on Linux (Ubuntu), and this turned out to be a significant advantage when working with AI. Claude could generate comprehensive bash scripts for both setup and debugging tasks.

For example, when troubleshooting Gradle issues, Claude would provide scripts like:

#!/bin/bash
# Check all version requirements
echo "=== Cordova Environment Check ==="
echo "Node: $(node --version)"
echo "npm: $(npm --version)"
echo "Java: $(java -version 2>&1 | head -n 1)"
echo "Cordova: $(cordova --version)"
echo "Android SDK: $ANDROID_HOME"
echo "Gradle: $(gradle --version | head -n 3 | tail -n 1)"
echo ""
echo "=== Installed Android Platforms ==="
ls $ANDROID_HOME/platforms/
echo ""
echo "=== Cordova Platforms ==="
cordova platform ls

These scripts could be copied and pasted directly, providing instant diagnostics. The installation script Claude generated (installing Node, Java, Android SDK, Gradle, and Cordova) was over 200 lines and worked flawlessly. On Windows, this would have required translating concepts between bash and PowerShell, or manually executing steps.

Screen Mirroring with scrcpy

Another essential tool was scrcpy (screen copy), which mirrors your Android phone’s display to your desktop in real-time. This was perfect for demonstrations and testing:

  • Install: sudo apt install scrcpy
  • Connect phone via USB with USB debugging enabled
  • Run: scrcpy

Your phone screen appears in a window on your desktop. You can interact with it using your mouse and keyboard. For the OBD-2 app, this meant I could:

  • Test the app while sitting at my desk
  • Take screenshots easily
  • Show the app to others during video calls
  • Record screen videos for documentation

Combined with Chrome remote debugging, this created an excellent development environment where I could see both the visual interface (scrcpy) and the technical internals (Chrome DevTools) simultaneously.

Lessons Learned

1. Know Where AI Helps (and Where It Doesn’t)

AI is excellent at:

  • Writing application logic
  • Designing user interfaces
  • Integrating APIs and libraries
  • Refining and iterating on working code
  • Explaining technical concepts
  • Generating boilerplate and configuration files

AI struggles with:

  • Environment-specific troubleshooting
  • Build toolchain debugging
  • Issues that require inspecting your specific system state
  • Problems with outdated or conflicting dependencies
  • Errors with poor documentation or recent changes

2. Front-Load the Pain (and Consider Your Platform)

Expect to spend significant time getting your Cordova environment working. Once you have a template project that builds successfully, clone it for new projects rather than starting from scratch each time. Document your working configuration:

  • Node version
  • Java version
  • Cordova version
  • cordova-android version (13.0.0 worked reliably for me)
  • Android SDK versions installed
  • Gradle version

A note on scripting: I developed on Linux, which made it easy to run the bash scripts Claude generated. macOS users will have a similar experience since it’s Unix-based. Windows users can certainly use scripts via PowerShell or Windows Subsystem for Linux (WSL), but there’s added friction – either translating bash syntax to PowerShell or setting up WSL. AI assistants typically generate bash scripts by default, so Linux and macOS provide the most frictionless workflow.

3. Use AI for the Creative Parts

Once your build process works, focus on what you want to build, not how to build it. This is where AI shines. Describe your goals at a high level and let the AI translate them into working code.

4. Iterate in Small Steps

Don’t ask for a complete app in one shot. Build incrementally:

  1. Get basic structure working
  2. Add one feature at a time
  3. Test each addition
  4. Refine based on results

This makes it easier to identify and fix issues.

5. Provide Context

When working with AI on debugging, share:

  • Complete error messages
  • Relevant code sections
  • What you’ve already tried
  • Your environment details

The more context you provide, the better the assistance.

The Bigger Picture

This experience highlighted something important about AI-assisted development: AI tools are incredibly powerful for creative and constructive tasks, but still struggle with systems-level issues that depend on complex, opaque tooling.

The Cordova build process involves:

  • Node.js package management
  • Java compilation
  • Gradle build orchestration
  • Android SDK integration
  • Cordova’s own abstraction layer

When any of these pieces misbehave, diagnosis requires deep system knowledge and direct access to investigate. An AI can suggest potential fixes, but can’t directly examine log files, check environment variables, or test different configurations in your specific setup. However, I did find asking the AI to develop debugging scripts that outputted content of log files, versions, and environment variables an efficient way to get this information to the AI. I would run the script and copy and paste the results back to the AI for analysis.

In contrast, writing JavaScript code that implements your application logic? That’s exactly what AI is built for. It can reason about your requirements, suggest appropriate algorithms, structure code cleanly, and iterate based on feedback.

Would I Do It Again?

Absolutely. Despite the setup frustrations, the actual development experience was excellent. I built functional mobile apps much faster than I could have by learning Cordova from scratch and writing everything manually.

The key insight: AI won’t eliminate the hard parts of software development, but it will shift where you spend your time. Less time writing boilerplate code and looking up API syntax. More time fighting with build tools and dependency management.

For Cordova specifically, I’d recommend:

  1. Budget time for setup: Plan for several hours to get your environment working
  2. Use stable versions: cordova-android 13.0.0, Gradle 8.7, Java 17
  3. Document your working config: You’ll need to recreate it
  4. Set up essential tools: Chrome remote debugging, scrcpy for screen mirroring, and consider Linux for easier bash scripting
  5. Then leverage AI: Focus on building features, not fighting tools

The future of development isn’t “AI writes all the code.” It’s “AI handles the creative parts while you handle the systems parts.” For my Cordova projects, that division of labor worked remarkably well – once we got past that initial setup hell.

Final Thoughts

The OBD-2 Speedo app is now installed on my phone. When I get in my car, I can open it, connect to my Bluetooth adapter, and watch real-time gauges showing my speed, engine RPM, and coolant temperature. It works smoothly and looks professional.

Getting there required:

  • Maybe 4-6 hours of Gradle/toolchain troubleshooting
  • Maybe 2-3 hours of actual app development
  • Zero prior Cordova experience
  • Minimal prior Android development experience
  • Some time learning the development workflow (Chrome debugging, scrcpy)

That’s not bad. And now that I have a working template and understand the workflow, the next app will skip straight to the fun part.

The tools are getting better. AI coding assistants are genuinely useful. But they’re not magic. You still need to understand what you’re building, diagnose problems when they arise, and navigate the complexity of real-world development tools.

The difference is that now you have a tireless partner who can write the code, explain the concepts, and iterate as many times as needed until you get it right. That’s powerful. Just don’t expect it to fix your Gradle configuration on the first try.


Have you used AI assistants for mobile development? What’s been your experience? Let me know in the comments. BTW this article was written by AI and edited by me 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

three × 1 =