Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<expr> expected, got '?'

When typing a SQLite statement as a string literal in a class in Android Studio, the IDE gives me this warning: "<expr> expected, got '?'".

I don't understand what this means, but the code is working fine, and I'd like to disable the inspection. But I don't know which inspection is causing it. There are thousands of them, and searching for or expected yields no useful results.

The version of Android Studio is 3.0. It's happening with a whole bunch of different statements, but a typical one looks like this:

SQLiteStatement st = db.compileStatement(    "INSERT OR REPLACE INTO routes(route_code, route_desc) VALUES(?,?)" ); 
like image 882
Flarosa Avatar asked Oct 30 '17 17:10

Flarosa


Video Answer


1 Answers

This is a bug in Android Studio 3.0 and is already reported here. Also this is now fixed in the 3.1 version. I am using the latest Canary 5 3.1 build and it works fine.

Since there are not going to be anymore 3.0 patches, all you can do for now is to go with the workaround or disable this lint check.

like image 101
Henry Avatar answered Sep 17 '22 20:09

Henry