Android 工作室 com.google.ar.sceneform.ux.ArFragment 与 androidx.fragment.app.Fragment 不兼容

Android studio com.google.ar.sceneform.ux.ArFragment is incompatible with androidx.fragment.app.Fragment

android studio 不再支持 sceneform 库了吗?因为每当我用 (ArFragment) getSupportFragmentManager().findFragmentById(R.id.fragment) 实例化 ArFragment 时,我都会收到一个错误 Inconvertible types; cannot cast 'androidx.fragment.app.Fragment' to 'com.google.ar.sceneform.ux.ArFragment

我已经把 <meta-data android:name="com.google.ar.core" android:value="required" /> 和所有需要的东西放在清单中了

这是我的xml代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <fragment
        android:id="@+id/fragment"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:name="com.google.ar.sceneform.ux.ArFragment" />

</LinearLayout>

这是我的Java代码

package com.example.test;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.google.ar.sceneform.ux.ArFragment;

public class MainActivity extends AppCompatActivity {
    ArFragment arFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        arFragment = (ArFragment) getSupportFragmentManager().findFragmentById(R.id.fragment);
    }
}

这是我的 gradle 依赖关系

    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.17.1'

Google2020年停止开发,请使用当前maintained version