版本8.8.0中不建议使用ButterKnife findByID方法 [英] ButterKnife findByID method is deprecated in version 8.8.0

查看:274
本文介绍了版本8.8.0中不建议使用ButterKnife findByID方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将ButterKnife库的版本从8.7.0更新到了8.8.0

Hi I have just updated ButterKnife library version 8.7.0 to 8.8.0

compile 'com.jakewharton:butterknife:8.8.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'

发现:

findById(view, id);

已被弃用,为什么?用什么方法代替?但是将版本恢复到8.7.0(或更早版本)时,已弃用的警告会消失.

is deprecated, why? what method to use instead? but when reverting version to 8.7.0 (or earlier) deprecated warning disappears.

compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
    applicationId "com.some.app"
    minSdkVersion 21
    targetSdkVersion 25
...

推荐答案

每个

弃用 findById 方法.根据API 26进行编译,并使用正常的 findViewById 获得相同的功能.

Deprecate the findById methods. Compile against API 26 and use the normal findViewById for the same functionality.

Android的 findViewById 已更新,以在最近变得稳定的API 26中具有相同的功能,从而允许在即将发布的v9.0中弃用和删除Butter Knife的版本.

Android'sfindViewById has been updated to have the same functionality in API 26 which recently became stable, thus allowing Butter Knife's version to be deprecated and removed in the forthcoming v9.0.

这篇关于版本8.8.0中不建议使用ButterKnife findByID方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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