<表达式>预期,得到'? [英] <expr> expected, got '?'

查看:28
本文介绍了<表达式>预期,得到'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Android Studio 的类中键入 SQLite 语句作为字符串文字时,IDE 给我以下警告:"<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.

Android Studio 的版本是 3.0.它发生在一大堆不同的陈述中,但一个典型的看起来像这样:

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

推荐答案

这是 Android Studio 3.0 中的一个错误并且已经被报告 此处.此外,这现在在 3.1 版本中得到修复.我使用的是最新的 Canary 5 3.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.

由于不会再有 3.0 补丁,您现在所能做的就是采用解决方法或禁用此 lint 检查.

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.

这篇关于&lt;表达式&gt;预期,得到'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆