Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
341 views
in Technique[技术] by (71.8m points)

android studio - Gradle build failed with new import rules

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...