Accessing Android SQLite Databases from IntelliJ IDEA
If your application uses an Android SQLite database, you can access this database right from IntelliJ IDEA through a data source of the Android SQLite type. For more information about IntelliJ IDEA data sources, see Data Sources.
Creating an Android SQLite data source
- Open the Database tool window by selecting from the main menu.
- Click on the toolbar and select Android SQLite from the drop-down menu.
In the Data Sources and Drivers Dialog that opens, specify the following:
- The name of the data source.
- The physical or virtual device where the target database is stored. If no devices are available in the drop-down list, this means that there are no running devices connected to IntelliJ IDEA. Run and connect a physical device or launch an emulator.
Specify the name of the application package the target database is associated with.
For more information about application packages, see Working with AndroidManifest
and Android documentation.
Select a package name suggested by IntelliJ IDEA or type its ID.
For the database to be accessible, the corresponding application must be built as debuggable and installed on the device or the emulator.
IntelliJ IDEA run configurations, by default, build Android applications in the debug mode. Alternatively, you can generate the APK in the debug mode.
In the Storage area, specify where the database is located:
- Choose Internal if the database is stored in the internal memory of the device or the emulator.
- Choose External if the database is stored in the external memory of the device or the emulator.
In the Database drop-down list, specify the database name or location:
- If the database is stored in the internal memory, choose the database name.
If the database is stored in the external memory,
specify the database location relative to the memory root. For example,
- If the necessary SQLite driver files are missing, download them by clicking the Download link at the bottom of the dialog box.
For more information refer to Creating and Importing Data Sources.