将注释处理器迁移到androidX [英] Migrate annotation processor to androidX

查看:84
本文介绍了将注释处理器迁移到androidX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有以下依赖项的android注释处理器:

I've a annotation processor for android with following dependencies:

compile 'com.squareup:javapoet:1.10.0'
compile 'com.google.android:android:4.1.1.4'
compile 'com.google.android:support-v4:r7'

在我的处理器中,我访问 Activity Fragment 类.我现在需要包括哪些功能才能使用新的android x Fragment ?我对此一无所获...

In my processor I access Activity and Fragment class. Which includes do I need now to be able to use the new android x Fragment? I can't find anything about this...

我天真地尝试添加

implementation 'androidx.fragment:fragment:1.0.0'
// or
implementation 'androidx.appcompat:appcompat:1.0.0'

但这无济于事...

推荐答案

在新的AndroidX项目中, Fragment 的导入如下:

On the new AndroidX projects, Fragments import are like this:

import androidx.fragment.app.Fragment

这意味着,您应该已经添加了依赖项,并迁移到了AndroidX,它将显示如下所示的依赖项:

Which means, you should already have added the dependencies and migrated to AndroidX which will show the dependenices like following for example:

implementation 'androidx.appcompat:appcompat:1.0.0'

因此,您可能不需要此:

So, you won't probably need this:

implementation 'androidx.fragment:fragment:1.0.0'

这篇关于将注释处理器迁移到androidX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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