我做了什么:
我正在使用此库并通过gradle导入。导入时没有问题。 我正在尝试使用它的片段之一。 问题:
当我返回一个片段时,它说不 兼容的类型。必需:androidx.fragment.app.Fragment 尝试解决:
尝试建议重构,但由于提供的片段的“只读”属性而最终收到消息,因此无法完成。 有什么想法摆脱这个错误吗?为什么会这样呢?
〜谢谢〜
Gradle文件:
    apply plugin: 'com.android.application'
android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.test3"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    jcenter()
    maven {
        url  "http://dl.bintray.com/shimmerengineering/Shimmer"
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'ShimmerAndroidInstrumentDriver:ShimmerAndroidInstrumentDriver:AA-227-1test'
}
                    版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
您正在使用的库尚未移至AndroidX。因此,您必须启用Jetifier您的项目-这自动将非AndroidX项目进入AndroidX项目,让您使用的SignalsToPlotFragment,就好像它是一个androidx.fragment.app.Fragment。
您想将以下行添加到gradle.properties文件中,如果该文件尚不存在,则创建该文件:
android.useAndroidX=true
android.enableJetifier=true