To use Tesseract4Android, how to update build.gradle.kts instead of build.gradle?

40 Views Asked by At

I am trying to use Tesseract4Android for my Android application, a library from: https://github.com/adaptech-cz/Tesseract4Android.

I encountered a problem when I tested it with Kotlin:

Failed to resolve: cz.adaptech.tesseract4android:tesseract4android:4.7.0

Here are my settings:

settings.gradle.kts:

pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
        maven {
            setUrl("https://jitpack.io")
        }
    }
}

build.gradle.kts:

dependencies { 
    // ...
    implementation("cz.adaptech.tesseract4android:tesseract4android:4.7.0")
}

Thanks in advance!

I've checked similiar questions but failed to find the reason. I've googled for this issue but failed to find the reason.

3

There are 3 best solutions below

1
Simon Jacobs On

You need to add the correct repository to the build.gradle.kts file. The ones in settings.gradle.kts pluginManagement are for the resolution of plugins.

repositories {
   maven { setUrl("https://jitpack.io") }
}
2
Lunch Basketball On

I found a solution like below. It works correctly.

releaseImplementation("com.github.adaptech-cz:Tesseract4Android:4.7.0")

0
Martin Zeitler On

Try another notation for property url:

import org.gradle.api.initialization.resolve.RepositoriesMode

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        mavenCentral()
        maven(url = 'https://jitpack.io')
    }
}

Then it should find:

implementation 'cz.adaptech/tesseract4android:4.7.0'