APK 构建可疑方法调用时出错
Error on APK Build suspicious method call
正在尝试生成签名的 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) {
}
干杯!
这不是一个好的解决方案,但如果您需要生成 APK,请将其添加到您的 build.gradle:
lintOptions {
abortOnError false
}
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
}
...
}
正在尝试生成签名的 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) {
}
干杯!
这不是一个好的解决方案,但如果您需要生成 APK,请将其添加到您的 build.gradle:
lintOptions {
abortOnError false
}
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
}
...
}