Gradle build failed with new import rules

邮差的信 提交于 2020-03-16 05:53:07

问题


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;)

How can I fix this?


回答1:


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

  • https://github.com/google-ar/sceneform-android-sdk/issues/912

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/models/andy.obj', // 'Source Asset Path' specified during import.
        'default',                    // 'Material Path' specified during import.
        'sampledata/models/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.


来源:https://stackoverflow.com/questions/60468709/gradle-build-failed-with-new-import-rules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!