Java Android支持库不支持';不存在,但可以';t在";“建立”;引用Android X的文件夹

Java Android支持库不支持';不存在,但可以';t在";“建立”;引用Android X的文件夹,java,android,android-databinding,androidx,Java,Android,Android Databinding,Androidx,我正在将我的Android迁移到target 28,并使用Android X而不是Android支持库。我已经更改了我项目中的大多数引用,以使用Android X 不幸的是,当我进行构建时,它会抱怨“构建”下的文件中使用了支持库引用,但这些引用是生成的,无法编辑 我现在该怎么办 下面是bug的层次结构: app/build/generated/source/apt/debug > com/company/projectname/databinding/FragmentColorItemB

我正在将我的Android迁移到target 28,并使用Android X而不是Android支持库。我已经更改了我项目中的大多数引用,以使用Android X

不幸的是,当我进行构建时,它会抱怨“构建”下的文件中使用了支持库引用,但这些引用是生成的,无法编辑

我现在该怎么办

下面是bug的层次结构:

app/build/generated/source/apt/debug > 
com/company/projectname/databinding/FragmentColorItemBinding.java   > 
error: package android.support.v7.widget does not exist 
Obvs,我试图手动更改,但出现以下错误:

Files under the "build" folder are generated and should not be edited. 
所以我不能改为引用Android X

我可以做些什么来编译我的构建

它在这条线上投诉顺便说一句:

public final android.support.v7.widget.CardView colorThumbnail;
在那个档案上。我想使用新的CardView,但不确定如何使用

编辑:

dependencies {
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    implementation files('libs/android-binding-v0.6-preview.jar')
    implementation 'com.flurry.android:analytics:8.2.0@aar'
    implementation files('libs/ormlite-android-5.0.jar')
    implementation files('libs/ormlite-core-5.0.jar')
    implementation 'com.google.android.gms:play-services-vision:18.0.0'
    implementation 'com.google.android.material:material:1.0.0-rc01'
    implementation 'androidx.cardview:cardview:1.0.0'

    implementation 'io.reactivex:rxjava:1.1.5'
    implementation 'io.reactivex:rxandroid:1.1.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.github.bumptech.glide:glide:4.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
    implementation 'androidx.core:core-ktx:1.1.0-alpha05'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    def appCenterSdkVersion = '2.0.0'
    implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
    implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"

}
这样不行。要迁移到AndroidX,您必须更改比所列内容更多的内容。 如果您在Android Studio中,完成迁移过程非常简单。只需转到
Refactor->迁移到AndroidX
。否则,您必须找到
/gradle.properties
文件并添加以下两行:

android.useAndroidX=true
android.enableJetifier=true
完成第一部分后,您需要将CardView导入语句中对java文件中CardView的引用更改为:

导入androidx.cardwiew.widget.cardwiew;
...
公共最终CardView彩色缩略图;

还要确保xml文件中的所有引用都是正确的

使缓存无效并重新启动是否激活了jetifier?如果您或您正在使用的依赖项仍然引用旧的支持库,则需要它。阅读此处:@MichaelStoddart如何使缓存无效?我做了一个清理/重建,但它不起作用。我做了重构>迁移到androidX,但它仍然给我这个问题。让我试试gradle.properties解决方案。在migrate to androidx文档中,两件事(迁移和添加gradle属性)我都做了,同样的问题接踵而至。我不知道为什么,但它只是不适用于数据绑定库和cardview.Hmm。我可以看到您用于cardview的依赖项吗?等等。我看到您尚未将对cardview的引用从support更改为androidx,请参见我的edit@Euridice01