Ksoap2 Library to android studio 错误消息,如何解决?
Ksoap2 Library to android studio Error message, how to fix?
我尝试使用 .jar 文件版本 3.6.4 在 android studio 中导入 Ksoap2 库。我已经成功地将 jar 文件实现到 android studio。但是,当我尝试导入模块 app activity 时,例如导入“org.ksoap2.SoapEnvelope;”,它得到错误并显示以下结果:
任务“:app:checkDebugAarMetadata”执行失败。
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.google.code.ksoap2-android:ksoap2-android:3.6.4.
Searched in the following locations:
- 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
Required by:
project :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(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 库。谢谢
该库似乎没有 3.4.3 版本。有一个 3.4.0。最新的是 3.6.4。您将需要使用其中一个。我会转到 3.6.4,因为 3.4.0 已经超过 5 年了,并且可能缺少安全更新。
从 setting.gradle 文件中删除 dependencyResolutionManagement 块,让您的项目以旧方式工作。
相关问题:
我尝试使用 .jar 文件版本 3.6.4 在 android studio 中导入 Ksoap2 库。我已经成功地将 jar 文件实现到 android studio。但是,当我尝试导入模块 app activity 时,例如导入“org.ksoap2.SoapEnvelope;”,它得到错误并显示以下结果:
任务“:app:checkDebugAarMetadata”执行失败。
Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find com.google.code.ksoap2-android:ksoap2-android:3.6.4. Searched in the following locations: - 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 Required by: project :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(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 库。谢谢
该库似乎没有 3.4.3 版本。有一个 3.4.0。最新的是 3.6.4。您将需要使用其中一个。我会转到 3.6.4,因为 3.4.0 已经超过 5 年了,并且可能缺少安全更新。
从 setting.gradle 文件中删除 dependencyResolutionManagement 块,让您的项目以旧方式工作。
相关问题: