gunschu / jitsi_meet

Initial commit
208 stars 282 forks source link

Error: No signature of method: build_9le4dq801rzqeyi0flt458p09.android() is applicable for argument types: #435

Closed ziagit closed 1 year ago

ziagit commented 1 year ago

In Flutter 3, Android I'm trying to integrate Jitsi using jitsi_meet_v1: ^5.0.0 package. The problem I face; when I add proguard rules in app/build.gradle I get bellow error

+1 ms] FAILURE: Build failed with an exception.
[   +1 ms] * Where:
[        ] Build file '/home/amu/Desktop/projects/apps/jitsi/android/app/build.gradle' line: 28
[        ] * What went wrong:
[        ] A problem occurred evaluating project ':app'.
[        ] > No signature of method: build_9le4dq801rzqeyi0flt458p09.android() is applicable for argument types: (build_9le4dq801rzqeyi0flt458p09$_run_closure2) values:
[build_9le4dq801rzqeyi0flt458p09$_run_closure2@f3f8288]
[        ] * Try:
[        ] > Run with --debug option to get more log output.
[        ] > Run with --scan to get full insights.
[        ] * Exception is:
[        ] org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
[        ]      at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)

If I remove the below lines from app/build.gradle project run successfully but when I click join the room gets closes immediately back (cannot join).

minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

this is app/build.graddle file

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

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

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

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

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.jitsi"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion 23
        targetSdkVersion 30
        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

           //these 3 line cause the error
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.pro'
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

In the same app/build.gradle directory I created a file named proguard-rules.pro with following content

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }

I followed everything in the package documentation link

any solution please.

iamnabink commented 1 year ago

@ziagit , Brother try removing or commenting useProguard true from your app/build.gradle file

buildTypes {
        release {
            minifyEnabled true
            //useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.