将项目迁移到androidx时出错



我的项目

主类

我成功地将我的项目迁移到androidx。

在我构建我的项目之后,它在构建文件夹中发生了一个错误。

生成文件夹时出错

错误:

`D: \jp\ft\FileTransfer \app\build\generated\ap_generated_sources\debug\out\me\pengtao\FileTransfer\MainActivity_ViewBinding.java:4:错误:package android.support.annation不存在导入android.support.annotation.CallSuper;^D: \jp\ft\FileTransfer \app\build\generated\ap_generated_sources\debug\out\me\pengtao\FileTransfer\MainActivity_ViewBinding.java:5:错误:package android.support.annation不存在导入android.support.annotation.UiThread;^

D: \jp\ft\FileTransfer \app\build\generated\ap_generated_sources\debug\out\me\pengtao\FileTransfer\PopupMenuDialog_ViewBinding.java:4:错误:package android.support.annation不存在导入android.support.annotation.CallSuper;^D: \jp\ft\FileTransfer \app\build\generated\ap_generated_sources\debug\out\me\pengtao\FileTransfer\PopupMenuDialog_ViewBinding.java:5:错误:package android.support.annation不存在导入android.support.annotation.UiThread;^D: \jp\ft\FileTransfer \app\build\generated\ap_generated_sources\debug\out\me\pengtao\FileTransfer\MainActivity_ViewBinding.java:22:错误:找不到符号@UiThread^符号:类UiThread位置:类MainActivity_ViewBinding其中T是类型变量:T扩展类MainActivity_ViewBinding 中声明的MainActivity

D: \jp\ft\FileTransfer \app\build\generated\ap_generated_sources\debug\out\me\pengtao\FileTransfer\MainActivity_ViewBinding.j`ava:42:错误:找不到符号@CallSuper^符号:类CallSuper位置:类MainActivity_ViewBinding其中T是类型变量:T扩展类MainActivity_ViewBinding 中声明的MainActivity

D: \jp\ft\FileTransfer \app\build\generated\ap_generated_sources\debug\out\me\pengtao\FileTransfer\PopupMenuDialog_ViewBinding.java:25:错误:找不到符号@UiThread^符号:类UiThread位置:类PopupMenuDialog_ViewBinding其中T是类型变量:T扩展类PopupMenuDialog_ViewBinding 中声明的PopupMenuSDialog

D:jpftFileTransferappbuildgeneratedap_generated_sourcesdebugoutmepengtaofiletransferPopupMen 
uDialog_ViewBinding.java:64: error: cannot find symbol
@CallSuper
^
symbol:   class CallSuper
location: class PopupMenuDialog_ViewBinding<T>
where T is a type-variable:
T extends PopupMenuDialog declared in class PopupMenuDialog_ViewBinding
8 errors
> Task :app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
*   Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log 
output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 33s
17 actionable tasks: 9 executed, 8 up-to-date

我该如何解决这个问题?

AndroidX和Butterknife仅适用于9.0.0-SNAPSHOT或更高版本的

你可以在build.gradle中更新你的定义,如下

butterknife        : "com.jakewharton:butterknife:10.2.1",
butterknifeCompiler: "com.jakewharton:butterknife-compiler:10.2.1",

最新更新