当我尝试导入场景形式 Assets 并在弹出的窗口上按完成时,没有任何 react 。没有生成 .sfa、.sfb 文件。在 build.gradle 文件中也没有生成任何内容。我不得不提到我导入的之前在同一个项目中的场景 Assets ,一切正常,但现在(一段时间后)当我再次尝试这样做时,它不起作用。
最佳答案
来自 https://developers.google.com/sceneform/develop/
考虑到 1.15 和 1.17.1 相同,还有这些问题
看起来它不再在开发中,他们不会修复它。这是 android studio 3.6 及更高版本的问题。
没有解决方案,您可以回滚到 Android studio 3.5,或者您可以使用快速解决方法。
右键单击顶级应用程序级目录 > 新建 > 示例数据目录
// Top-level build file where you can add configuration options. common to all sub-projects/modules
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.google.ar.sceneform:plugin:1.15.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
应用插件:'com.android.application'
应用插件:'com.google.ar.sceneform.plugin'
android {
...
defaultConfig {
...
ndk {
/*
* Sceneform is available for the following ABIs: arm64-v8a, armv7a,
* x86_64 and x86. This sample app enables arm64-v8a to run on
* devices and x86 to run on the emulator. Your application should
* list the ABIs most appropriate to minimize APK size (arm64-v8a recommended).
*/
abiFilters 'arm64-v8a', 'x86'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildTypes {
...
}
}
dependencies {
...
implementation 'com.google.ar.sceneform:core:1.15.0'
}
< sceneform.asset code - 7th step >
右键单击 res > 新建 > 文件夹 > 原始资源文件夹。
sceneform.asset('sampledata/mars.obj', // 'Source Asset Path' specified during import.
'default', // 'Material Path' specified during import.
'sampledata/mars.sfa', // '.sfa Output Path' specified during import.
'src/main/res/raw/mars')
Sceneform 弃用了对 SFB 和 SFB Sceneform Android Studio 插件的支持(可以使用 glTF) - Release Notes
该文档仅适用于 sceneform 1.15.0——不包括 glTF 工作流程。您可以查看 this使用 glTF 的演示。
关于android-studio - 导入 Sceneform Assets 不会生成 .sfa 和 .sfb 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62124242/