join us on Discord for support, updates, and all things Snap AR! See you there!
Plugin introduces errors
Hi
I encountered a problem when integrating Android CameraKit,
"Failure(message=Host application unexpectedly includes [com.snap.camerakit.Session class which must be loaded from the Plugin package: com.snap.camerakit.plugin.v1)" ,
may I ask which step of com.snap.camerakit.plugin.v1 caused the error?
Answers
-
/**
private void initFunMode(){
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.execute(new Runnable() {
@Override
public void run() {
Plugin.Loader loader = Plugin.Loader.from(getApplicationContext(),"com.snap.camerakit.plugin.v1");
Plugin.Loader.Result result = loader.load();
if (result instanceof Plugin.Loader.Result.Success){
mCameraKitFeature = ((Plugin.Loader.Result.Success)result).getPlugin();
runOnUiThread(new Runnable() {
@Override
public void run() {
mCameraKitSession = mCameraKitFeature.newSessionBuilder()
.attachTo(viewStub,false)
.configureLenses(builder -> {
builder.dispatchTouchEventsTo(viewStub);
builder.configureLoadingOverlay(configuration -> configuration.setEnabled(false));
builder.configureProcessor(configuration -> {
configuration.setUseDeviceOrientationForFaceDetection(true);
configuration.setInputFrameRotationBehavior(LensesComponent.Processor.InputFrameRotationBehavior.ASSUME_PORTRAIT_ORIENTATION);
});
builder.configureHints(configuration -> {
configuration.setEnabled(true);
configuration.setView(model -> {
if (model instanceof LensesComponent.Hints.View.Model.Displayed){
//
}
});
});
}).handleErrorsWith(new Consumer() {
@Override
public void accept(Throwable throwable) {} }).build(); preLoadLens(); } }); }else { Log.i("fail","FAILED, reason is : "+result.toString()); } } }); }
*/
0 -
@luo su Thanks for raising the concern. I'd highly recommend you to use the SDK from maven instead of relying on com.snap.camerakit.plugin.v1 as a dynamic module. Here is the sample app code which shows how to do that: https://github.com/Snapchat/camera-kit-reference/tree/main/samples/android/camerakit-sample-dynamic
0 -
@Ankit Baphna said:
@luo su Thanks for raising the concern. I'd highly recommend you to use the SDK from maven instead of relying on com.snap.camerakit.plugin.v1 as a dynamic module. Here is the sample app code which shows how to do that: https://github.com/Snapchat/camera-kit-reference/tree/main/samples/android/camerakit-sample-dynamichello,
I need to use 1.15.2 aar for integration, I cannot use the latest SDK for integration. Can you please help analyze the specific reasons?
Thanks.1 -
@luo su can you please explain your use case and why you have to use only a particular version? Also, please note that com.snap.camerakit.plugin.v1 comes from Google Play Store and it will be updated periodically. There is no way to guarantee that version on mobile.
1