ANTIGRAVITY LABJP
Articles/App Development
App Development/2026-04-02Beginner

Building AR Apps with Antigravity: A Beginner's Guide to ARKit & ARCore 2026

Learn how to build augmented reality apps with Antigravity's AI agents, ARKit (iOS), and ARCore (Android). This step-by-step guide covers the 2026 AR market landscape, environment setup, and hands-on code examples.

ARKit2ARCore2AR development2augmented realityiOS27Android27Antigravity338mobile development4

Setup and context — AR App Development in 2026 and Antigravity

Augmented reality technology is evolving rapidly, and the AR/VR market is projected to exceed $220 billion in 2026. As smartphone cameras and sensors have grown more powerful, AR apps are finding their way into gaming, education, retail, healthcare, and beyond.

AR development once required deep expertise, but AI IDEs like Antigravity are changing that. By generating code from natural language instructions, Antigravity helps developers of all levels build AR experiences more efficiently.

In this guide, you'll learn how to build AR apps using ARKit (iOS) and ARCore (Android) with Antigravity as your AI development partner.

What you'll learn:

  • Key differences between ARKit and ARCore and how to choose one
  • Setting up your AR development environment with Antigravity
  • Implementing a simple AR object-placement app step by step
  • Using AI agents to debug and refactor AR code effectively

ARKit vs. ARCore: What You Need to Know

Before writing any code, it helps to understand how the two major AR frameworks differ.

ARKit (iOS) is Apple's AR framework for iPhone and iPad. It integrates tightly with SwiftUI and RealityKit, and on LiDAR-equipped devices (iPhone 12 Pro and later), it delivers highly accurate spatial mapping and plane detection.

ARCore (Android) is Google's counterpart for Android devices. It provides three core capabilities — Motion Tracking, Environmental Understanding, and Light Estimation — and works across a broad range of Android hardware. Combined with Jetpack Compose and the SceneView library, it enables clean, modern AR implementations.

Your choice depends on your target audience. Building iOS-only? Go with ARKit. Targeting Android? ARCore. Want to cover both platforms? Flutter with ARFoundation is worth exploring.


Setting Up Your Environment

For iOS (ARKit)

Make sure you have the following ready:

  • macOS 14 (Sonoma) or later
  • Xcode 16 or later (download from the App Store or Apple Developer site)
  • iPhone 12 or later (real device required — the Simulator doesn't support AR)
  • Apple Developer account (a free account is enough for on-device testing)
  • Antigravity (install from antigravity.google)

For Android (ARCore)

  • Android Studio Meerkat or later
  • An ARCore-supported Android device (Pixel 6 or newer recommended)
  • Android SDK 28 (Android 9) or higher
  • Antigravity (same as above)

Once Antigravity is running and your project folder is open, type "Set up an ARKit project for me" in the chat panel and it will suggest the necessary configuration files and dependencies automatically.


ARKit Basics — Placing AR Objects on iOS

Creating the Project

Open Xcode and create a new project. Choose the Augmented Reality App template, set Content Technology to RealityKit, and Interface to SwiftUI.

Then, in the Antigravity chat, try something like:

Using ARKit and RealityKit, create a simple AR app where tapping the screen
places a red box on a detected horizontal surface.

Antigravity reads your project structure and generates context-aware code.

Example: Tap to Place a 3D Object

Here's a typical result from Antigravity:

import SwiftUI
import RealityKit
import ARKit
 
struct ContentView: View {
    var body: some View {
        ARViewContainer()
            .edgesIgnoringSafeArea(.all)
    }
}
 
struct ARViewContainer: UIViewRepresentable {
    func makeUIView(context: Context) -> ARView {
        let arView = ARView(frame: .zero)
 
        // Enable horizontal plane detection
        let config = ARWorldTrackingConfiguration()
        config.planeDetection = [.horizontal]
        arView.session.run(config)
 
        // Add tap gesture for object placement
        let tapGesture = UITapGestureRecognizer(
            target: context.coordinator,
            action: #selector(Coordinator.handleTap(_:))
        )
        arView.addGestureRecognizer(tapGesture)
        context.coordinator.arView = arView
 
        return arView
    }
 
    func updateUIView(_ uiView: ARView, context: Context) {}
 
    func makeCoordinator() -> Coordinator {
        Coordinator()
    }
 
    class Coordinator: NSObject {
        var arView: ARView?
 
        @objc func handleTap(_ gesture: UITapGestureRecognizer) {
            guard let arView = arView else { return }
            let location = gesture.location(in: arView)
 
            // Raycast to find a real-world surface position
            let results = arView.raycast(
                from: location,
                allowing: .estimatedPlane,
                alignment: .horizontal
            )
 
            guard let firstResult = results.first else { return }
 
            // Create a 10cm red box
            let mesh = MeshResource.generateBox(size: 0.1)
            let material = SimpleMaterial(color: .red, isMetallic: false)
            let boxEntity = ModelEntity(mesh: mesh, materials: [material])
 
            // Attach the entity to the world via an anchor
            let anchor = AnchorEntity(world: firstResult.worldTransform)
            anchor.addChild(boxEntity)
            arView.scene.addAnchor(anchor)
        }
    }
}
 
#Preview {
    ContentView()
}

Paste this into Xcode, run it on a real device, and you'll see a red box appear wherever you tap the floor. From here, you can ask Antigravity to add animations, physics, or gesture-based manipulation — one step at a time.


ARCore Basics — Building AR Apps for Android

Adding Dependencies

In your Android project, open the Antigravity chat and type:

Using ARCore and SceneView, create an AR app where tapping a detected
horizontal plane places a 3D object. Include the necessary build.gradle
changes.

Antigravity will suggest both the dependency additions and the implementation code.

build.gradle (Module: app)

dependencies {
    // ARCore
    implementation("com.google.ar:core:1.42.0")
 
    // SceneView — makes ARCore easier to use with Jetpack Compose
    implementation("io.github.sceneview:arsceneview:2.2.1")
 
    // Kotlin Coroutines
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0")
}

Main Composable with ARCore

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import io.github.sceneview.ar.ARScene
import io.github.sceneview.ar.node.AnchorNode
 
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            ARAppScreen()
        }
    }
}
 
@Composable
fun ARAppScreen() {
    // Track placed nodes
    val nodes = remember { mutableStateListOf<AnchorNode>() }
 
    ARScene(
        modifier = Modifier.fillMaxSize(),
        nodes = nodes,
        planeRenderer = true, // Visualize detected planes
        onCreate = { arSceneView ->
            arSceneView.lightEstimationMode =
                com.google.ar.core.Config.LightEstimationMode.ENVIRONMENTAL_HDR
        },
        onSessionUpdated = { _, _ -> },
        onTap = { hitResult ->
            // Create an anchor where the user tapped
            val anchorNode = AnchorNode(
                engine = TODO(), // pass SceneView's engine instance
                anchor = hitResult.createAnchor()
            ).apply {
                isEditable = true
                // Add your 3D model as a child node here
            }
            nodes.add(anchorNode)
        }
    )
}

The actual implementation may need minor adjustments depending on your SceneView version. If errors appear, just paste them into the Antigravity chat with a note like "Fix this and make it compile" — and it will handle the version-specific details.


Working with Antigravity's AI Agents for AR Development

Effective Prompts for AR

Being specific gets you better results. Here are a few examples:

To improve plane detection:

Update the ARKit implementation to also detect vertical planes (walls).
Show a grid overlay on detected surfaces.
Display a "Point your camera at the floor and move slowly" hint
while no planes have been found yet.

To debug an error:

I'm getting the following error in my ARScene. What's causing it and
how do I fix it?

[paste your error message here]

Antigravity is well-versed in both ARKit and ARCore documentation, so it can pinpoint the issue and suggest a fix quickly.

A Practical Development Cycle

Here's a workflow that works well for AR projects with Antigravity:

  1. Build a working skeleton first — Ask Antigravity for "a simple AR plane detection app" to get a runnable starting point
  2. Test on a real device often — AR behavior can't be verified in a simulator; keep short test cycles
  3. Describe what feels wrong — Tell Antigravity what you observe on device, and it will suggest targeted fixes
  4. Layer in features gradually — Once the basics are stable, ask for one new feature at a time (animations, physics, UI overlays)

If you're new to iOS development in general, Getting Started with iOS & Swift in Antigravity is a helpful starting point. For cross-platform mobile projects, Antigravity × Flutter Mobile Development Guide covers how to use AI agents across both platforms.


Common Errors and How to Fix Them

"Camera permission denied" (iOS)

This almost always means NSCameraUsageDescription is missing from Info.plist. Ask Antigravity "Add camera permission to my Info.plist" and it will provide the exact key and description string to add.

Planes not being detected

Low-light environments and plain white surfaces are difficult for AR tracking. Test in a well-lit room with textured floors or carpets. You can also set environmentTexturing to .automatic in your ARWorldTrackingConfiguration to improve detection.

ARCore reports "Device not supported"

Make sure you're running on a physical ARCore-compatible device. Emulators don't support AR. Ask Antigravity to "add an ARCore availability check" and it will add proper ArCoreApk.requestInstall() handling.

Objects float in mid-air or disappear quickly

This usually points to an anchor lifecycle issue or incorrect use of worldTransform. Tell Antigravity "Fix the anchor placement so objects stay stable on the floor" for a targeted correction.


Best Practices for AR App Development

A few tips to keep your AR apps performant and user-friendly:

  • Keep polygon counts low: AR is processing a live camera feed continuously. Aim for under 10,000 polygons per 3D model to maintain smooth frame rates.
  • Use occlusion: ARKit's person occlusion feature makes virtual objects look more realistic when people walk in front of them.
  • Match lighting: Enable Light Estimation so AR object shadows align with the real-world lighting conditions.
  • Always provide a fallback UI: If the device doesn't support AR or the user denies camera access, show a clear, helpful message rather than a crash.
  • Guide new users: A simple text prompt like "Slowly move your phone toward the floor" dramatically improves first-time user experience.

Summary

Antigravity makes AR app development significantly more accessible. Whether you're targeting iOS with ARKit or Android with ARCore, the AI-assisted workflow lets you go from idea to working prototype much faster than traditional development.

Here's a quick recap of where to start:

  1. Install Antigravity and create a new iOS or Android project
  2. Ask for "a simple AR plane detection app" to get a runnable skeleton
  3. Test on a real device and describe any issues to Antigravity for fixes
  4. Add features one at a time, growing your app incrementally

The convergence of a booming AR market and capable AI development tools creates a real opportunity for independent developers. Start small, test often, and let Antigravity handle the heavy lifting.

For a deeper look at Xcode 26 and iOS 26 features relevant to AR and spatial computing, Antigravity × Xcode 26 × iOS 26 Practical Guide covers the latest capabilities announced at WWDC 2026.

Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

App Dev2026-05-03
Getting Started with AR on Android Using io.github.sceneview — Working Past AnchorNode Errors
A practical guide to building Android AR features with SceneView (io.github.sceneview): AnchorNode error fixes, ARCore session and install handling, plane visualization, and combining Antigravity AI for dynamic scene generation.
App Dev2026-07-03
When Universal Links Break Silently — Catching Association Drift with an Agent-Run Verification Gate
Universal Links and App Links fall back to the browser with no error when your association files or entitlements drift apart. Here is a design that generates the files from one source of truth and hands weekly and pre-release checks to an agent.
App Dev2026-05-25
One Month Splitting Antigravity's Inline Edit and Agent Mode Across Four Wallpaper Apps
A month of notes from running Antigravity's Inline Edit and Agent Mode across four production wallpaper apps — with real counts, the decision rule I wrote into AGENTS.md, a one-pass dSYM fix, and how credit cost factors in.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →