Heads up! We're sunsetting this forum to streamline our community space.

join us on Discord for support, updates, and all things Snap AR! See you there!
Sign up for our live Camera Kit office hour on July 17 @ 9:30am (PT) / 4:30pm (GMT)

Plugin introduces errors

luo su
luo su Posts: 3

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

  • luo su
    luo su Posts: 3
    edited March 18 #2

    /**
    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());
                }
            }
        });
    }
    

    */

  • Ankit Baphna
    Ankit Baphna Posts: 12 👻

    @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

  • luo su
    luo su Posts: 3

    @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-dynamic

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

  • Ankit Baphna
    Ankit Baphna Posts: 12 👻

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

Categories