Sceneform does not seem to work in feature modules with plugin com.android.feature.
Throws an error Sceneform may only be applied to Android projects. It would be great if feature modules support is added. The goal is to build AR experience as a dynamic feature, which can be loaded on demand as not all devices support ARCore. Thank you!
@volhakaleda - We are working on enabling the Sceneform gradle plugin for non-Android projects. This will be available in an upcoming release.
At the moment, since the Sceneform plugin requires an Android App project, the best workaround is to create a simple Android project (e.g. you could use any template in Android Studio), and import your assets into that project. When you build that project, SFBs will be generated where you placed them during import. Copy these SFBs into your feature module project placing them in assets or res/raw as you desire. These SFBs will now be loadable by Sceneform just as if they were imported in this project.
I will leave this issue open until we release the Gradle plugin that supports all Gradle projects.
@tpsiaki thanks for the recommendation, Tim!
I've tried to put resources within both raw and assets folder in my project, but the Sceneform SDK have troubles accessing it.
I'm receiving FileNotFoundException for all the resources:
java.util.concurrent.CompletionException: java.io.FileNotFoundException: No package found for authority: android.resource://com.aita.arprofile/raw/sceneform_default_light_probes
at com.google.ar.sceneform.rendering.LightProbe.lambda$loadInBackground$1(LightProbe.java:208)
The path it's using is fine' I've checked with the following code:
public static Uri resourceToUri(Context context, int resID) {
return Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" +
context.getResources().getResourcePackageName(resID) + '/' +
context.getResources().getResourceTypeName(resID) + '/' +
context.getResources().getResourceEntryName(resID) );
}
If you'd be able to share what exactly does your plugin do with the project what would be a great help.
After further investigation, I discovered that I can't get access to raw resources at all when I apply 'com.android.dynamic-feature' plugin to my AR project and using LoadHelper.resourceToUri() method.
ARdynamicfeature.zip
Here is the project that reproduces the issues.
Just open CameraTestActivity and you'll what I am talking about. When I use com.google.ar.sceneform.ux.ArFragment it would fail to load due to the following errors: https://pastebin.com/JjXd5wdA.
Loading texture another way in my project is not an issue. The way it is harcoded within Sceneform SDK is the real issue that is blocking the usage of ARFragment
The Sceneform plugin is now compatible with any gradle project.
Most helpful comment
If you'd be able to share what exactly does your plugin do with the project what would be a great help.
After further investigation, I discovered that I can't get access to raw resources at all when I apply 'com.android.dynamic-feature' plugin to my AR project and using LoadHelper.resourceToUri() method.