I'm stuck with Integrating and configuring the Zoom Android SDK into my flutter project

45 Views Asked by At

I've been trying to integrate Android Zoom SDK into my flutter project. In overall I want to embed their Zoom SDK into my flutter project.

I know there's a Zoom SDK for flutter and I could've used it. But some features are not available there since it is still in development. So I thought of implementing Native SDKs into my project.

This is the issue I keep running into:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :zoom_module.
     Required by:
         project :app
      > No matching configuration of project :zoom_module was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.3.0', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.

* 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 6s
Error: Gradle task assembleDebug failed with exit code 1

I want to use this SDK in my the native code of my flutter project.

I have downloaded the zoom SDK and successfully ran it in Android Studio. This included generating token and secret and public keys

I've set up the platform channels and they seem to be working fine.

Then I copied the whole SDK and tried to add it as a separate module. That's where I keep running into the abovementioned issue.

There's no clear tutorials or documentation on how to do this.

I've tried couple of fixed I've found here. But they were too generic

This is the build.gradle file inside android/app directory of my flutter project:

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

android {
    namespace "com.example.zoom_integration"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.zoom_integration"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }


    dependencies {
        implementation project (':zoom_module')
    }

    
}



flutter {
    source '../..'
}

And this is the settings.gradle file inside my android directory of my flutter project:

pluginManagement {
    def flutterSdkPath = {
        def properties = new Properties()
        file("local.properties").withInputStream { properties.load(it) }
        def flutterSdkPath = properties.getProperty("flutter.sdk")
        assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
        return flutterSdkPath
    }
    settings.ext.flutterSdkPath = flutterSdkPath()

    includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }

    plugins {
        id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
    }
}

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
}


include ':app', ':zoom_module'


And this is the MainActivity.java file:

package com.example.zoom_integration;

import android.widget.Toast;

import androidx.annotation.NonNull;

import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;

public class MainActivity extends FlutterActivity {

    private final String channelName = "com.example.zoom_integration/zoom";

    @Override
    public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
        super.configureFlutterEngine(flutterEngine);



        MethodChannel channel = new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), channelName);


        channel.setMethodCallHandler(new MethodChannel.MethodCallHandler() {
            @Override
            public void onMethodCall(MethodCall call, MethodChannel.Result result) {


                // Your implementation from step 1 goes here
                if(call.method.equals("onClickJoinMeeting")) {
                    showToast("Api Devvvss");
                }


            }
        });


    }


    private void showToast(String message) {
        Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();
    }


    public void onMethodCall(MethodCall call, MethodChannel.Result result) {
        // Handle the method call based on `call.method` and `call.arguments`
        // You can use a switch statement or other logic to handle different methods
        // Send a response using `result.success(data)` or `result.error(code, message, details)`
    }
}

This is my folder Structure :

zoom_integration
 ┣ .dart_tool
 ┣ .idea
 ┣ android
 ┃ ┣ .gradle
 ┃ ┣ .idea
 ┃ ┣ app
 ┃ ┣ gradle
 ┃ ┣ zoom_module
 ┃ ┃ ┣ dynamic_sample
 ┃ ┃ ┣ example2
 ┃ ┃ ┣ feature_mobilertc
 ┃ ┃ ┣ gradle
 ┃ ┃ ┣ mobilertc
 ┃ ┃ ┣ sample
 ┃ ┃ ┣ build.gradle
 ┃ ┃ ┣ gradle.properties
 ┃ ┃ ┣ gradlew
 ┃ ┃ ┣ gradlew.bat
 ┃ ┃ ┣ lock_dependency.md
 ┃ ┃ ┗ settings.gradle
 ┃ ┣ .gitignore
 ┃ ┣ build.gradle
 ┃ ┣ gradle.properties
 ┃ ┣ gradlew
 ┃ ┣ gradlew.bat
 ┃ ┣ local.properties
 ┃ ┣ settings.gradle
 ┃ ┗ zoom_integration_android.iml
 ┣ build
 ┣ ios
 ┣ lib
 ┃ ┗ main.dart
 ┣ linux
 ┣ macos
 ┣ test
 ┣ web
 ┣ windows
 ┣ .metadata
 ┣ analysis_options.yaml
 ┣ pubspec.lock
 ┣ pubspec.yaml
 ┣ README.md
 ┗ zoom_integration.iml
0

There are 0 best solutions below