Importing sceneform asset does not generate .sfa and .sfb files
Asked Answered
C

3

7

When i'm trying to import sceneform assets and press finish on the window that pops up,nothing happens.No .sfa, .sfb files are generated.Nothing is generated in the build.gradle file also.I have to mention that i imported sceneform assets in the same project before and everything worked fine,but now (after a while) when i'm trying to do it again it doesn't work.

Chard answered 1/6, 2020 at 0:55 Comment(3)
You need to mention more details. Which Sceneform version are you running?Flotation
In settings,in the plugin section : Google Sceneform Tools (Beta) 1.15.0. In build.gradle (Project) i have "classpath 'com.google.ar.sceneform:plugin:1.17.0" .In build.gradle(Module:app) i have " implementation 'com.google.ar:core:1.17.0' " " implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.17.0'" "implementation 'com.google.ar.sceneform:core:1.17.0'". I think they updated to 1.17.0 after i got a popup message to upgrade the gradle files.I tried to change them to 1.15.0 but it still doesn't work.Chard
I also tried uninstalling and reinstalling the plugin, but it doesn't work.Chard
L
7

From https://developers.google.com/sceneform/develop/

enter image description here

Considering 1.15 and 1.17.1 identical, and these issues

It looks like it's no longer in development and they are not going to fix it. It is problem with android studio version 3.6 and later.


There is no solution, either you can rollback to Android studio 3.5, or you can use a quick workaround.

  1. Create a new sampledata directory in your application.

    Right-click on top app level directory > New > Sample Data Directory

  2. place your 3D assets and its dependencies (obj, mtl, fbx, png) into sampledata directory.

  3. Add classpath 'com.google.ar.sceneform:plugin:1.15.0' to your project level gradle. make sure you have google() in repositories.

    // Top-level build file where you can add configuration options. common to all sub-projects/modules
    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
             classpath "com.android.tools.build:gradle:4.0.1"
             classpath 'com.google.ar.sceneform:plugin:1.15.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
         }
    }
    
  4. sceneform requires a specific version of NDK and Java. And you need to apply plugin and dependencies since it will not be automatically added in recent versions of the android studio. apply plugin: 'com.android.application' apply plugin: 'com.google.ar.sceneform.plugin'

     android {
         ...
    
         defaultConfig {
             ...
    
             ndk {
                 /*
                 * Sceneform is available for the following ABIs: arm64-v8a, armv7a,
                 * x86_64 and x86. This sample app enables arm64-v8a to run on
                 * devices and x86 to run on the emulator. Your application should
                 * list the ABIs most appropriate to minimize APK size (arm64-v8a recommended).
                 */
                 abiFilters 'arm64-v8a', 'x86'
             }
             compileOptions {
                 sourceCompatibility JavaVersion.VERSION_1_8
                 targetCompatibility JavaVersion.VERSION_1_8
             }
         }
    
         buildTypes {
             ...
         }
     }
    
     dependencies {
         ...
         implementation 'com.google.ar.sceneform:core:1.15.0'
     }
    
     < sceneform.asset code - 7th step >
    
  5. I have added Mars 3D asset from Poly to my sampledata. Directory structure will look something like enter image description here

  6. Add raw data directory to resources.
    Right-click on res > New > folder > Raw resources folder.

  7. Add this to the end of app-level gradle file.

     sceneform.asset('sampledata/mars.obj', // 'Source Asset Path' specified during import.
         'default',                         // 'Material Path' specified during import.
         'sampledata/mars.sfa',             // '.sfa Output Path' specified during import.
         'src/main/res/raw/mars')
    
  8. Sync files and it should work now.

Sceneform has Deprecates support for SFB & the SFB Sceneform Android Studio plugin (glTF can be used instead) - Release Notes

The documentation is available for sceneform 1.15.0 only -- which does not include glTF workflow. You can check out this demo for working with glTF.

Lovato answered 27/9, 2020 at 7:37 Comment(3)
I'm using macOS Big Sur with AndroidStudio 4.1.2 . I followed your steps without any errors, but it didn't work. Nothing generated! can you help, please?Ophthalmic
@SinaKhorshidian Idk it's supposed to work. My AndroidStudio version is 4.0.1, not a major difference so that should not be an issue; however, I am using windows and tested on a physical device. I've uploaded the repo on GitHub. Clone and check if it could help. github.com/AniketKariya/sceneform-testLovato
I misunderstood your answer. I had to rebuild the project after sync files.Ophthalmic
R
1

I had the same problem, I noticed that you can do this without the plug-in by adding your model with sceneform.asset(...) in build.gradle and building the project, related .sfa and .sfb files are then created.

Rubellite answered 3/8, 2020 at 8:48 Comment(0)
J
0

Sceneform 1.16 and 1.17 only supports gltf:

As part of the 1.16.0 release, support for SFA and SFB assets was removed in favor of adding glTF support

There is also a bug in Android Studio 3.6 and Sceneform Tools which makes Android Studio to crash (downgrading AS to 3.5 will help). If you want to use .fbx, you should downgrade to Sceneform 1.15 or you can use Sceneform 1.17 and gltf format

Joannjoanna answered 2/6, 2020 at 8:51 Comment(6)
v1.17 doesn't exist for SceneForm. Right? There's no mention of anything v1.17 hereFlotation
it does exist actually: mvnrepository.com/artifact/com.google.ar.sceneform/core/1.17.0Joannjoanna
The thing is that my object is .gltf format,and it still does not convert itChard
.glb/.gltf format files can be augmented directly. .sfb/.sfa way is deprecated now.Flotation
Note that the official recommendation from Google's Sceneform developer documentation is: "Do not use version 1.17.0 of the com.google.ar.sceneform.* Maven artifacts." - developers.google.com/sceneform/developCubbyhole
Also, it appears Sceneform is no longer in development (since the github repository has been archived) and has been replaced by Filament: github.com/google/filamentCubbyhole

© 2022 - 2024 — McMap. All rights reserved.