luis901101 / zsdk

BSD 3-Clause "New" or "Revised" License
8 stars 14 forks source link

FAILURE: Build failed with an exception. #15

Open vipthuocno opened 5 months ago

vipthuocno commented 5 months ago

What went wrong: Execution failed for task ':app:checkDevelopmentDebugDuplicateClasses'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class com.zebra.android.comm.BluetoothPrinterConnection found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.comm.TcpPrinterConnection found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.comm.ZebraPrinterConnection found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.comm.ZebraPrinterConnectionA found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.comm.ZebraPrinterConnectionException found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.comm.package-info found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.discovery.BluetoothDiscoverer found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.discovery.DiscoveredPrinter found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.discovery.DiscoveredPrinterBluetooth found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.discovery.DiscoveredPrinterNetwork found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.discovery.DiscoveryException found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.discovery.DiscoveryHandler found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.discovery.NetworkDiscoverer found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.discovery.package-info found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.FieldDescriptionData found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.FileUtil found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.FormatUtil found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.GraphicsUtil found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.MagCardReader found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.PrinterLanguage found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.PrinterStatus found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.PrinterStatus$1 found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.PrinterStatusMessages found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.SmartcardReader found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.ToolsUtil found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) Duplicate class com.zebra.android.printer.ZebraIllegalArgumentException found in modules jetified-ZSDK_ANDROID_API (ZSDK_ANDROID_API.jar) and jetified-zsdk_api (zsdk_api.jar) ...

can you give me the solution? Thanks

luis901101 commented 5 months ago

Let me see your build.gradle and gradle.properties, or download the example plugin project from github and build, then compare with your project

Muhammarizo commented 5 months ago

I have the same problem. Is any solution ?

luis901101 commented 5 months ago

I have the same problem. Is any solution ?

Without the logs I can not help you. If you are having the exact same issue as @vipthuocno then it seems a jettifier problem, please check the sample project in the plugin and compare with your project

Muhammarizo commented 5 months ago

I have the same problem. Is any solution ?

Without the logs I can not help you. If you are having the exact same issue as @vipthuocno then it seems a jettifier problem, please check the sample project in the plugin and compare with your project

my log is like this Launching lib/main.dart on Redmi Note 9 Pro in debug mode... Running Gradle task 'assembleDebug'... Building with Flutter multidex support enabled.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

2: Task failed with an exception.

BUILD FAILED in 16s Exception: Gradle task assembleDebug failed with exit code 1

luis901101 commented 5 months ago

Are you using gradle 8?, please as I recommend above, try the sample project and compare the android configuration with the ones you are using in your project.

shayant98 commented 2 months ago

Hi, I'm also facing this issue. I've upgraded to Gradle 8.3. But still keep getting this issue.

I can't really compare the android project since mine has been migrated of the implicit declaration. I've added the main build files below and they do seem to line up with the example, at least as far i can see

gradle.properties:

org.gradle.jvmargs=-Xmx4096m
android.useAndroidX=true
android.enableJetifier=true

build.gradle:

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
}
plugins {
    id "com.android.application"
    id "org.jetbrains.kotlin.android"
    id "dev.flutter.flutter-gradle-plugin"
    id "com.google.gms.google-services"
    id "com.google.firebase.crashlytics"
}

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 {
        if (project.android.hasProperty("namespace")) {
         namespace 'com.vshtech.wms'
    }

    // ----- BEGIN flavorDimensions (autogenerated by flutter_flavorizr) -----
    flavorDimensions "flavor-type"

    productFlavors {
        DEV {
            dimension "flavor-type"
            applicationId "com.vshtech.wms.uat"
            resValue "string", "app_name", "Warehousing UAT"

        }
        PROD {
            dimension "flavor-type"
            applicationId "com.vshtech.wms"
            resValue "string", "app_name", "Warehousing"

        }
    }

    // ----- END flavorDimensions (autogenerated by flutter_flavorizr) -----

        ndkVersion "25.1.8937393"
      packagingOptions {
       exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/*'
        exclude("META-INF/*.kotlin_module")
    }
              compileSdkVersion 34

    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.vshtech.wms"
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

   buildTypes {
    release {
        signingConfig signingConfigs.debug
    }
   }

}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.0"
    implementation platform('com.google.firebase:firebase-bom:30.2.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-crashlytics'

}

EDIT:

After further investigation, it seems to me that zsdk and artemis_zebra are conflicitng. We use artemis_zebra for printing on BT devices. How can we resolve this issue