Error while importing FBX with Import Sceneform Asset in Android Studio 3.6
Asked Answered
A

2

10

Im using a sceneform android sdk animation example project and am trying to import my own FBX for test. I add my fbx to sampledata/models and click on Import Sceneform Asset. Im getting an error ... "Gradle build failed with new import rules. Would you like to revert the changes?"

In the event log window I get Error: java.lang.RuntimeException: java.lang.NoSuchMethodError: com.android.tools.idea.templates.recipe.RecipeExecutor.append(Ljava/io/File;Ljava/io/File;)V

Im using Android Studio 3.6 Gradle 3.6.0 sceneform plugin 1.15

Any suggestion how to fix this would be welcomed

Alkyne answered 26/2, 2020 at 12:11 Comment(1)
did you find any solution?Goodyear
C
13

I had this problem and i tried adding the asset manually and it worked.

for example, I used the obj called andy_dance.fbx

so what I did was add this in the Gradle build

sceneform.asset('sampledata/models/andy_dance.fbx',
    'default',
    'sampledata/models/andy_dance.sfa',
    'src/main/assets/andy_dance',
    ['sampledata/models/andy_dance.fbx'])

run or build your app and hopefully, it'll work

Candlepin answered 28/2, 2020 at 11:36 Comment(2)
Nice answer! Its worth mentioning it is the build.gradle(app) version of the file. I did the same thing using the online ARCore example and it worked for me too (https://mcmap.net/q/1062434/-gradle-build-failed-with-new-import-rules). Its worth noting that this seems to be an open issue (github.com/google-ar/sceneform-android-sdk/issues/912) and that another workaround appears to be to revet to Android Studio 3.5, (https://mcmap.net/q/1161975/-error-when-importing-sceneform-asset-for-obj-and-gltf-file) although I have not tried this myself.Creswell
Yep, had to revert to Android Studio 3.5Alkyne
R
9

There was a compatibility issue between android studio 3.6 and sceneform... So use this work around of manually generating the sfb file to solve compatible issues ..

Here is the FULL answer that will help anybody that's new to this and wanna use sceneform well without problems.

**

Step 1

. On the top left corner of your android studio sdk, Go to **File, Click Settings and search for plugins in the window that popups, and search for Sceneform in the online plugin marketplace step1

**

Step 2

**. Create a new folder and call it anything you like, For example i called this "sample_data"..step2

**

Step 3

**. 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.

step3picture

**

Step 4

. Now paste this code format below **on the last line on your app's gradle build file in order to import MANUALLY and avoid any compatibility issues with the right-click method of importing which was seen in Android studio version 3.6... Of course dont forget to import lastest dependencies of Sceneform in your list of gradle dependencies

apply plugin: 'com.google.ar.sceneform.plugin', sceneform.asset('sample_data/Your-3d-Model-file-Name.obj',

'default', // 'Material Path' specified during import.

'sample_data/Your-3d-Model-file-Name.sfa',

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

Step 5

. Finally sync your gradle file and rebuild your project... Your SFb model would have been generated in the location you specified..

Retinitis answered 2/5, 2020 at 4:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.