gpt4 book ai didi

android - 使用 jitpack 构建的库中的错误 : Unable to resolve dependency for ':app@debug/compileClasspath'

转载 作者:行者123 更新时间:2023-12-01 13:16:03 39 4
gpt4 key购买 nike

我正在尝试在 jitpack.io 上发布我的 android 库,但是当我尝试添加依赖项来测试我的工件时,我收到了这个错误:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details


Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details


Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details


Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details


Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details

下面列出了我在库项目中的 gradle 文件。

我的 build.gradle (应用程序):
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.github.pashaoleynik97.gsbarcodescannerhelperdemo"
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':gsbarcodescannerhelper')
}

我的 build.gradle (gsbarcodescannerhelper):
apply plugin: 'com.android.library'
group='com.github.pashaoleynik97;'

android {
compileSdkVersion 28



defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "0.1.1"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.10'
implementation(name: 'generalscan-sdk-1.0.6', ext:'aar')
}

最后,我的 build.gradle (项目):
buildscript {

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'

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

allprojects {
repositories {
google()
jcenter()
flatDir {
dirs project(':gsbarcodescannerhelper').file('libs')
}
maven { url 'https://jitpack.io' }
}
}

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

我在 github 上推送了我的项目,创建了版本(通过 github Web 界面),然后转到 jitpack.io 并发布了我的库。但是当我尝试将这个库添加到我的新测试项目中时,我遇到了错误(列在这篇文章的顶部)。我做错了什么?

更新

我还尝试添加 classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'就像在这个文档中一样: https://jitpack.io/docs/ANDROID/
但结果还是一样。

更新 2

创建问题: https://github.com/jitpack/jitpack.io/issues/3758

最佳答案

这似乎是持续几天的问题,可以找到here ,链接提到了解决方法 here .解决方法是添加 wwwjitpack.io .因此将其更新为以下内容:

maven { url 'https://www.jitpack.io' }

关于android - 使用 jitpack 构建的库中的错误 : Unable to resolve dependency for ':app@debug/compileClasspath' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54928706/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com