Import sceneform asset android studio не работает

Ошибка при импорте FBX с помощью Импортировать Sceneform Asset в Android Studio 3.6

Я использую пример проекта для Android SDK, и пытаюсь импортировать свой собственный FBX для теста. Я добавляю свой fbx к выборке / моделям и нажимаю на «Импорт объекта сцены». Я получаю сообщение об ошибке . «Сбой сборки Gradle с новыми правилами импорта. Хотите отменить изменения?»

В окне журнала событий я получаю сообщение об ошибке: java.lang.RuntimeException: java.lang.NoSuchMethodError: com.android.tools.idea.templates.recipe.RecipeExecutor.append (Ljava / io / File; Ljava / io / File;) В

Я использую Android Studio 3.6 Gradle 3.6.0 плагин сценической формы 1.15

Любое предложение, как это исправить, будет приветствоваться

2 ответа

У меня была эта проблема, и я попытался добавить актив вручную, и это сработало.

Например, я использовал объект под названием andy_dance.fbx

Так что я сделал, это добавить это в сборке Gradle

Запустите или создайте свое приложение и, надеюсь, оно будет работать

Возникла проблема совместимости между android studio 3.6 и sceneform . Так что используйте эту возможность обхода ручного создания файла sfb для решения проблем совместимости.

Вот ПОЛНЫЙ ответ , который поможет любому новичку в этом деле и без проблем использовать сцену.

Шаг 1

. В верхнем левом углу вашей Android Studio SDK, перейдите к ** Файл, нажмите Настройки и найдите плагины в всплывающем окне и найдите Sceneform на онлайн-рынке плагинов

Шаг 2

** . Создайте новую папку и назовите ее как угодно. Например, я назвал это «sample_data».

Шаг 3

** . Скопируйте исходный файл 3D-модели (* .obj, * .fbx или .gltf) и все его зависимости ( .mtl, * .bin, * .png, * .jpg и т. Д.). .) в папку с примерами.

Шаг 4

. Теперь вставьте этот формат кода ниже ** в последнюю строку в файл сборки вашего приложения для gradle, чтобы импортировать ВРУЧНУЮ и избежать проблем совместимости с методом импорта, который щелкнул правой кнопкой мыши и который был замечен. в Android Studio версии 3.6 . Конечно, не забудьте импортировать последние зависимости Sceneform в свой список зависимостей gradle

применить плагин: ‘com.google.ar.sceneform.plugin’, sceneform.asset(‘sample_data/Your-3d-Model-file-Name.obj’,

‘default’, // ‘Material Path’ specified during import.

‘src/main/res/raw’) // ‘location you want to store the generated .sfb file’

Шаг 5

, Наконец синхронизируйте ваш файл Gradle и перестройте ваш проект . Ваша модель SFb была бы сгенерирована в указанном вами месте.

Источник

Импортируем модели с помощью плагина Sceneform на Android studio, но получаю «ошибка при создании sfa»

Я пробую новый Sceneform SDK от Google для AR.

В нем говорится, чтобы использовать плагин Google Sceneform Tools для импорта активов. Поэтому я следую всем здесь инструкциям по импорту мои активы.

Читайте также:  Mail ru мобильная версия для андроид

При импорте любой 3D-модели (в формате .obj или .fbx), каждый раз, когда я получаю эту ошибку — ошибка создания sfa без других подробностей ошибки, а затем это дает возможность отменить процесс актива импорт .

Я использую Android Studio 3.1.2 и использую ОС Linux (Ubuntu 18.04).

Я проверял шаги снова и снова, но все выглядит хорошо. Кто-нибудь еще сталкивается с этой же проблемой?

6 ответов

Google теперь обновил плагин Sceneform Gradle с исправлением этой ошибки. Используйте версию 1.0.1 плагина Sceneform.

В вашем проекте build.gradle замените это —

Это должно импортировать ваши активы отлично. Это работает для меня сейчас.

Это решение на github помогло мне:

1. Щелкните правой кнопкой мыши 3D-актив и выберите «Импортировать объект сцены»

2. нажмите «Готово»

3.Нажмите «сохранить сломанные изменения Gradle»

4.в «изменились файлы gradle . » нажмите «синхронизировать сейчас» — синхронизация завершится успешно, файл .sfa создан в папке sampledata, а файл .sfb создан в папке активов

Проблема заключается в том, что имя файла .obj отличается от имени файлов .sfa и .sfb, просто переименуйте файл .obj в нужное имя и никогда не трогайте имена файлов .sfa и .sfb.

Также убедитесь, что файл .mtl связан с ним.

Была такая же ошибка. Это не глюк. Я понял, что это потому, что путь к материалам в файле obj (строка 1) был неправильным. Он по-прежнему считал, что имя файла материалов было «materials.mtl», хотя на самом деле я переименовал его в «tree.mtl» (это была модель дерева).

Урок: не переименовывайте материалы или файлы текстур (если не забыли изменить пути внутри файла obj).

Проблема в том, что файл sceneform.asset уже был добавлен в ваш модуль build.gradle. Ниже приведен, например, файл sceneform.asset в build.gradle

И это всегда выдаст сообщение об ошибке, что задача с таким именем уже существует.

Чтобы решить эту проблему, удалите файл sceneform.asset, добавленный в Gradle, и повторите попытку синхронизации, а затем повторно импортируйте файл .sfb.

Надеюсь, что это решит проблему.

В настоящее время на Github создана проблема для этого. Существует проблема совместимости с конвертером в Ubuntu 18.04, но я не уверен, применимо ли это к другим дистрибутивам или более старым версиям Ubuntu. выпуск 13

Источник

Import and preview 3D assets

Learn how to import 3D models, convert them into Sceneform format, and preview them in Android Studio.

Import a new 3D asset

Sceneform supports 3D assets in the following formats:

  • OBJ
  • glTF (animations not supported)
  • FBX, with or without animations.

Follow these steps to import a new 3D asset:

Verify that your project’s app folder contains a sampledata folder.

To create the folder, right-click on the app folder in the Project window, then select New > Sample Data Directory.

The sampledata folder is part of your Android Studio project, but its contents will not be included in your APK.

Copy your 3D model source asset file ( *.obj , *.fbx , or *.gltf ), and all of its dependencies ( *.mtl , *.bin , *.png , *.jpg , etc.) into the sampledata folder.

Do not copy these source files into your project’s assets or res folder, as this will cause them to be included in your APK unnecessarily.

Right click the 3D model source asset and select Import Sceneform Asset to begin the import process.

The values are used by the sceneform.asset() entry in the app’s build.gradle , and determine where the *.sfa and *.sfb files will be generated in your project.

If you’re importing a model for the first time, use the default values.

Читайте также:  Аирподс для андроид как пользоваться
Field Description
Source Asset Path Filename of the OBJ, FBX, or glTF 3D model asset to import.
Material Path default tells Sceneform’s to use the built-in default material or the path to a custom material *.mat file.
.sfa Output Path Use the default, or specify another path under the sampledata folder.

The .sfa file is generated if missing. It can be modified to control some aspects of the import process.

This ensures that *.sfa isn’t included in your APK unncessarily.

.sfb Output Path By default the src/main/assets/ folder is used, which allows the use of arbitrary asset filenames.

If the filename (without file extension) is a valid resource identifier (e.g. R.raw.filename ), then you can instead use the src/main/res/raw/ folder if you prefer.

See Android’s App resources overview for more on using the assets/ and res/ folders in your app.

If you are importing *.fbx animation files, click the plus sign (+) and add the rest of the files individually.

Click Finish to begin the import process.

To import your asset, the plugin does the following:

Adds the Sceneform gradle plugin to your project’s build.gradle if it doesn’t already exist:

Updates your app’s build.gradle file to include an apply plugin line, and a sceneform.asset() entry for the newly imported asset:

These new entries in the app’s build.gradle create two gradle tasks:

createAsset- creates a Sceneform asset definition ( *.sfa ) file if it does not yet exist.

This task will not overwrite an existing *.sfa file, which means any modifications you make to the SFA file after import won’t be overwritten.

The *.sfa file is a text file that contains a complete, human-readable description of the asset’s import settings. It references the models and textures in your source asset, and also defines materials by providing material parameters for Sceneform’s physically based materials.

compileAsset- compiles the *.sfa file into a Sceneform binary asset ( *.sfb ) file.

This *.sfb file gets built into your app’s APK and is loaded at runtime to create the renderable.

Opens the *.sfa in a text window and the *.sfb in a Viewer window.

Update a previously imported 3D asset

When you update a previously imported OBJ, FBX, or glTF model source asset file ( *.obj , *.fbx , or *.gltf ), the corresponding sceneform.asset() entry in your app’s build.gradle causes the plugin to automatically generate an updated *.sfb file, based on the current *.sfa parameters.

To iterate on the parameters for an already imported asset:

  • Modify the *.sfa text file, using the SFA file format reference as a guide.
  • Save your changes. This causes the asset to be recompiled and updates the *.sfb file.
  • Preview the updated asset by double-clicking the *.sfb file to open the asset Viewer window.

If you are updating a previously imported asset that includes animation data, import each of the updated *.fbx files individually using the plus (+) sign in the Animation Files section of the import dialog.

Gradle asset definitions

The import process adds any *.fbx animation files at the end of the build.gradle file.

Create the Renderable

Once the asset is compiled into *.sfb format, you can build a ModelRenderable and attach it to a node in the scene as follows:

Using custom materials

Sceneform’s default materials make it easy for developers to get great looking results. You can also use custom materials to deeply customize the way your assets look.

To assign a custom material to your asset:

Create a custom material definition ( *.mat ) file, using the [Custom Material Reference](/sceneform/develop/custom-material as a guide.

Apply the custom material to the asset:

When importing a new asset:

  • Specify the custom material *.mat file during the import process.

To update a previously imported asset:

If the *.sfa contents have not been customized, delete the existing *.sfa and *.sfb files and the sceneform.asset() entry in the app’s build.gradle , then reimport the asset. This ensures that the regenerated *.sfa attributes and material parameters will match the ones supported by your custom material.

To preserve any *.sfa customizations you’ve made, open the *.sfa file and change the source attribute to the path to your custom material *.mat file, then manually adjust the *.sfa attributes and material parameters to match your custom material.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Источник

Sceneform plugin v1.15.0 not working w/Android Studio 3.6 stable (or Android Studio 4 Canary 9) #989

Comments

tellypresence commented Feb 13, 2020 •

SceneForm 1.15.0 plugin installed for three versions of Android Studio. Asset imports perfectly in legacy stable Android Studio (3.5.3) but not in

  • latest stable (3.6)
  • latest preview (4 canary 9)

Android Studio 3.5.3

Android Studio 4 Canary 9

The text was updated successfully, but these errors were encountered:

AndreaGrizzi commented Feb 20, 2020

issue found on Android Studio 3.6 on stabile channel.
import .obj file result in Error: java.lang.RuntimeException: java.lang.NoSuchMethodError: com.android.tools.idea.templates.recipe.RecipeExecutor.append(Ljava/io/File;Ljava/io/File;)

dawcules commented Feb 27, 2020

Updated to Androis Studio 3.6 and Sceneform 1.15.0. Every .obj and .fbx import results to: Error: java.lang.RuntimeException: java.lang.NoSuchMethodError: com.android.tools.idea.templates.recipe.RecipeExecutor.append(Ljava/io/File;Ljava/io/File;)

  • Tried to re-install sceneform -> no effect

tellypresence commented Feb 28, 2020

Confirm broken w/3.6 stable as well, changing title

VCDo commented Feb 28, 2020

After Android Studio update from stable 3.5.x to 3.6 the Sceneform Import stopped working! Updating tools and gradle versions did not fix this problem.

VCDo commented Mar 2, 2020

Since the plugin is not working anymore, is it possible to import a sceneform asset without android studio?

tellypresence commented Mar 2, 2020 •

@VCDo for now suggest having Android Studio 3.5.3 co-installed and doing all sceneform importing there; after successful import copy all the generated code/files (build.gradle block, .sfa/.sfb/.fbm etc) to your Android Studio 3.6.X or 4.X project and it should work fine — IIRC using the .sfb isn’t the problem, it’s just the import process itself that’s broken
. or just hold back on 3.5.3 pending proper fix.

BhaktijPatil commented Mar 4, 2020

Do we have any official confirmation from the Sceneform team as to when this issue will be addressed?

YinXiuYu commented Mar 10, 2020

I have the same issue.

FabianSchmiedlechner commented Mar 12, 2020

sameerjj commented Mar 13, 2020

A-khames commented Mar 14, 2020

I have the same issue

tellypresence commented Mar 30, 2020

IIUC Sceneform v1.16.0 deprecates the entire SceneForm plugin and .sfa/.sfb workflow instead migrating to direct support for .gltf/.glb format assets

Источник

Читайте также:  Microsoft outlook with android
Оцените статью