<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Josh Kautz on Medium]]></title>
        <description><![CDATA[Stories by Josh Kautz on Medium]]></description>
        <link>https://medium.com/@joshkautz?source=rss-dd0a260f7746------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OP7dPWV9-Jw23Q1ajaZ3WA.png</url>
            <title>Stories by Josh Kautz on Medium</title>
            <link>https://medium.com/@joshkautz?source=rss-dd0a260f7746------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 07:07:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joshkautz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building an Automatic License Plate Reader]]></title>
            <link>https://joshkautz.medium.com/building-an-automatic-license-plate-reader-96d53c2b5af8?source=rss-dd0a260f7746------2</link>
            <guid isPermaLink="false">https://medium.com/p/96d53c2b5af8</guid>
            <category><![CDATA[edge-ai]]></category>
            <category><![CDATA[jetson-nano]]></category>
            <category><![CDATA[jetson-orin-nano]]></category>
            <category><![CDATA[nvidia-jetson-nano]]></category>
            <category><![CDATA[alpr]]></category>
            <dc:creator><![CDATA[Josh Kautz]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 16:51:14 GMT</pubDate>
            <atom:updated>2026-04-19T16:51:29.009Z</atom:updated>
            <content:encoded><![CDATA[<h4>A foray into Edge AI, Open Source<strong>, and FTP</strong></h4><p>No, that doesn’t stand for <em>File Transfer Protocol</em>. As a Minneapolis resident, 2026 has been particularly brutal for our community. My neighbors have been forced to stay cooped up inside the safety of their homes for months on end, wondering who was watching them from behind the tinted windows of the vehicles parked up and down the street.</p><p>It didn’t take long for community members to stand up infrastructure to search unknown license plates against crowd-sourced databases of known <em>dangerous </em>vehicles. It was a system that has worked reasonably well and helps keep folks safer than they would’ve been otherwise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NQ8WIl-M9O3O6_St" /></figure><p>But when new vehicles are shipped in on a daily basis, it makes it increasingly difficult to keep crowd-sourced databases up-to-date. Fortunately, nearly all of the vehicles funnel in and out of one central hub. So if we were able to easily monitor and record all of the license plates before they hit the streets…</p><p>Over a couple weeks planning and iteration, I found myself building and deploying <a href="https://github.com/joshkautz/alpr">my own portable Automatic License Plate Recognition (ALPR) system</a> that processes video in real-time using neural networks, tags every plate with timestamp and GPS coordinates, and serves a live dashboard that you can view on your phone screen via the Wi-Fi network it broadcasts.</p><p>I outlined a few constraints. It must be fully offline, exclusively open-source software, decently budget-friendly, reasonably ergonomic, and highly resilient. And accurate. No internet dependency. No API costs. No latency. No privacy concerns.</p><p>Then the second constraint emerged: this needed to be <em>portable</em>. Battery-powered. Something you could carry in a backpack. Power consumption, form factor, and battery life suddenly became first-class design requirements alongside performance of the system.</p><p>The first handful of days were spent doing intensive research. Surveying the full ALPR pipeline from video capture through plate detection and OCR to storage. I mapped every option at each layer, compared compute platforms with detailed power budgets, brushed up on the capabilities and limitations of infrared retroreflection on license plates, and produced a bill of materials with pricing.</p><p>The build guide went through many iterations over the course of the project. I treated it like living code. Versioning it, reviewing it, refactoring it as my understanding deepened. What made this research phase productive was a willingness to go deep on the physics and engineering, not just skim spec sheets. Understanding <em>why</em> things would (or wouldn’t) work saved me from expensive mistakes later.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJA6jSQRp-m4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FJA6jSQRp-m4%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJA6jSQRp-m4%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f6f4991cbf9ffc0c57f79e20d324c278/href">https://medium.com/media/f6f4991cbf9ffc0c57f79e20d324c278/href</a></iframe><h3>Compute</h3><p>The system needs to run neural network inference on live 4K video, decode that video in hardware, and do it all on battery power. That narrows the field quickly.</p><p>We went with the <a href="https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/nano-super-developer-kit/"><strong>NVIDIA Jetson Orin Nano Super</strong></a>, a compact single-board computer built for edge AI. It delivers 67 TOPS of inference performance, 1024 CUDA cores, and a hardware video decoder (NVDEC), all within a 7–25W power envelope. The mature CUDA ecosystem meant we could run our detection models on TensorRT and ONNX Runtime with GPU acceleration out of the box.</p><p>For the recognition stack, we use <a href="https://github.com/ankandrew/fast-alpr"><strong>fast-alpr</strong></a>, an open-source library that pairs a <a href="https://github.com/ankandrew/open-image-models">YOLOv9</a> real-time object detector (to find plates in the frame) with an OCR model (to read the characters). Both models run as ONNX graphs, which lets ONNX Runtime automatically route them through TensorRT for optimized inference on the Jetson’s GPU. The result is real-time plate detection at 5–10 frames per second with minimal power draw.</p><h3>Camera</h3><p>We landed on the <strong>Reolink RLC-811A</strong> — a 4K camera with 5x motorized zoom (2.7–13.5mm), built-in IR LEDs and spotlights, an API for remote control, and instant Amazon availability.</p><p>The motorized zoom is what makes this work. License plate OCR needs roughly 80+ pixels across the plate text to read reliably. With a fixed 4mm lens at 100 feet, you get about 20 pixels on a plate — useless. The RLC-811A at maximum zoom: 139 pixels at 50 feet, 92 at 75 feet, 70 at 100 feet. And you can adjust zoom remotely from your phone through the dashboard, so you’re not locked into one distance.</p><p>We went through several cameras before this one. The technically superior choice was a Hikvision with an F1.0 aperture that gathered 4x more light than typical cameras, but it was nearly impossible to source in the US. The camera we <em>could</em> buy turned out to have capabilities the Hikvision lacked: motorized zoom, an API for programmatic control, and a simpler power setup. Availability and ecosystem matter as much as specs.</p><h3>IR Illumination</h3><p>One of the most valuable things I learned during research was why ALPR systems use infrared, not visible light. License plates use retroreflective sheeting — the same material on highway signs. The material bounces IR light directly back toward its source. Under 850nm infrared, plates glow bright white with sharp black text. Under visible floodlights, you get harsh shadows, headlight glare, and washed-out characters.</p><p>This also killed an early idea of shoulder-mounting the camera on one shoulder and an IR illuminator on the other. The physics of retroreflection means the light bounces back toward the <em>source</em>, not toward a camera 18 inches away at a different angle. Camera and illuminator must be co-located. Even a 2-foot separation in angle results in zero improvement. So I removed the IR illuminator entirely from the build and settled on making use of the IR capabilities built into the Reolink camera.</p><h3><strong>Power</strong></h3><blockquote>A $9 Cable Saved the Whole Project</blockquote><p>The <a href="https://www.amazon.com/BLUETTI-Generator-Handsfree-Separately-Photography/dp/B0DJX56Q97">BLUETTI Handsfree 2</a> (a 512Wh LiFePO4 battery built into a backpack frame) is where I can no longer call this a budget-friendly build in good faith. But the ergonomic tradeoff was too much for me. It affords two USB-C ports (100W each), one AC outlet, and two USB-A ports. With our system’s tentative ~33W total system draw, it should provide 12–16 hours of continuous operation off a full charge. The backpack form factor was perfect for portable deployment.</p><p>The Bluetti power supply only had one AC outlet, and we initially needed it for both the Jetson and the Reolink camera. The first solution was a power strip. That felt clunky. One more thing to carry, one more thing to break. This forced a deeper investigation that soon revealed that for powering the Reolink camera, a <strong>USB-C PD trigger cable (</strong>a $9 cable with a built-in chip that negotiates a specific voltage) could deliver voltage directly from the Bluetti’s USB-C ports. No AC conversion, no power strip, cleaner and more efficient.</p><p>The same trick works for the Jetson itself, but with a catch. The Jetson Orin Nano’s USB-C port is data only. It cannot accept power. The board requires DC barrel jack input (5.5×2.5mm, 7–20V). Another $9 USB-C PD trigger cable, this time negotiating 20V and outputting through a barrel jack connector. (Why 20V? NVIDIA ships a 19V adapter, and 20V is the closest USB-C PD standard voltage. It draws less current and runs cooler than 15V at the same wattage.)</p><h3>Bill of Materials</h3><pre>|------------------------------------------------|-------------|<br>|    Component                                   |    Price    |<br>|------------------------------------------------|-------------|<br>| NVIDIA Jetson Orin Nano Super Developer Kit    | $249.00     |<br>| Inland TN320 256GB SSD NVMe                    | $54.25      |<br>| Reolink RLC-811A 4K Camera (5x zoom)           | $107.76     |<br>| VK-162 USB GPS Dongle                          | $19.97      |<br>| Waveshare Aluminum Case                        | $22.99      |<br>| USB-C PD 20V Trigger Cable (Jetson power)      | $9.26       |<br>| USB-C PD 12V Trigger Cable (Camera power)      | $19.98      |<br>| BLUETTI Handsfree 2 Battery Backpack           | $435.01     |<br>| 2x 90 Degree USB-C 100W Male to Female Adapter | $5.97       |<br>| zip ties                                       | $0.00       |<br>| cable sheath                                   | $0.00       |<br>| saw blade                                      | $0.00       |<br>| glue gun                                       | $0.00       |<br>|------------------------------------------------|-------------|<br>| Total                                          | $924.19     |<br>| All software                                   | $0          |<br>| Monthly costs                                  | $0          |<br>|------------------------------------------------|-------------|</pre><p>With a reasonable level of confidence, I purchased all the components and twiddled my thumbs waiting for them to show up so I could begin diving into the software implementation. The requirements list was straightforward on paper:</p><ul><li>Capture 4K video and run YOLO plate detection + OCR at 5–10 FPS on the GPU</li><li>Deduplicate detections (a single car generates 15–50 reads as it passes)</li><li>Tag every reading with GPS coordinates and a timestamp</li><li>Store results — cropped plate images, full frames, and metadata — in SQLite</li><li>Serve a live dashboard over the Wi-Fi network we broadcast</li><li>Survive edge cases gracefully: power loss, camera disconnects, GPS fix loss</li><li>Deploy to the Jetson with a single command</li></ul><h3>Open-Source</h3><p>None of this would exist without the open-source community. I didn’t build an ALPR system from scratch. This was assembled from remarkable work that others made freely available; I just wrote the glue to make it all work together on a portable Jetson platform. Every core capability traces back to someone else’s ingenuity and sweat.</p><p>The<strong> </strong><a href="https://github.com/thirtythreeforty/neolink"><strong>Neolink</strong></a><strong> </strong>origin story is worth noting because it illustrates this perfectly. In 2019, a fellow named <a href="https://www.thirtythreeforty.net/posts/hacking-reolink-cameras/">George</a> (an embedded systems engineer) decided to reverse-engineer his Reolink camera. He sniffed packets between the camera and Reolink’s official app, analyzed the firmware, and documented the proprietary <em>Baichuan</em> binary protocol that Reolink uses. He figured out the AES encryption handshake, the XML message format, the media packet structure, and published it all as an open-source Rust project.</p><p>Another fellow named <a href="https://github.com/QuantumEntangledAndy/neolink">Andrew</a> then forked the project and substantially expanded it, adding MQTT integration, motion detection, battery monitoring, multiple discovery methods, and support for newer camera models. This fork became the most active Neolink implementation.</p><p>I then <a href="https://github.com/joshkautz/neolink">forked it</a> and hardened it for 24/7 unattended operation — detecting silent connection deaths, preventing cascading failures when the camera hiccups, and ensuring the system recovers gracefully instead of crashing. The upstream project was built for occasional use; I needed something that would run for 12 hours straight without intervention, so most of my changes were around making failures survivable rather than fatal.</p><pre>|------------------|----------------------------------------------------------------|----------------------------------------------------|<br>|    Project       | Role                                                           | Link                                               |<br>|------------------|----------------------------------------------------------------|----------------------------------------------------|<br>| Neolink          | Reverse-engineered Reolink camera protocol → RTSP bridge       | https://github.com/QuantumEntangledAndy/neolink    |<br>| fast-alpr        | YOLO plate detection + OCR                                     | https://github.com/ankandrew/fast-alpr             |<br>| ONNX Runtime     | GPU-accelerated model inference via TensorRT                   | https://github.com/microsoft/onnxruntime           |<br>| OpenCV           | Video capture with GStreamer/NVDEC hardware decode             | https://github.com/opencv/opencv                   |<br>| go2rtc           | WebRTC streaming for live dashboard video                      | https://github.com/AlexxIT/go2rtc                  |<br>| FastAPI          | Web dashboard and REST API                                     | https://github.com/fastapi/fastapi                 |<br>| GStreamer        | Media pipeline for hardware video decoding                     | https://gstreamer.freedesktop.org                  |<br>| FFmpeg           | Video format handling and transcoding                          | https://github.com/FFmpeg/FFmpeg                   |<br>| gpsd             | GPS daemon for location tagging                                | https://gitlab.com/gpsd/gpsd                       |<br>| SQLite           | Embedded database with power-loss-safe WAL mode                | https://sqlite.org                                 |<br>| hostapd          | Wi-Fi access point daemon                                      | https://w1.fi/hostapd                              |<br>| dnsmasq          | DHCP and DNS for the Wi-Fi network                             | https://thekelleys.org.uk/dnsmasq/doc.html         |<br>| JetPack          | NVIDIA&#39;s OS and SDK for Jetson (CUDA, TensorRT, drivers)       | https://developer.nvidia.com/embedded/jetpack      |<br>| NumPy            | Array operations for image and frame processing                | https://github.com/numpy/numpy                     |<br>| Uvicorn          | ASGI server that runs FastAPI                                  | https://github.com/encode/uvicorn                  |<br>| Tokio            | Async runtime powering Neolink&#39;s networking                    | https://github.com/tokio-rs/tokio                  |<br>|------------------|----------------------------------------------------------------|----------------------------------------------------|</pre><p>Total cost for all of this software: <strong>$0</strong>. Every piece is free, open source, and community-maintained. The entire ALPR system is built on the accumulated work of hundreds of contributors across these projects.</p><h3>Architecture</h3><p>The software is built as a chain of independent components, each responsible for one job:</p><pre>Camera (Baichuan:9000)<br>[Captures 4K video]<br>        ↓<br>Neolink (RTSP:8654)<br>[Translates the camera&#39;s proprietary protocol to standard RTSP]<br>        ↓<br>        ├──────────────────────────────────┐<br>        ↓                                  ↓<br>VideoStreamCapture                    go2rtc (WebRTC:8555)<br>[Pulls frames using                   [Streams live video to<br> hardware decoding]                    the phone dashboard]<br>        ↓<br>FrameProcessor (YOLO + OCR)<br>[Runs AI detection and reads<br> the plate characters]<br>        ↓<br>DuplicateFilter (60s window)<br>[Keeps only the best read<br> per vehicle, discards repeats]<br>        ↓<br>PlateEventHandler<br>[Saves the plate image, GPS<br> location, and record to database]</pre><p>Each component has a clearly defined contract. “You give me a video frame, I give you detected plates” or “You give me a plate reading, I store it.” The main loop ties them all together. It doesn’t know or care <em>how</em> any component does its job; it just calls each one in sequence. This makes the system easy to test (swap in a fake camera that plays back a video file) and easy to extend (swap in a different detector without touching anything else).</p><h3><strong>Deduplication</strong></h3><p>A vehicle at 25 mph is visible to the camera for several seconds, generating 15–50 duplicate detections if we’re lucky. Simple exact-match deduplication doesn’t work because OCR makes slightly different errors on each frame. Perhaps it reads <strong>ABC0123</strong> on one frame, and then <strong>ABCOI23</strong> on the next.</p><p>The solution is a time-windowed filter with <strong>string similarity matching</strong>. When a new detection comes in, it checks: has a similar plate (&gt;80% character match via <a href="https://docs.python.org/3/library/difflib.html">difflib.SequenceMatcher</a>) been seen in the last 60 seconds? If yes, keep the higher-confidence reading. If no, start a new group. When the window expires, emit the single best reading. This has proven to reduce database writes by 60-70% while ensuring the best possible OCR result for each vehicle.</p><h3>Power-Loss Safety</h3><p>The system runs on battery and can lose power without warning. The Jetson device is in a headless state (no screen) so you just press the power button and have to hope that the startup processes and daemons you wrote launch everything correctly. Inversely, if something bumps your backpack and somehow presses the power button to shut down the machine, you ought to plan accordingly. Every design decision accounts for this:</p><ul><li><strong>SQLite WAL mode: </strong>Write-Ahead Logging ensures the database survives sudden power loss.</li><li><strong>Atomic image writes: </strong>write to temp file, then rename.</li><li><strong>Periodic WAL checkpointing: </strong>prevents unbounded journal growth</li><li><strong>systemd watchdog: </strong>if the detection loop hangs for more than 5 minutes, the service auto-restarts</li></ul><h3>Deployment</h3><p>The deployment process is a bash script that discovers the Jetson over USB-C (it presents as a USB Ethernet device at <em>192.168.55.1</em>), copies SSH keys, rsyncs the codebase, installs all dependencies, downloads the Neolink binary, configures five systemd services, sets up the Wi-Fi access point, and opens SSH tunnels for browser access to the dashboard. Total deployment time to ensure proper configurations and installation on a fresh Jetson is about 10 minutes.</p><h3>Dashboard</h3><p>The web dashboard is served by FastAPI over the Jetson’s own Wi-Fi access point. Connect your phone to the network, open the browser, and you see:</p><ul><li><strong>Live WebRTC video: </strong>sub-second latency, powered by go2rtc.</li><li><strong>Real-time plate detections: </strong>scrolling feed with plate text, confidence scores, timestamps, GPS coordinates.</li><li><strong>Camera controls: </strong>zoom in/out, focus, IR mode toggle</li><li><strong>System health: </strong>CPU/GPU temperatures, memory usage, disk space, GPS satellite count, stream health.</li><li><strong>Search and export: </strong>filter by plate text or date range, export as ZIP with CSV + images.</li></ul><p>The captive portal router means when you connect to the Wi-Fi, your phone automatically opens the dashboard — no URL to remember. But you can of course configure the URL that gets mapped if you’d prefer.</p><h3>Field Performance</h3><p>The system boots in 15–25 seconds. GPS lock takes about 30 seconds. Power-on to reliably reading plates: under a minute.</p><p>At 5 FPS with the YOLO + OCR pipeline, it processes every vehicle that passes. The motorized zoom on the RLC-811A means you can adjust for most reasonable distances from your phone. The built-in IR LEDs handle nighttime capture out to about 75 feet.</p><p>All data stays local. No internet ever touches this system. Every plate reading includes GPS coordinates, a cropped plate image, a full 4K context frame, and metadata in a SQLite database that survives sudden power loss.</p><h3>Minnesota Weather</h3><p>The backpack form factor had an unintended benefit in winter: body heat from wearing it keeps the LiFePO4 battery above freezing, maintaining 70 to 100% capacity. Even worst-case cold weather gives 7–9 hours of runtime. The cold was also a gift for the Jetson. Running inside a backpack where it can easily overheat, Minnesota winter was free thermal management.</p><p>Summer is a different story. The Jetson generates real heat in an enclosed space, and we’d need some kind of ventilation solution to prevent throttling. That’s a problem for future me.</p><h3><strong>What I Learned</strong></h3><p>Zero cloud dependency means zero attack surface, zero ongoing costs, zero latency, and zero points of failure outside your control. The entire ALPR system is a closed loop: camera to compute to storage to dashboard. It works in a parking garage with no cell signal. It works in a rural area with no Wi-Fi. It works on battery in a backpack.</p><p>The tradeoff is that everything must work locally, which drove us toward the Jetson’s hardware NVDEC decoder, TensorRT optimization, and efficient power management. Fortunately, these constraints produced a better system.</p><p>The build guide went through 9 versions. It grew from a research dump to a 32-page reference manual, then got ruthlessly edited down to 14 focused pages. Hardware changed four times. Corrections cascaded through every section. Treat planning documents like code: version them, review them, refactor them, and expect them to have bugs.</p><p>If I were starting over, I’d skip the camera research rabbit hole and go straight to the RLC-811A. Motorized zoom, HTTP API, easy availability… it checks every box, and the weeks I spent evaluating Hikvision models I couldn’t even buy were the least productive part of the project. On the other hand, the time spent understanding IR retroreflection physics was the <em>most</em> productive. It killed a bad idea (separate illuminator) before I spent money on it and shaped the entire camera mounting strategy.</p><p>The thing that surprised me most was how much time went into making the system <em>reliable</em> rather than making it <em>work</em>. Getting plates to detect on a video stream took a day. Getting the system to run unattended for 12 hours (surviving camera disconnects, handling GPS fix loss, recovering from silent stream failures, deduplicating noisy OCR output) took weeks. The detection pipeline is the flashy part, but the resilience engineering is where the real work lives.</p><p><em>The ALPR project is open source at </em><a href="https://github.com/joshkautz/alpr"><em>https://github.com/joshkautz/alpr</em></a><em>.<br>My Neolink fork is at </em><a href="https://github.com/joshkautz/neolink"><em>https://github.com/joshkautz/neolink</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96d53c2b5af8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an MCP Server for Nintendo 64 Homebrew Development]]></title>
            <link>https://joshkautz.medium.com/building-an-mcp-server-for-nintendo-64-homebrew-development-0154cf8b070d?source=rss-dd0a260f7746------2</link>
            <guid isPermaLink="false">https://medium.com/p/0154cf8b070d</guid>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[n64]]></category>
            <category><![CDATA[nintendo-64]]></category>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[Josh Kautz]]></dc:creator>
            <pubDate>Sat, 11 Apr 2026 05:20:48 GMT</pubDate>
            <atom:updated>2026-04-11T05:20:48.168Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*AJpC0rI909UIhk67sDZcJQ.jpeg" /></figure><p>I have been primarily a lurker in the the Nintendo 64 homebrew community for a while. I participated in the annual homebrew game jam a year ago, but this year was busy, and I could only donate and watch from afar. The community and tooling has continued to level up in the past few years — with advances in AI tooling, I felt compelled to try to take a few shortcuts to play catchup as a developer.</p><p>The N64 homebrew ecosystem is built around a handful of open-source tools:</p><ul><li><a href="https://github.com/DragonMinded/libdragon"><strong>Libdragon</strong></a> — the main SDK, with a custom MIPS toolchain, RDP command queue, audio mixer, and filesystem</li><li><a href="https://github.com/HailToDodongo/tiny3d"><strong>Tiny3D</strong></a> — a 3D rendering library with custom RSP microcode</li><li><a href="https://github.com/HailToDodongo/pyrite64"><strong>Pyrite64</strong></a> — <em>(new)</em> a full game engine and visual editor built on top of both</li></ul><p>These projects have well-documented source code, working examples, comprehensive header file comments, GitHub wikis, and a thriving Discord community (<a href="https://discord.gg/WqFgNWf">n64brew</a>). But LLMs aren’t heavily trained on this material. When I ask Claude Code to help me write N64 code, it will hallucinate function signatures, use deprecated APIs, and miss critical hardware constraints like the 4KB texture memory limit.</p><p>I needed a way to give Claude access to the <em>actual</em> knowledge — not summaries of summaries, but the real conversations, real code, and real documentation.</p><p>Before jumping to MCP, I evaluated several approaches:</p><p>Markdown files in .claude/rules/ that get loaded into every session. I actually built these first -- 7 files covering N64 hardware constraints, libdragon core APIs, Tiny3D, Pyrite64, common pitfalls, and a reference lookup guide. They&#39;re useful for foundational knowledge that applies to every session, but they consume context window on every conversation whether relevant or not.</p><p>Claude Code’s <a href="https://code.claude.com/docs/en/settings#permission-settings">additionalDirectories</a> setting gives read access to other repos on disk. I configured access to libdragon, Tiny3D, and Pyrite64 source code. This helps when Claude needs to read a specific header, but it doesn&#39;t help Claude <em>discover</em> what to read.</p><p>An MCP server provides <strong>on-demand</strong> access to knowledge. Claude searches when it needs something specific, gets targeted results, and doesn’t waste context window on irrelevant information. It scales to massive datasets without degrading performance.</p><p>The key insight: <strong>Claude Code itself is the best judge of relevance — at query time, with full context of what it’s trying to accomplish.</strong> An MCP server should index everything and let Claude filter at the moment of need.</p><p>The MCP server indexes three distinct types of knowledge:</p><pre>Discord Conversations (752K messages)<br>    + SDK Documentation (198 header files, wiki pages, examples)<br>    + Homebrew Source Code (1,989 files from 14 game projects)<br>    = SQLite database with FTS5 full-text search (401 MB)</pre><ul><li><strong>Single file</strong> — no server processes, no dependencies, no configuration</li><li><strong>Deterministic</strong> — same input always produces same output</li><li><strong>Fast</strong> — full-text search across 752K messages in milliseconds</li><li><strong>Portable</strong> — the database file <em>is</em> the knowledge base</li></ul><p>I considered semantic search with embeddings but decided against it for this project. FTS5 with <a href="https://tartarus.org/martin/PorterStemmer/">Porter stemming</a> handles the N64 use case well because the searches are typically for specific terms: function names ( rdpq_sprite_blit), hardware concepts ( TMEM), error messages, or API patterns. These are keyword-heavy searches where BM25 ranking works as well as or better than cosine similarity.</p><p>The N64brew Discord server has been active since 2016. It’s where the actual experts hang out — the people who write the SDK, discover hardware quirks, and debug RDP rendering issues at 3am. This is the most valuable knowledge source, and it’s locked inside Discord.</p><p>I used <a href="https://github.com/Tyrrrz/DiscordChatExporter">DiscordChatExporter</a> to download the entire server history. The export took several hours and produced <strong>840 JSON files totaling 1.5 GB</strong> across 20 channels. The largest channel alone was 454 MB — nearly a decade of continuous development conversation.</p><p>After the initial export, I ran an incremental update to fetch new messages, just to see if that feature I had added was working — and <strong>Discord disabled my account for “suspicious activity.”</strong> Oops. What I was doing was against Terms of Service. After looking into it a bit further, I learned that this is a <a href="https://github.com/Tyrrrz/DiscordChatExporter/issues/1497">known, active topic</a> in the GitHub Issues. Apparently Discord has recently <em>(early 2026)</em> started aggressively detecting automated user token usage with folks wanting to export their data and leave the platform.</p><p>Okay. Well, lesson learned. I already had a mostly full historical export of the n64brew Discord server. That’s the bulk of the value. The SDK documentation, header files, and source code repos can be kept current via git pull without any Discord risk. The Discord data is a snapshot -- and a comprehensive one.</p><p>Discord organizes content as: Server &gt; Category &gt; Channel &gt; Thread &gt; Message. I preserved this hierarchy in the database:</p><ul><li><strong>Threads</strong> are the natural conversation boundary. Each thread = one searchable conversation.</li><li><strong>Forum channels</strong> (like #libdragon-forum and #help-and-questions) are entirely threads -- 338 and 135 threads respectively. Each is a standalone Q&amp;A topic.</li><li><strong>Main channel messages</strong> are grouped into conversations by reply chains and time proximity. My arbitrary rule was that a 30-minute gap equals a new conversation. It’s sub-optimal. I got lazy.</li></ul><p>This produced ~<strong>81,672 searchable conversations</strong> from ~752,040 messages.</p><p>Early on, I considered using an LLM to filter Discord messages during indexing — remove “empty calories” like reaction-only messages, off-topic chatter, and one-word replies. But I realized this would break a critical property of <strong>idempotency </strong>and<strong> determinism</strong>. If an LLM decides which messages are “valuable,” you get different results on different runs. The same conversation might be included one day and excluded the next. The knowledge base becomes non-deterministic.</p><p>Instead, I made the processing pipeline fully deterministic:</p><ol><li><strong>Extract</strong> — strip Discord JSON bloat (avatars, role metadata, color codes) down to essentials: timestamp, author, content, reactions, pins, reply chains</li><li><strong>Chunk</strong> — group into conversations (threads or reply-chain clusters)</li><li><strong>Enrich</strong> — add deterministic metadata: has_code_block, reaction_count, participant_count</li><li><strong>Index</strong> — FTS5 full-text search with Porter stemming</li></ol><p><strong>No LLM touches the data during processing.</strong> Claude judges relevance at query time, with full context of what it’s trying to accomplish. This is the right moment for intelligence — not during a batch job.</p><p>The server is built with Python’s <a href="https://github.com/modelcontextprotocol/python-sdk">FastMCP</a> framework and exposes 9 tools:</p><ul><li>search_discord -- full-text search with channel filters, code-block filter, minimum message threshold</li><li>get_conversation -- retrieve full message history of a conversation</li><li>get_channel_info -- list channels with statistics</li><li>get_thread_list -- browse forum threads sorted by recency, activity, or reactions</li><li>search_docs -- search SDK headers, wiki pages, and examples</li><li>get_doc -- retrieve full content of a header file or example</li><li>search_source_code -- search across 14 homebrew game projects</li><li>get_source_file -- retrieve a full source file</li></ul><p>All tools are annotated as readOnlyHint=True and idempotentHint=True, allowing Claude Code to parallelize them safely.</p><p>A typical flow when I ask Claude to help with N64 rendering:</p><ol><li>Claude calls search_discord(&quot;rdpq sprite rotation bilinear&quot;) -- finds community discussions about the topic</li><li>Claude calls search_docs(&quot;rdpq_sprite_blit&quot;) -- finds the actual header documentation</li><li>Claude calls get_conversation(12345) -- reads a specific expert discussion</li><li>Claude calls search_source_code(&quot;rdpq_sprite_blit&quot;) -- sees how real games use the function</li><li>Claude writes code informed by all four sources</li></ol><p>The MCP server gives Claude the same research workflow a human developer would use: search the docs, check the Discord, look at examples.</p><p>If someone were to do something like this in the future, I would recommend <strong>starting with a bot token. </strong>Get in touch with your Discord server admins up front and ask about adding a read-only bot. Using a user token worked for the initial bulk export but isn’t sustainable for ongoing syncs. It violates TOS.</p><p>A huge takeaway for me from all this is that <strong>the rules files are underrated.</strong> The .claude/rules/ files I wrote early on -- covering hardware constraints, initialization patterns, common pitfalls -- provide enormous value for their simplicity. They cost nothing to maintain and ensure Claude always has foundational N64 knowledge loaded. The MCP server complements them for deeper, on-demand lookups.</p><p>The MCP server pattern works for any niche domain where LLMs lack training data. The key ingredients:</p><ol><li><strong>Identify your knowledge sources</strong> — Discord, Slack, forums, documentation sites, source code repos</li><li><strong>Export everything deterministically</strong> — no LLM filtering at index time</li><li><strong>Build a search index</strong> — SQLite FTS5 is hard to beat for simplicity</li><li><strong>Expose via MCP tools</strong> — search + retrieve pattern (list results, then fetch details)</li><li><strong>Let the LLM judge relevance at query time</strong> — it has the context you don’t</li></ol><p>The Model Context Protocol is the right abstraction for this. It lets you give Claude (or any MCP-compatible AI) domain expertise without fine-tuning, without massive prompts, and without hoping it learned your niche SDK from its training data.</p><p><em>My N64Brew MCP server is a personal tool, not a distributed product. I don’t wish to undermine the efforts or nature of the community, or disincentivize participation in the community in any way. The Discord data is kept local and not redistributed. It was built with Claude Code (Opus 4.6), Python FastMCP, SQLite FTS5, and DiscordChatExporter.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0154cf8b070d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing Flutter with Physical Devices on WSL2 — Windows 10]]></title>
            <link>https://joshkautz.medium.com/developing-flutter-with-physical-devices-on-wsl2-windows-10-20c1bff2344b?source=rss-dd0a260f7746------2</link>
            <guid isPermaLink="false">https://medium.com/p/20c1bff2344b</guid>
            <dc:creator><![CDATA[Josh Kautz]]></dc:creator>
            <pubDate>Fri, 14 Jan 2022 20:40:08 GMT</pubDate>
            <atom:updated>2022-11-28T15:37:19.801Z</atom:updated>
            <content:encoded><![CDATA[<h3>Developing Flutter with Physical Devices on WSL2 — Windows 10</h3><p>Welcome! If you haven’t yet installed Flutter on WSL2, be sure to check out the previous article that steps through that process…</p><p><a href="https://joshkautz.medium.com/installing-flutter-2-0-on-wsl2-2fbf0a354c78">Installing Flutter on WSL2 — Windows 10</a></p><p>… Congratulations! Now you’re ready to get developing with Flutter on WSL2 for Windows 10. We will be running some Bash commands on WSL2, but it should be very simple.</p><h3>Connect to Android device (Wireless Connection)</h3><h4>Enable Developer options and USB debugging</h4><p>This varies slightly by Android version. In general, go to <em>Settings</em>, go to <em>About phone</em>, and tap on <em>Build number</em> 7 times. Then a <em>Developer options</em> menu will become visible in the <em>Settings&gt;System </em>menu, in which you will be able to enable <em>USB debugging</em>. See the <a href="https://developer.android.com/studio/debug/dev-options#enable">Android documentation</a> for the most up-to-date instructions.</p><h4>Connect Android device to WSL2 via TCP/IP</h4><p>First, ensure that your device is available on the same network as your computer; this is achievable with a Wi-Fi connection.</p><p>Next, determine the IPv4 address that is assigned to your device. You can do this by navigating to the <em>Settings&gt;About phone </em>menu on your device, and finding the <em>IP address </em>section.</p><p>Now, in your WSL2 terminal, run adb connect 192.168.0.22 , but be sure to replace 192.168.0.22with the IP address that is actually assigned to your device. The command will tell you that you’ve failed to authenticate to the IP address, but that’s because you still need to allow USB debugging on the device from WSL2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*PVoGsp8xBNtQCIhol7XTuw.png" /></figure><p>Using the pop-up prompt on your device, check the option to <em>“Always allow from this computer”</em>, and tap the button that says <em>Allow</em> — this will grant WSL2 access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*wQcQfARcYk9ZfsTLQ5ycZA.png" /></figure><p>Finally, confirm that you can debug Flutter apps with your device by typing flutter devices into your WSL2 terminal! You can now see your connected device listed!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*O-d2eTIU1Tzy4Vnd7J7xlg.png" /></figure><h3>Connect to Android device (Wired Connection)</h3><p>Unfortunately, wired USB debugging is much more difficult to achieve on WSL2 running on Windows 10. Out of the box, WSL2 does not support connecting USB devices on Windows 10 — this behavior is only achieved through 3rd party open-source projects. So we won’t cover it in this article.</p><p>However, the good news is that WSL2 now supports connecting USB devices on Windows 11, thanks to contributions from these same 3rd party open-source projects.</p><h3>Run a Flutter app on the Android Device</h3><p>We’re still in WSL2. Create a Projects directory if it doesn’t already exist, and navigate to it.</p><pre>mkdir -p $HOME/Projects &amp;&amp; cd &quot;$_&quot;</pre><p>Use the flutter create command to create a new project.</p><pre>flutter create myapp;<br>cd myapp;</pre><p>Run your new app!</p><pre>flutter run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*1JD3LEg32tBP04-NkWrPfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*zTAJj6VSwdjQU1XPsh2gbQ.png" /></figure><p>Nice work! We’re now using WSL2 to develop Flutter apps! In case you missed it, we previously explored how to use Android Virtual Devices for development and debugging, in case you don’t have a physical device…</p><p><a href="https://joshkautz.medium.com/developing-with-flutter-2-0-on-wsl2-a00bd064cf2c">Developing Flutter with Android Emulators on WSL2 — Windows 10</a></p><h4>References:</h4><blockquote><a href="https://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp">https://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp</a></blockquote><blockquote><a href="https://medium.com/py-bits/wireless-debugging-flutter-android-d5af4bb92dbc">https://medium.com/py-bits/wireless-debugging-flutter-android-d5af4bb92dbc</a></blockquote><blockquote><a href="https://stackoverflow.com/questions/54444538/how-do-i-run-test-my-flutter-app-on-a-real-device">https://stackoverflow.com/questions/54444538/how-do-i-run-test-my-flutter-app-on-a-real-device</a></blockquote><blockquote><a href="https://stackoverflow.com/questions/60166965/adb-device-list-empty-using-wsl2">https://stackoverflow.com/questions/60166965/adb-device-list-empty-using-wsl2</a></blockquote><blockquote><a href="https://stackoverflow.com/questions/55076924/how-to-connect-a-device-with-adb-over-wifi-when-making-app-with-flutter">https://stackoverflow.com/questions/55076924/how-to-connect-a-device-with-adb-over-wifi-when-making-app-with-flutter</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20c1bff2344b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing Flutter on WSL2 — Windows 10]]></title>
            <link>https://joshkautz.medium.com/installing-flutter-2-0-on-wsl2-2fbf0a354c78?source=rss-dd0a260f7746------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fbf0a354c78</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Josh Kautz]]></dc:creator>
            <pubDate>Tue, 04 May 2021 17:48:40 GMT</pubDate>
            <atom:updated>2022-11-28T15:27:30.477Z</atom:updated>
            <content:encoded><![CDATA[<h3>Installing Flutter on WSL2 — Windows 10</h3><p><em>Updated: January 14th, 2022 to use most recent versions of Ubuntu (20.04.3 LTS), Flutter (2.8.1), Dart (2.15.1), and all accompanying screenshots.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Kn9J_NSB8jiwm1D3iCxzg.jpeg" /><figcaption>Using the Paradox Oh-My-Posh theme with my custom configuration in Windows Terminal.</figcaption></figure><p>I’m running Ubuntu 20.04.3 LTS on Windows Subsystem for Linux - WSL2 - and I’ve been enjoying it a lot now that I’m working off a Windows 10 machine. As a former Mac user - I wanted to leverage WSL2 while doing my Flutter development, so here’s how I went about setting up my environment. I will be running all of my commands in Bash, Ubuntu’s default shell.</p><h3><strong>Install Flutter</strong></h3><p>Create a Downloads directory if it doesn’t already exist, and navigate to it.</p><pre>mkdir -p $HOME/Downloads &amp;&amp; cd &quot;$_&quot;</pre><p>Download the latest <a href="https://flutter.dev/docs/development/tools/sdk/releases?tab=linux">Flutter SDK release</a>. <em>(Right-click and select “Copy link address” to copy the address of the archive.)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*dYU8A5wLmAtW-RWjYyWZzw.png" /><figcaption>Flutter SDK releases for different platforms and channels.</figcaption></figure><pre>wget <a href="https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.8.1-stable.tar.xz">https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.8.1-stable.tar.xz</a></pre><p>Create an Applications directory if it doesn’t already exist, and navigate to it.</p><pre>mkdir -p $HOME/Applications &amp;&amp; cd &quot;$_&quot;</pre><p>Extract the Flutter files from the archive in the Downloads directory to the Applications directory.</p><pre>tar xfv $HOME/Downloads/$(ls -d $HOME/Downloads/flutter*.tar.xz | xargs basename)</pre><p>Add the Flutter path to the Bash shell PATH variable in$HOME/.bashrc.</p><pre>echo -e &quot;\n# Flutter\nexport PATH=\$HOME/Applications/flutter/bin:\$PATH&quot; &gt;&gt; $HOME/.bashrc</pre><p>Execute the source Bash shell command to update the PATH variable in your working session.</p><pre>source $HOME/.bashrc</pre><p>Verify that Flutter is installed!</p><pre>flutter --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fiT-H_tSEtXTomTnseoVNA.jpeg" /><figcaption>Flutter successfully installed!</figcaption></figure><p>Check if there are any dependencies you need to install to complete the setup.</p><pre>flutter doctor</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxWkD4gn94W-zRoieKUmUQ.jpeg" /></figure><p>The flutter doctor command checks your environment and displays a report to the terminal window. While we do have flutter properly installed, it is missing some dependencies that we’ll need.</p><p>Flutter relies on a full installation of Android SDK to supply its Android platform dependencies. So next we’ll install Android SDK.</p><h3>Install Android SDK</h3><p>Install the <a href="https://packages.ubuntu.com/focal/unzip"><em>unzip </em></a>utility and the <a href="https://packages.ubuntu.com/focal/default-jdk"><em>default-jdk</em></a><em> </em>development utility</p><pre>sudo apt install unzip default-jdk -y</pre><p>Create a Downloads directory if it doesn’t already exist, and navigate to it.</p><pre>mkdir -p $HOME/Downloads &amp;&amp; cd &quot;$_&quot;</pre><p>Download the latest Android SDK <a href="https://developer.android.com/studio#command-tools">Command line tools</a> for Linux. <em>(Right-click the download button and select “Copy link address” to copy the address of the archive.)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*xLwsWUaPUB7wNkbbnEVOsg.png" /><figcaption>Latest releases of Android SDK Command-Line Tools for different platforms.</figcaption></figure><pre>wget <a href="https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip">https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip</a></pre><p>Create an Applications directory if it doesn’t already exist, and navigate to it.</p><pre>mkdir -p $HOME/Applications &amp;&amp; cd &quot;$_&quot;</pre><p>Extract the Android SDK Command line tools files from the archive in the Downloads directory to the Applications directory.</p><pre>unzip $HOME/Downloads/$(ls -d $HOME/Downloads/commandlinetools-linux*.zip | xargs basename) -d ./android</pre><p>Get thesdkmanagerversion. <em>(As of writing, 5.0 is the latest stable release.)</em></p><pre>version=$($HOME/Applications/android/cmdline-tools/bin/sdkmanager --sdk_root=$HOME/Applications/android --version | head -n1);<br>echo $version;</pre><p>Create a new version directory for the command line tools.</p><pre>mkdir -p $HOME/Applications/android/cmdline-tools/$version</pre><p>Move the command line tools to the new version directory.</p><pre>mv -vt $HOME/Applications/android/cmdline-tools/$version/ $HOME/Applications/android/cmdline-tools/!($version)</pre><p>Add the cmdline-tools path to the Bash shell PATH variable in$HOME/.bashrc. This allows us to easily use tools like sdkmanager.</p><pre>echo -e &quot;\n# Android\nexport PATH=\$HOME/Applications/android/cmdline-tools/$version/bin:\$PATH&quot; &gt;&gt; $HOME/.bashrc;</pre><p>Execute the source Bash shell command to update the PATH variable in your working session.</p><pre>source $HOME/.bashrc</pre><p>Install packages with sdkmanager.</p><pre>sdkmanager --install &quot;system-images;android-31;google_apis;x86_64&quot; &quot;platform-tools&quot; &quot;platforms;android-31&quot; &quot;build-tools;31.0.0&quot; &quot;cmdline-tools;latest&quot;</pre><p>List all the successfully install packages</p><pre>sdkmanager --list_installed</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pI-bEl5R7gN0WaBk89IukQ.jpeg" /><figcaption>Packages successfully installed via <strong>sdkmanager</strong>!</figcaption></figure><p>Add the newly installed platform-tools and emulator path to the Bash shell PATH variable in$HOME/.bashrc. This gives us access to tools like adb, which we’ll need later when we use Android Emulators for running our Flutter apps.</p><pre>echo -e &quot;export PATH=\$HOME/Applications/android/emulator:\$PATH&quot; &gt;&gt; $HOME/.bashrc;<br>echo -e &quot;export PATH=\$HOME/Applications/android/platform-tools:\$PATH&quot; &gt;&gt; $HOME/.bashrc;</pre><p>Execute the source Bash shell command to update the PATH variable in your working session.</p><pre>source $HOME/.bashrc</pre><h3>Configure Flutter</h3><p>Configure flutter to use the Android SDK.</p><pre>flutter config --android-sdk $HOME/Applications/android/</pre><p>Accept Android SDK licenses.</p><pre>sdkmanager --licenses</pre><p>Check to see if if there are any more dependencies that you’ll need to install to complete the setup.</p><pre>flutter doctor</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*ASbzxby_KgWoSdK_ICqJnA.jpeg" /><figcaption>The Android SDK dependency is all set up and ready to go!</figcaption></figure><p>Nice work! We’ve now got Flutter and the Android SDK all set up on WSL2!<br>But, see that message — “<em>No devices available”</em> — in the screenshot above? We need to fix that. Next, we’ll be setting up our devices for development and debugging, but that deserves its own posts…</p><ul><li><a href="https://joshkautz.medium.com/developing-with-flutter-2-0-on-wsl2-a00bd064cf2c">Developing Flutter with Android Emulators on WSL2 — Windows 10</a></li><li><a href="https://joshkautz.medium.com/developing-flutter-with-physical-devices-on-wsl2-windows-10-20c1bff2344b">Developing Flutter with Physical Devices on WSL2 — Windows 10</a></li></ul><h3>References:</h3><blockquote><a href="https://stackoverflow.com/questions/62857688/how-to-make-flutter-work-on-wsl2-using-hosts-emulator">https://stackoverflow.com/questions/62857688/how-to-make-flutter-work-on-wsl2-using-hosts-emulator</a></blockquote><blockquote><a href="https://itnext.io/flutter-with-wsl-2-69ba8fc7682f">https://itnext.io/flutter-with-wsl-2-69ba8fc7682f</a></blockquote><blockquote><a href="https://stackoverflow.com/questions/44485848/android-sdk-cannot-be-found-by-flutter">https://stackoverflow.com/questions/44485848/android-sdk-cannot-be-found-by-flutter</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fbf0a354c78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing Flutter with Android Emulators on WSL2 — Windows 10]]></title>
            <link>https://joshkautz.medium.com/developing-with-flutter-2-0-on-wsl2-a00bd064cf2c?source=rss-dd0a260f7746------2</link>
            <guid isPermaLink="false">https://medium.com/p/a00bd064cf2c</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Josh Kautz]]></dc:creator>
            <pubDate>Tue, 04 May 2021 17:43:28 GMT</pubDate>
            <atom:updated>2022-11-28T15:34:43.673Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome! If you haven’t yet installed Flutter on WSL2, be sure to check out the previous article that steps through that process…</p><p><a href="https://joshkautz.medium.com/installing-flutter-2-0-on-wsl2-2fbf0a354c78">Installing Flutter on WSL2 — Windows 10</a></p><p>… Congratulations! Now you’re ready to get developing with Flutter on WSL2 for Windows 10. This time around, we will be running some Bash commands on WSL2, as well as some PowerShell commands on Windows. We are doing this because Windows 10 doesn’t easily provide a graphical interface for apps running on WSL2, so we can’t use an Android Emulator running on WSL2. Instead, we will use an Android Emulator running on Windows.</p><h3>Install Android Command Line Tools on Windows</h3><h4>Download Android Command Line Tools for Windows</h4><p>In PowerShell, create a Downloads directory if it doesn’t already exist, and navigate to it.</p><pre>md $HOME/Downloads -ErrorAction Ignore;<br>cd $HOME/Downloads;</pre><p>Download the latest Android <a href="https://developer.android.com/studio#command-tools">Command Line Tools</a> for Windows. <em>(Right-click the download button and select “Copy link address” to copy the address of the archive.)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*nWhWN_COY9o8eFIGJ-0i0g.png" /></figure><pre>wget -OutFile commandlinetools.zip <a href="https://dl.google.com/android/repository/commandlinetools-win-7583922_latest.zip">https://dl.google.com/android/repository/commandlinetools-win-7583922_latest.zip</a>;</pre><p>Create an Android directory if it doesn’t already exist, and move the contents of the compressed Android Command Line Tools bundle into it. Your new tools should reside in theC:\Android\cmdline-tools\tools\bin directory.</p><pre>Expand-Archive commandlinetools.zip -DestinationPath $HOME/Android/cmdline-tools;<br>Rename-Item $HOME/Android/cmdline-tools/cmdline-tools $HOME/Android/cmdline-tools/tools;</pre><h4>Add Android Command Line Tools to Environment Variable</h4><p>Add the path of these new Android Command Line Tools to the System’s <strong>Path </strong>Environment Variable. This will allow us to easily use tools like sdkmanagerfrom PowerShell. To do this, press ⊞ Winkey, type env, and click the option for “Edit the system environment variables.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*Purns15H38BjFVe7gk42Bg.png" /></figure><p>In the “Advanced” tab, click the “Environment Variables…” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*r5mMZAqlTDXyxGFcaWWIkw.png" /></figure><p>In the list of user variables, select the entry for “Path”, and click the “Edit…” button. Alternatively, double-click the entry to edit it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*h2S1m7ikrfTsKNbT1h4HAA.png" /></figure><p>Add a the path value to the Path variable, which will be C:\Android\cmdline-tools\tools\bin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*VdJpOeohViZIu3aYA9IROg.png" /></figure><h3>Create an Android Emulator on Windows</h3><h4>Install Android SDK packages</h4><p>Using the freshly installed Android Command Line Tools, we will use sdkmanager to install the Android SDK packages required for developing with an Android Emulator. You may need to open a new PowerShell session to be able to use the sdkmanager command.</p><pre>sdkmanager --install &quot;system-images;android-31;google_apis;x86_64&quot; &quot;platform-tools&quot; &quot;platforms;android-31&quot; &quot;build-tools;31.0.0&quot; &quot;cmdline-tools;latest&quot;</pre><p>At this point, we will want to update our System’s <strong>Path </strong>Environment Variable <em>again</em> because we just downloaded tools like Android Debug Bridge (adb) and Emulator — both of which we’ll be using — so we want easy access to them from PowerShell. To do this, add the values of the new paths to our environment variable. The two new values are C:\Android\platform-tools and C:\Android\emulator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*VAvUkBF6LBzQFQh6wmXQxQ.png" /></figure><h4>Create Android Virtual Device</h4><p>We are going to use avdmanager — a command line tool that allows us to create and manage Android Virtual Devices (AVDs). Since we currently don’t have any AVDs, create one a new one.</p><pre>avdmanager --verbose create avd --name &quot;Flutter&quot; --package &quot;system-images;android-31;google_apis;x86_64&quot; --device &quot;pixel_5&quot; --tag &quot;google_apis&quot; --abi &quot;x86_64&quot;</pre><p>Now the fun starts! We can actually run this AVD using the Emulator tool that we installed previously.</p><pre>emulator -avd Flutter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*QqSFs_fXtacoybBDwOG8vg.jpeg" /><figcaption>A lot of output, but that’s just fine.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*G6NiyD2j1TPr4QFjkCxieQ.png" /><figcaption>Android Virtual Device running on Windows!</figcaption></figure><h4>Run Android Debug Bridge</h4><p>We’re making tremendous progress, but currently we can’t build our Flutter app from WSL2 to this AVD. We need to somehow expose this device to WSL2. So, we are going to make the AVD available from WSL2 by using Android Debug Bridge (adb).</p><p>In a new PowerShell terminal, kill the Android Debug Bridge server if it is running.</p><pre>adb kill-server</pre><p>Next, ensure there is an Android Debug Bridge server running and listening on all network interfaces.</p><pre>adb -a server nodaemon</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*Yptzs2VysDq2l8DvdwYdgQ.jpeg" /></figure><p>In a new PowerShell terminal, check the list of connected devices on Android Debug Bridge.</p><pre>adb devices</pre><p>Look — We see our new device listed!</p><h3>Access Android Virtual Device from WSL2</h3><p>We’re on the home stretch! We are going to be running commands back in the WSL2 terminal, so these are Bash shell commands now. Now we just need to create a new Flutter app and run it on our new Android Virtual Device running on Windows. Right now, if we run the adb devices command on WSL2, we don’t see anything devices listed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*0mTkyFvA_dWWihamyepdrA.jpeg" /><figcaption>There’s a list, but it’s empty.</figcaption></figure><p>That’s because there are no devices connect to this system. Our AVD is connected to the Android Debug Bridge server running on the Windows system, which is a remote system. In order to view the AVD running on Windows, we need to specify the socket.</p><p>We’re going to need the IP Address of the Windows system, which we can quickly get by running cat /etc/resolv.conf | grep nameserver | cut -d&#39; &#39; -f2. However, we want the WSL2 system to remember this address, so we will save the value as an environment variable, so we will create a new Bash shell variable for it in $HOME/.bashrc.</p><pre>echo -e &quot;export ADB_SERVER_SOCKET=tcp:\$(cat /etc/resolv.conf | grep nameserver | cut -d&#39; &#39; -f2):5037&quot; &gt;&gt; $HOME/.bashrc;</pre><p>Execute the source Bash shell command to update the PATH variable in your working session.</p><pre>source $HOME/.bashrc</pre><p>Now when we run echo $ADB_SERVER_SOCKET we see something like tcp:172.31.0.1:5037. That’s going to be the new default socket that Android Debug Bridge in WSL2 will listen to. So now if you try running…</p><pre>adb devices</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*brvJY1cIgTvVTg3-f77gtw.jpeg" /></figure><p>Voilà! We can see our Android Virtual Device running on Windows from WSL2. What’s more, Flutter can see it too - we now have a connected device!</p><pre>flutter doctor</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*nNLKXTvk9D41Vz6ymIDxEg.jpeg" /></figure><h3>Run a Flutter app on the Android Virtual Device</h3><p>We’re still in WSL2. Create a Projects directory if it doesn’t already exist, and navigate to it.</p><pre>mkdir -p $HOME/Projects &amp;&amp; cd &quot;$_&quot;</pre><p>Use the flutter create command to create a new project.</p><pre>flutter create myapp;<br>cd myapp;</pre><p>Run your new app!</p><pre>flutter run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e1HzQ_X90mqoeL8-NCKu_Q.jpeg" /></figure><p>Nice work! We’re now using WSL2 to develop Flutter apps! Next, we’ll explore how to use our physical devices for development and debugging, instead of having to rely on our Android Virtual Devices. But, like usual, that deserves its own post…</p><p><a href="https://joshkautz.medium.com/developing-flutter-with-physical-devices-on-wsl2-windows-10-20c1bff2344b">Developing Flutter with Physical Devices on WSL2 — Windows 10</a></p><p><em>It was </em><a href="https://docs.microsoft.com/en-us/windows/wsl/tutorials/gui-apps"><em>recently announced</em></a><em> that Windows 11 does allow for running Linux GUI apps on WSL2, which means the possibility of running Android Virtual Devices directly on WSL2 itself instead of Windows. We’ll explore that in the future…</em></p><h3>References:</h3><blockquote><a href="https://docs.microsoft.com/en-us/windows/wsl/networking#accessing-windows-networking-apps-from-linux-host-ip">https://docs.microsoft.com/en-us/windows/wsl/networking#accessing-windows-networking-apps-from-linux-host-ip</a></blockquote><blockquote><a href="https://gist.github.com/bergmannjg/461958db03c6ae41a66d264ae6504ade">https://gist.github.com/bergmannjg/461958db03c6ae41a66d264ae6504ade</a></blockquote><blockquote><a href="https://stackoverflow.com/questions/65262340/cmdline-tools-could-not-determine-sdk-root">https://stackoverflow.com/questions/65262340/cmdline-tools-could-not-determine-sdk-root</a></blockquote><blockquote><a href="https://stackoverflow.com/questions/62145379/how-to-connect-android-studio-running-inside-wsl2-with-connected-devices-or-andr/66914856#66914856">https://stackoverflow.com/questions/62145379/how-to-connect-android-studio-running-inside-wsl2-with-connected-devices-or-andr/66914856#66914856</a></blockquote><blockquote><a href="https://stackoverflow.com/a/65262939/6105256">https://stackoverflow.com/a/65262939/6105256</a></blockquote><blockquote><a href="https://praveendavidmathew.medium.com/appium-running-tests-on-a-device-connected-to-a-remote-system-uiautomator2-cfd64139a35">https://praveendavidmathew.medium.com/appium-running-tests-on-a-device-connected-to-a-remote-system-uiautomator2-cfd64139a35</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a00bd064cf2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>