10

I met an error after I updated android studio to version 3.6. When I tried to import Scenceform asset, it shows a warning in the picture below, whatever I click, it will return

java.lang.RuntimeException: java.lang.NoSuchMethodError: com.android.tools.idea.templates.recipe.RecipeExecutor.append(Ljava/io/File;Ljava/io/File;)

warning picture and the error after choose option

How can I fix this?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Phuc Nguyen
  • 105
  • 1
  • 5

2 Answers2

18

-- Update June 2020 --

Sceneform 1.15 has been replaced by the open source Sceneform 1.16. This appears to have also changed the model build approach, no longer using the SceneForm plugin and .sfa/.sfb workflow and instead including direct support for .gltf format model.

More information is available on the GitHub page, although the respoitory has now been archived which makes it hard to understand the future direction for Sceneform at this time (June 2020):

enter image description here

(https://github.com/google-ar/sceneform-android-sdk)

-- Workaround to the original problem if you are using Sceneform 1.15 --

To workaround the issue is you are using the Sceneform Plugin - see below:

This appears to be an issue with Android Studio 3.6 at the time of writing - see the issue here:

One workaround appears to be to revert to Android Studio 3.5.

Alternatively adding the asset manually appears to work - taking the example in the online documentation for ARCore (https://developers.google.com/ar/develop/java/sceneform):

Follow these steps to import a new 3D asset:

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

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

  1. Now instead of right clicking and using import, as the instructions at the link above go on to say, add the following lines to the bottom of your build.gradle(app) file manually:
apply plugin: 'com.google.ar.sceneform.plugin'

sceneform.asset('sampledata/andy.obj', // 'Source Asset Path' specified during import.
        'default',                    // 'Material Path' specified during import.
        'sampledata/andy.sfa', // '.sfa Output Path' specified during import.
        'src/main/res/raw/andy')      // '.sfb Output Path' specified during import.
  1. Rebuild your project and the renderable should be imported correctly - check that andy.sfb has appeared in the 'res/raw' folder to be sure.
Mick
  • 24,231
  • 1
  • 54
  • 120
  • @Nourman - I just checked it again on a new project and it worked for me. Maybe check the paths match the paths in your project, i.e. the "sampledata/andy.obj" and that you have the andy.obj, andy.mtl and andy.png file in that directory – Mick Apr 04 '20 at 12:59
  • 1
    Doesn't work for me. It just says "Failed to import 'sampledata/models/chroma_key_video.obj'" – Harsha Apr 20 '20 at 20:11
0

@harsha make sure the .obj file is referring to the right material.

mtllib chroma_key_video.mtl
g default
v -0.000000 2.244259 0.431967
v ...
yola.
  • 1
  • 2