java.lang.IllegalArgumentException: column '_id' does not exist
时间: 2023-10-16 14:15:00 浏览: 54
This error message is thrown when a query is executed on a database table that does not contain a column named '_id'. In Android, the '_id' column is a required column for all tables that are used with CursorAdapter and other similar classes.
To fix this error, you should ensure that your database table contains an '_id' column. This column should be defined as an integer primary key autoincrement. You can create this column by adding the following line to your CREATE TABLE statement:
```
CREATE TABLE my_table (_id INTEGER PRIMARY KEY AUTOINCREMENT, column1 TEXT, column2 INTEGER, ...);
```
If you already have a table that does not contain an '_id' column, you can add it using the ALTER TABLE statement:
```
ALTER TABLE my_table ADD COLUMN _id INTEGER PRIMARY KEY AUTOINCREMENT;
```
Once you have added the '_id' column to your table, you should be able to execute queries without encountering the IllegalArgumentException.