java - APK 构建可疑方法调用时出错

标签 java android apk lint

尝试生成签名的 APK,但我收到此消息:

Error:Error: Suspicious method call; should probably call "layout" rather than "onLayout" [WrongCall]

我在方法上添加了 SupressLint,但它不起作用:

@SuppressLint("WrongCall")
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
}

干杯!

最佳答案

With Android Studio, you can also run lint inspections for a specific build variant, or for all build variants from the build.gradle file. Add the lintOptions property to the android settings in the build file. This code snippet from a Gradle build file shows how to set the quiet option to true and the abortOnError option to false.

android {
    lintOptions {
       // set to true to turn off analysis progress reporting by lint
       quiet true
       // if true, stop the gradle build if errors are found
       abortOnError false
       // if true, only report errors
       ignoreWarnings true
       }
       ...
    }

致谢 Improving Your Code with lint

关于java - APK 构建可疑方法调用时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34309521/

相关文章:

java - 在 Android Studio 中合并 XML 和 Java 文件

java - 是否可以使用 WebDriver 获取网页上的所有 WebElements

java - 是否有任何 Java API 可以将文件从一台服务器传输到另一台服务器?

java - 具有多个 View 类型的 Recyclerview 相互通信?

android - 我的应用程序如何找出启用了哪种 NFC 模式?

android - 无法在 Redmi 手机上运行 react-native 应用程序?

android - 如何使用 Python 代码安装 Android .APK?

java - 在 java 中录制音频并实时确定是否播放了 x 频率的音调(如果播放)

java - 使用 java 的正则表达式替换多个捕获组

java - 如何利用GPS精确计算速度和距离?跟踪用户位置。用于运行的应用程序