android - 使用 jitpack 构建的库中的错误:无法解析 ':app@debug/compileClasspath' 的依赖关系
问题描述
我正在尝试在 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 并发布了我的库。但是当我尝试将这个库添加到我的新测试项目中时,我遇到了错误(列在这篇文章的顶部)。我做错了什么?
UPD
我还尝试classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
在此文档中添加类似内容:https ://jitpack.io/docs/ANDROID/
但结果保持不变。
更新 2
解决方案
推荐阅读
- javascript - 如何使用 React 和 TypeScript 创建可重用的 Input 组件?
- node.js - 我有一个用 Html、CSS (Bootstrap)、Nodejs、Express.js 编码的网站,我想在网站上托管它,我该怎么做?
- reactjs - nextjs:当前页面也加载其他页面chunk
- python - 我无法从气流中导入气流.operators.print_text_old
- angular - Angular 国际化服务于开发模式
- c - 项目无缘无故莫名滞后
- java - 无法访问 keycloak - quarkus 受保护的资源
- java - 使用 Super CSV 时将 CSV 列映射到 POJO 类
- wpf - 如何在图表上显示最大点值?
- swift - 如何在没有初始化程序的情况下使用 TopLevel 对象?