0

I got the exception

'Program type already present: jpos.JposException '

when trying to rebuild the app, the problem appeared after I added the bixolon_printer_v127.jar,icu4j-58_1.jar,jpos117-controls.jar and xerces.jar, and it was running perfectly before that,

can anyone help ?

build.gradle(Module)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27

    defaultConfig {
        applicationId "com.andalus.mobilesales"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

configurations.all {
    resolutionStrategy.dependencySubstitution {
        substitute module('org.apache.commons:commons-io:1.3.2') with module('commons-io:commons-io:1.3.2')
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation files('libs/ksoap2-android-assembly-3.2.0-jar-with-dependencies.jar')
    implementation files('libs/Sewoo_Android_1076B.jar')
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.octo.android.robospice:robospice:1.4.12'
    implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
    testImplementation 'junit:junit:4.12'
    implementation files('libs/bixolon_printer_v127.jar')
    implementation files('libs/icu4j-58_1.jar')
    implementation files('libs/jpos117-controls.jar')
    implementation files('libs/xerces.jar')
}

build.gradle (project:app)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Andrés Alcarraz
  • 1,570
  • 1
  • 12
  • 21

1 Answers1

1

It's giving error because JposException class is present in tow or more than that. In your Gradle file exclude your jpos.JposException class from implementation in your module level gradle file as follows:

implementation (files('libs/jpos117-controls.jar')){
    exclude group: 'jpos.JposException'
 }

I hope its work for you

Saurabh Bhandari
  • 2,438
  • 4
  • 26
  • 33