Как исправить ошибку «NoClassDefFoundError: com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl» при использовании библиотеки javax.xml.soap - PullRequest
0 голосов
/ 03 июля 2019

Я работаю над приложением для Android, которое использует SOAP для отправки запросов в веб-службу. Код работает нормально при тестировании с использованием junit, однако при развертывании приложения на любом устройстве выдает ошибку java.lang.NoClassDefFoundError: com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl

Я попытался добавить эту зависимость в файл build.grade для приложения implementation 'com.sun.xml.messaging.saaj:saaj-impl:1.4.0', которое не решает проблему.


repositories {
    maven { url 'https://mvnrepository.com/artifact/javax.xml.soap/saaj-api' }
    maven { url 'https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple' }
    maven { url 'https://mvnrepository.com/artifact/com.sun.xml.messaging.saaj/saaj-impl' }
}

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.jkuber.gov.jkuberpayeeportal"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    implementation 'javax.xml.soap:saaj-api:1.3.5'
    implementation 'com.googlecode.json-simple:json-simple:1.1.1'
    implementation 'androidx.room:room-runtime:2.1.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.sun.xml.messaging.saaj:saaj-impl:1.4.0'
    implementation ('junit:junit:4.12'){
        exclude group: 'org.hamcrest', module:'hamcrest-core'
    }
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...