vavadiyahiren / xmpp_plugin

XMPP Plugin is developed with help of native channel and exposing sevral features of xmpp using the native libs like smack and xmppframework
Apache License 2.0
41 stars 26 forks source link

I can't use last version of permission_handler #109

Open mehmetgencdal opened 9 months ago

mehmetgencdal commented 9 months ago

Hi again @vavadiyahiren @dr7866 ,

Situation 1: When i delete proguard rules the problem doesn't occurs but the app doesn't work for release version. Situation 2: When i use flutter_plugin 2.2.3 and permission_handler 9.2.0 the release version works but 9.2.0 version is not useful.

When it is debug mode everthing is fine but i can't get release verison. I have tried many solutions but none of them work.

Problem: When i use permission_handler above version 9.2.0 with flutter_plugin i have error given below:

of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/Mehmet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.8.22/636bf8b320e7627482771bbac9ed7246773c02bd/kotlin-stdlib-1.8.22.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/Mehmet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.8.22/636bf8b320e7627482771bbac9ed7246773c02bd/kotlin-stdlib-1.8.22.jar!/META-INF/kotlin-stdlib.kotlin_module: Module 
was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/Mehmet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.8.22/636bf8b320e7627482771bbac9ed7246773c02bd/kotlin-stdlib-1.8.22.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/Mehmet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.8.22/1a8e3601703ae14bb58757ea6b2d8e8e5935a586/kotlin-stdlib-common-1.8.22.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
ERROR:C:\Users\Mehmet\.gradle\caches\transforms-3\ce540d9ec80933075f329cb7f379f5b3\transformed\jetified-bcprov-jdk15on-1.65.jar: R8: Type org.bouncycastle.jcajce.provider.asymmetric.edec.KeyFactorySpi$Ed25519 is defined multiple times: C:\Users\Mehmet\.gradle\caches\transforms-3\ce540d9ec80933075f329cb7f379f5b3\transformed\jetified-bcprov-jdk15on-1.65.jar:META-INF/versions/11/org/bouncycastle/jcajce/provider/asymmetric/edec/KeyFactorySpi$Ed25519.class, C:\Users\Mehmet\.gradle\caches\transforms-3\ce540d9ec80933075f329cb7f379f5b3\transformed\jetified-bcprov-jdk15on-1.65.jar:org/bouncycastle/jcajce/provider/asymmetric/edec/KeyFactorySpi$Ed25519.class

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:minifyReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete, origin: C:\Users\Mehmet\.gradle\caches\transforms-3\ce540d9ec80933075f329cb7f379f5b3\transformed\jetified-bcprov-jdk15on-1.65.jar:META-INF/versions/11/org/bouncycastle/jcajce/provider/asymmetric/edec/KeyFactorySpi$Ed25519.class

> 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

BU�LD FAILED in 1m 55s
Running Gradle task 'assembleRelease'...                          116,1s

┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin.                            │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update │
│ C:\Users\Mehmet\StudioProjects\tedis-2\android\build.gradle:                                      │
│ ext.kotlin_version = '<latest-version>'                                                           │
└───────────────────────────────────────────────────────────────────────────────────────────────────┘

android/build.gradle file:

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        // START: FlutterFire Configuration
        classpath 'com.google.gms:google-services:4.3.10'
        // END: FlutterFire Configuration
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

android/app/build.gradle file:

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.tedis"
    compileSdkVersion flutter.compileSdkVersion
    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.tedis"
        // 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
        multiDexEnabled true
    }

    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
            proguardFiles getDefaultProguardFile("proguard-android.txt"),
                    "proguard-rules.pro"
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation 'androidx.multidex:multidex:2.0.1'
}

proguard files:

-keep class org.jivesoftware.** { *; }
-keep class org.xmlpull.** { *; }
-keep class org.bouncycastle.jcajce.provider.** { *; }
-keep class org.xrstudio.** { *; }
mehmetgencdal commented 9 months ago

@fadihere

fadihere commented 9 months ago

@fadihere

I believe that this issue occurs because of android gradle sync. Follow these steps and let me know if it works for you.

  1. set latest kotlin version
  2. flutter clean
  3. open android folder in Android Studio
  4. click on the gradle sync
  5. go back to project dictionary and flutter run
mehmetgencdal commented 9 months ago

@fadihere

I believe that this issue occurs because of android gradle sync. Follow these steps and let me know if it works for you.

  1. set latest kotlin version
  2. flutter clean
  3. open android folder in Android Studio
  4. click on the gradle sync
  5. go back to project dictionary and flutter run

I tried it but many other problems occurred. For example: Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.

I'm trying to fix. Thanks for the answer.

danishrafiqe commented 9 months ago

@mehmetgencdal please just downgrade your Permission handler package version

mehmetgencdal commented 9 months ago

@mehmetgencdal please just downgrade your Permission handler package version

Unfortunately when i downgrade the version the permission handler doesn't work. It doesn't ask for any permission.

I tried to upgrade the gradle version but it always fails. Is there any way to create a project with the latest gradle version? Then i can move the codes? @dr7866 @fadihere