Support Topics Documentation Slack YouTube Blog

Trying to make jar but got an error

Im trying to make a JAR for backendless service by using Android Studio. I’m using Android Studio and this topic which I am following https://stackoverflow.com/questions/21712714/how-to-make-a-jar-out-from-an-android-studio-project

When I generate JAR while backendless library included I got a failure. Error message below

                FAILURE: Build failed with an exception.
    
                    * What went wrong:
            Execution failed for task ':app:lint'.
                    > Lint found errors in the project; aborting build.
    
            Fix the issues identified by lint, or add the following to your build script to proceed with errors:
      ...
            android {
                lintOptions {
                    abortOnError false
                }
            }
      ...
    
            Errors found:
    
            C:\Users\Public\.gradle\caches\modules-2\files-2.1\com.backendless\backendless\5.7.1\6edaf9b7b4a7228b1924efde6e9f804cdd14b6c9\backendless-5.7.1.jar: Error: Invalid package reference in com.backendless:backendless; not included in Android: javax.jms. Referenced from weborb.messaging.v3.Subscriber. [InvalidPackage]
            C:\Users\Public\.gradle\caches\modules-2\files-2.1\com.backendless\backendless\5.7.1\6edaf9b7b4a7228b1924efde6e9f804cdd14b6c9\backendless-5.7.1.jar: Error: Invalid package reference in com.backendless:backendless; not included in Android: javax.servlet.http. Referenced from weborb.messaging.v3.StreamingSubscriber. [InvalidPackage]
            C:\Users\Public\.gradle\caches\modules-2\files-2.1\com.backendless\backendless\5.7.1\6edaf9b7b4a7228b1924efde6e9f804cdd14b6c9\backendless-5.7.1.jar: Error: Invalid package reference in com.backendless:backendless; not included in Android: javax.servlet. Referenced from weborb.messaging.v3.StreamingSubscriber. [InvalidPackage]

But when I follow the hint from error and include abortOnError false and skip the error. I don’t have any jar file in LIB folder

That’s my Gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.rwapp.apiservice"
        minSdkVersion 17
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.backendless:backendless:5.7.1'

//    implementation group: 'com.backendless', name: 'backendless', version: '5.0.+'

}

task deleteJar(type: Delete) {
    delete 'libs/jars/logmanagementlib.jar'
}

task createJar(type: Copy) {
    from('build/intermediates/bundles/release/')
    into('libs/jars/')
    include('classes.jar')
    rename('classes.jar', 'logmanagementlib.jar')
}

createJar.dependsOn(deleteJar, build)

To close this topic, the resolution was that the Backendless SDK was imported twice with two different versions which conflicted with each other.