【发布时间】: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 要求: 项目:应用程序
可能的解决方案:
- 声明提供工件的存储库,请参阅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(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 库。谢谢
【问题讨论】:
-
只是一个旁注使用
implementation而不是compile。
标签: java android web-services android-ksoap2