Unresolved reference: BanubaVideoEditor when i used banubaSdkVersion 1.31.0 and crashed for others

I think the problem in this line import com.banuba.sdk.core.license.BanubaVideoEditor in the MainActivity.kt
or it’s about banubaSdkVersion

When i used banubaSdkVersion 1.31.0 it gives me in the console this:

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

e: file:///E:/ahrar/android/app/src/main/kotlin/com/example/ahrar/MainActivity.kt:5:28 Unresolved reference: license
e: file:///E:/ahrar/android/app/src/main/kotlin/com/example/ahrar/MainActivity.kt:25:33 Unresolved reference: BanubaVideoEditor
e: file:///E:/ahrar/android/app/src/main/kotlin/com/example/ahrar/MainActivity.kt:39:38 Unresolved reference: BanubaVideoEditor

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1m 1s
Error: Gradle task assembleDebug failed with exit code 1

And When i use banubaSdkVersion 1.34.0 (the latest one):


Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.banuba.sdk:banuba_sdk:1.10.0.
     Searched in the following locations:
       - https://maven.pkg.github.com/Banuba/banuba-ve-sdk/com/banuba/sdk/banuba_sdk/1.10.0/banuba_sdk-1.10.0.pom
       - https://maven.pkg.github.com/Banuba/banuba-ar/com/banuba/sdk/banuba_sdk/1.10.0/banuba_sdk-1.10.0.pom
       - https://dl.google.com/dl/android/maven2/com/banuba/sdk/banuba_sdk/1.10.0/banuba_sdk-1.10.0.pom
       - https://repo.maven.apache.org/maven2/com/banuba/sdk/banuba_sdk/1.10.0/banuba_sdk-1.10.0.pom
       - https://storage.googleapis.com/download.flutter.io/com/banuba/sdk/banuba_sdk/1.10.0/banuba_sdk-1.10.0.pom
       - https://jcenter.bintray.com/com/banuba/sdk/banuba_sdk/1.10.0/banuba_sdk-1.10.0.pom
     Required by:
         project :app > com.banuba.sdk:effect-player-adapter:1.34.0

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 17s
Error: Gradle task assembleDebug failed with exit code 1

And when i use (1.33.2, 1.33.0, 1.33.1, 1.32.2) it’s running and then crashed

And this is MainActivity.kt:


import android.os.Bundle
import android.util.Log
import com.banuba.sdk.core.license.BanubaVideoEditor // here is the problem
import io.flutter.embedding.android.FlutterActivity
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugins.GeneratedPluginRegistrant


class MainActivity: FlutterActivity() {
    companion object {
        const val TAG = "FlutterVideoEditor"
        const val CONFIG_ENABLE_CUSTOM_AUDIO_BROWSER = false

        private const val METHOD_INIT_VIDEO_EDITOR = "InitBanubaVideoEditor"

//        private const val CHANNEL = "banubaSdkChannel"
        private const val CHANNEL = "CHANNEL"

        private const val ERR_SDK_NOT_INITIALIZED_CODE = "ERR_VIDEO_EDITOR_NOT_INITIALIZED"
        private const val ERR_SDK_NOT_INITIALIZED_MESSAGE = "Banuba Video Editor SDK is not initialized: license token is unknown or incorrect.\nPlease check your license token or contact Banuba"
    }

    private var videoEditorSDK: BanubaVideoEditor? = null
    private var videoEditorModule: VideoEditorModule? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        val appFlutterEngine = requireNotNull(flutterEngine)
        GeneratedPluginRegistrant.registerWith(appFlutterEngine)

        MethodChannel(
            appFlutterEngine.dartExecutor.binaryMessenger,
            CHANNEL
        ).setMethodCallHandler { call, result ->
            when (call.method) {
                METHOD_INIT_VIDEO_EDITOR -> {
                    val licenseToken = call.arguments as String
                    videoEditorSDK = BanubaVideoEditor.initialize(licenseToken)

                    if (videoEditorSDK == null) {
                        // Token you provided is not correct - empty or truncated
                        Log.e(TAG, ERR_SDK_NOT_INITIALIZED_MESSAGE)
                        result.error(ERR_SDK_NOT_INITIALIZED_CODE, ERR_SDK_NOT_INITIALIZED_MESSAGE, null)
                    } else {
                        if (videoEditorModule == null) {
                            // Initialize video editor sdk dependencies
                            videoEditorModule = VideoEditorModule().apply {
                                initialize(application)
                            }
                        }
                        result.success(null)
                    }
                }
                else -> result.notImplemented()
            }
            }
    }
}
1 Like

Hello, Ahmed, and welcome to our Community!

Thank you for providing the details.

The issue you are having is probably due to the fact that with the release of the VE SDK version 1.34.0 we have changed the process of integrating Face AR SDK into the Video Editor.
You can get more information on the changes and how to apply them, as well as the migration guide to the new version here.

Additionally, kindly, take a closer look at our Android Flutter sample and make sure you have copied all of our dependencies and repository into your project.
Most likely, you have not put in the Face AR SDK repository.

Thank you!