ksoap2库到android studio的错误消息,如何修复?

sz81bmfz  于 2021-06-29  发布在  Java
关注(0)|答案(1)|浏览(722)

我尝试在androidstudio中使用.jar文件版本3.6.4导入ksoap2库。我已经成功地将jar文件实现到androidstudio。但是,在我尝试导入的模块应用程序活动中,例如导入“org.ksoap2.soapenvelope;”,它获取错误并显示以下结果:
任务“”的执行失败:app:checkdebugaarmetadata'.
无法解析配置“”的所有文件:app:debugruntimeclasspath'. 找不到com.google.code.ksoap2-android:ksoap2-android:3.6.4. 搜索地点如下:https://repo.maven.apache.org/maven2/com/google/code/ksoap2-android/ksoap2-android/3.6.4/ksoap2-android-3.6.4.pom - https://dl.google.com/dl/android/maven2/com/google/code/ksoap2-android/ksoap2-android/3.6.4/ksoap2-android-3.6.4.pom - https://jcenter.bintray.com/com/google/code/ksoap2-android/ksoap2-android/3.6.4/ksoap2-android-3.6.4.pom 要求:项目:app
可能的解决方案:
声明提供工件的存储库,请参阅https://docs.gradle.org/current/userguide/declaring_repositories.html
另外导入库有错误,请看图片:

以下是build.gradle模块代码:

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

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

task clean(type: Delete) {
   delete rootProject.buildDir
}

以下是build.gradle(应用程序)模块代码:

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.kowloondairycompanykdl.milk_ic"
        minSdkVersion 27
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation files('libs\\ksoap2-android-assembly-3.6.4.jar')
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.4'

}

请帮帮我,我被困在这里很久了。如何修复错误以及如何正确实现ksoap2库。谢谢

xyhw6mcr

xyhw6mcr1#

该库似乎没有3.4.3版本。有一个3.4.0。最新版本是3.6.4。你需要用其中一个。我会转到3.6.4,因为3.4.0已经超过5年了,而且可能缺少安全更新。

相关问题