简体   繁体   中英

Error when I Migrate my project to androidx?

My project

Main class

I successfully migrated my project to androidx.

after I build my project it occurs an error in build folder.

error at build folder

Error:

`D:\jp\ft\FileTransfer\app\build\generated\ap_generated_sources\debug\out\me\pengtao\filetransfer\MainActivity_ViewBinding.java:4: error: package android.support.annotation does not exist import android.support.annotation.CallSuper; ^ D:\jp\ft\FileTransfer\app\build\generated\ap_generated_sources\debug\out\me\pengtao\filetransfer\MainActivity_ViewBinding.java:5: error: package android.support.annotation does not exist import android.support.annotation.UiThread; ^

D:\jp\ft\FileTransfer\app\build\generated\ap_generated_sources\debug\out\me\pengtao\filetransfer\PopupMenuDialog_ViewBinding.java:4: error: package android.support.annotation does not exist import android.support.annotation.CallSuper; ^ D:\jp\ft\FileTransfer\app\build\generated\ap_generated_sources\debug\out\me\pengtao\filetransfer\PopupMenuDialog_ViewBinding.java:5: error: package android.support.annotation does not exist import android.support.annotation.UiThread; ^ D:\jp\ft\FileTransfer\app\build\generated\ap_generated_sources\debug\out\me\pengtao\filetransfer\MainActivity_ViewBinding.j ava:22: error: cannot find symbol @UiThread ^ symbol: class UiThread location: class MainActivity_ViewBinding where T is a type-variable: T extends MainActivity declared in class MainActivity_ViewBinding

D:\jp\ft\FileTransfer\app\build\generated\ap_generated_sources\debug\out\me\pengtao\filetransfer\MainActivity_ViewBinding.j ` ava:42: error: cannot find symbol @CallSuper ^ symbol: class CallSuper location: class MainActivity_ViewBinding where T is a type-variable: T extends MainActivity declared in class MainActivity_ViewBinding

D:\jp\ft\FileTransfer\app\build\generated\ap_generated_sources\debug\out\me\pengtao\filetransfer\PopupMenuDialog_ViewBin ding.java:25: error: cannot find symbol @UiThread ^ symbol: class UiThread location: class PopupMenuDialog_ViewBinding where T is a type-variable: T extends PopupMenuDialog declared in class PopupMenuDialog_ViewBinding

   D:\jp\ft\FileTransfer\app\build\generated\ap_generated_sources\debug\out\me\pengtao\filetransfer\PopupMen 
   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

How can I solve this?

AndroidX and Butterknife only works with 9.0.0-SNAPSHOT or later

you can update your define in build.gradle as below

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM