【问题标题】:Ksoap2 Library to android studio Error message, how to fix?Ksoap2 库到 android studio 错误消息,如何修复?
【发布时间】:2020-12-28 03:43:24
【问题描述】:

我尝试使用 .jar 文件版本 3.6.4 在 android studio 中导入 Ksoap2 库。我已经成功地将jar文件实现到android studio。但是,在我尝试导入时的模块应用程序活动中,例如导入“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 要求: 项目:应用程序

可能的解决方案:

导入库也有错误,请看图片:

这是 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(app) 模块代码:

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 库。谢谢

【问题讨论】:

标签: java android web-services android-ksoap2


【解决方案1】:

该库似乎没有 3.4.3 版本。有一个 3.4.0。最新的是3.6.4。您将需要使用其中之一。我会迁移到 3.6.4,因为 3.4.0 已经超过 5 年了,并且可能缺少安全更新。

【讨论】:

  • 抱歉有错别字,应该是 3.6.4。我修好了,还是有错误。请帮帮我
  • 我怎么不能导入 KSoap2 ???我被卡住了,我正在寻找很多解决方案,但我似乎找不到,请任何人帮忙??
【解决方案2】:

从 setting.gradle 文件中删除 dependencyResolutionManagement 块,让您的项目以旧方式工作。

相关问题:Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-25
    • 2017-02-21
    • 2022-01-22
    • 2017-07-29
    • 2020-07-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多