<expr> expected, got '?'

不问归期 提交于 2019-12-21 03:10:50

问题


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(?,?)"
);

回答1:


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.



来源:https://stackoverflow.com/questions/47021237/expr-expected-got

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!