🤖
Android Tips
  • 🤖AOSP
    • Clone AOSP repository
    • Directory Structure
    • Setup IDE
      • Setup VSCode
    • Build
      • BluePrint for Application Project
      • BluePrint for Android Library Project
    • Manifest
      • sharedUserId
      • persistant
  • Gradle
    • Create Custom Build Config Variables
    • Create Custom manifest Variables
    • Make app debugable
  • Android Process
    • Find a process by name
    • Kill a process by Id
  • Catch any exception in Android
  • 🎨Theming
    • Theming
      • RRO
        • RRO Internals
        • RRO classes in AOSP
        • RRO Example
        • RRO Permission
      • Fabricated RRO (FRRO)
        • FRRO Example
        • Permission
  • Lifecycle
    • Basics
      • Lifecycle
        • Activity
        • Fragment
          • Fragment add
    • Lifecycle Aware Custom Class
  • â„šī¸Interview
    • Interview Questions
    • Architecture Pattern
      • MVC Architecture pattern
      • MVP Architecture Pattern
      • MVVM Architecture Pattern
  • â†”ī¸AIDL
    • Simple AIDL Communication
      • Creating an AIDL file
      • Create an AIDL server
      • Create AIDL client
      • Limitations
    • AIDL with callback
      • Create AILD interfaces
      • Create an AIDL server
      • Create AIDL client
Powered by GitBook
On this page
  • Steps:
  • Compdb (compile_commands.json) Generator
  1. AOSP
  2. Setup IDE

Setup VSCode

PreviousSetup IDENextBuild

Last updated 10 months ago

While working with native code, i.e. C, C++ and RustLang, VS Code is the best IDE, but how to setup intelisense.

We can generate Compbd file from AOSP and include it in our project to proper intellisense.

Steps:

Pre: Generate desired AOSP image beforehand.

Now generate Compdb file using .

Compdb (compile_commands.json) Generator

Soong can generate compdb files. This is intended for use with editing tools such as YouCompleteMe and other libclang based completers.

compdb file generation is enabled via environment variable:

$ export SOONG_GEN_COMPDB=1
$ export SOONG_GEN_COMPDB_DEBUG=1

One can make soong generate a symlink to the compdb file using an environment variable:

$ export SOONG_LINK_COMPDB_TO=$ANDROID_HOST_OUT

You can then trigger an empty build:

$ make nothing

Note that if you build using mm or other limited makes with these environment variables set the compdb will only include files in included modules.


Or simply run

SOONG_GEN_COMPDB=1 m nothing

Then open the C/C++ Configuration (ui), go to advanced and set the compile_commands.json path to

out/soong/development/ide/compdb/compile_commands.json

Rescan intellisense

Reset the intellisense database, restart VSCode, and enjoy near-instant intellisense for any C/C++ source file in all of AOSP.

🤖
these commands
VS Code screenshot