-4

masters. I've just started developing an Android(kotlin). I tried to use open source for my project, but there is an error. What am I supposed to do here? (I referred to "https://androidexample365.com/customizable-timetableview-for-android/")

my project's gradle(module)-----------------------------------------------------------------------

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"
}

my project's gradle(Project)----------------------------------------------------------------------

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
}

my project's 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>

error message-------------------------------------------------------------------------------------

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`

I did not touch any of the above settings. I just want to use this off-source for my project. I'd like to solve this problem.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
준형임
  • 31
  • 4

1 Answers1

0

See the reference on jitpack's page. Use the latest version, or any other version that is fit for your purpose.

When you declare a remote dependency in your module-level Gradle file (written in Groovy or Kotlin), the format is generally like this:

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'

See the Android docs for more info.

Here, the module/project name may or may not be present, as it is typically optional for the creator of the library/module to generate or use. Thus, in the case of the Mintable project, to use the newest version, you would use:

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

Hope this information is also helpful in the future. All the best!

SarangD
  • 198
  • 1
  • 9