使用开放源码的问题(无法解决com~~)



大师。我刚刚开始开发Android(kotlin)。我试图在我的项目中使用开源,但出现了一个错误。我在这里该怎么办?(我指的是";https://androidexample365.com/customizable-timetableview-for-android/")

我的项目等级(模块)---------------------------------------------------------------------

plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.akj.callback"
minSdkVersion 23
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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'com.github.islandparadise14:Mintable:x.y.z'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "com.airbnb.android:lottie-compose:1.0.0-rc02-1"
}

我的项目等级---------------------------------------------------------------------

buildscript {
ext.kotlin_version = "1.5.21"
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
// Warning: this repository is going to shut down soon
maven { url uri("https://jitpack.io") }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

我的项目的xml--------------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".test_timetable">
<com.islandparadise14.mintable.MinTimeTableView
android:id="@+id/table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

错误消息---------------------------------------------------------------------------------------

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.github.islandparadise14:Mintable:x.y.z.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/islandparadise14/Mintable/x.y.z/Mintable-x.y.z.pom
- https://repo.maven.apache.org/maven2/com/github/islandparadise14/Mintable/x.y.z/Mintable-x.y.z.pom
- https://jcenter.bintray.com/com/github/islandparadise14/Mintable/x.y.z/Mintable-x.y.z.pom
- https://jitpack.io/com/github/islandparadise14/Mintable/x.y.z/Mintable-x.y.z.pom
Required by:
project :app
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html`enter code here`

我没有触摸任何上述设置。我只想在我的项目中使用这个非源代码。我想解决这个问题。

请参阅jitpack页面上的参考资料。使用最新版本,或适合您用途的任何其他版本。

当您在模块级Gradle文件(用Groovy或Kotlin编写)中声明remote dependency时,格式通常如下:

implementation '{package/group}:{module/project}:{versionNumber}'
// Example: 'com.example.android:app-magic:12.3'
// which is shorthand for:
implementation group: 'com.example.android', name: 'app-magic', version: '12.3'

有关更多信息,请参阅Android文档。

这里,模块/项目名称可能存在,也可能不存在,因为库/模块的创建者通常可以选择生成或使用它。因此,在Mintable项目的情况下,要使用最新版本,您将使用:

implementation 'com.github.islandparadise14:Mintable:1.5.1'  //in place of x.y.z

希望这些信息对将来也有帮助。祝你一切顺利!

最新更新