如何解决片段无法转换为CustomArFragment
我最近遇到了一些麻烦,想问问是否有人在这里遇到过同样的问题。最近,我在3.6.3中重建了我的AR项目,发现“错误:类型不兼容:片段无法转换为CustomArFragment”。之后,我又回到了3.5.3,并且错误没有消失。
arFragment = (CustomArFragment) getSupportFragmentManager().findFragmentById(R.id.sceneform_fragment);
assert arFragment != null;
arFragment.getPlaneDiscoveryController().hide(); // delete plane detection & hands gesture,needs to be placed in the onCreate (when app starts)
在重建之前,Fragment类与CustomArFragment兼容,并且我的应用程序运行正常。
import com.google.ar.core.Config;
import com.google.ar.core.Session;
import com.google.ar.sceneform.ux.ArFragment;
public class CustomArFragment extends ArFragment {
@Override
protected Config getSessionConfiguration(Session session) {
getPlaneDiscoveryController().setInstructionView(null);
Config config = new Config(session); // Config handles Settings for ARCore,session controls lifecycle of Augmented Reality of ARCore
config.setUpdateMode(Config.UpdateMode.LATEST_CAMERA_IMAGE); // The Settings are set to allow augmented images to work
config.setFocusMode(Config.FocusMode.AUTO); // Camera Focus
config.setPlaneFindingMode(Config.PlaneFindingMode.HORIZONTAL);
config.setLightEstimationMode(Config.LightEstimationMode.ENVIRONMENTAL_HDR);
session.configure(config);
this.getArSceneView().setupSession(session); // attach session to ArSceneView
return config;
}
}
参考sceneform 1.15.0上的文档,我的代码尚未改编,只是重建了,但是调试消息不断弹出并阻止代码运行。
解决方法
已解决,重置的Windows,并重新安装了android studio以使代码正常工作
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。