I add an image cropper in my application. But dispite using this guide, when I try to build the project, the following exception occurs:
10: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.theartofdev.edmodo:android-image-cropper:2.8.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/theartofdev/edmodo/android-image-cropper/2.8.0/android-image-cropper-2.8.0.pom
- https://repo.maven.apache.org/maven2/com/theartofdev/edmodo/android-image-cropper/2.8.0/android-image-cropper-2.8.0.pom
Required by:
project :app
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugNativeLibs'.
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:402)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:389)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:382)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:368)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.theartofdev.edmodo:android-image-cropper:2.8.0.
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1423)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$3600(DefaultConfiguration.java:152)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$DefaultResolutionHost.rethrowFailure(DefaultConfiguration.java:2035)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.visitContents(DefaultConfiguration.java:1395)
at org.gradle.api.internal.file.AbstractFileCollection.getFiles(AbstractFileCollection.java:130)
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:176)
at org.gradle.api.internal.file.FilteredFileCollection.iterator(FilteredFileCollection.java:79)
at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:257)
at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection$1.visitCollection(DefaultConfigurableFileCollection.java:244)
at org.gradle.api.internal.file.AbstractFileCollection.visitContents(AbstractFileCollection.java:335)
at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:330)
at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection.lambda$calculateFinalizedValue$0(DefaultConfigurableFileCollection.java:241)
at org.gradle.api.internal.file.collections.UnpackingVisitor.add(UnpackingVisitor.java:64)
at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection$UnresolvedItemsCollector.visitContents(DefaultConfigurableFileCollection.java:372)
at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection.calculateFinalizedValue(DefaultConfigurableFileCollection.java:241)
at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection.visitChildren(DefaultConfigurableFileCollection.java:277)
at org.gradle.api.internal.file.CompositeFileCollection.getSourceCollections(CompositeFileCollection.java:113)
at org.gradle.api.internal.file.CompositeFileCollection.isEmpty(CompositeFileCollection.java:60)
at org.gradle.api.internal.file.CompositeFileCollection.isEmpty(CompositeFileCollection.java:61)
at org.gradle.api.internal.file.CompositeFileCollection.isEmpty(CompositeFileCollection.java:61)
at org.gradle.api.internal.file.CompositeFileCollection.isEmpty(CompositeFileCollection.java:61)
at org.gradle.api.internal.tasks.execution.DefaultEmptySourceTaskSkipper.skipIfEmptySources(DefaultEmptySourceTaskSkipper.java:67)
at org.gradle.api.internal.tasks.execution.TaskExecution.skipIfInputsEmpty(TaskExecution.java:483)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:47)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:43)
at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:31)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
at org.gradle.api.internal.tasks.execution.TaskExecution$3.withWorkspace(TaskExecution.java:284)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:44)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:33)
at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:142)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:131)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:77)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:402)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:389)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:382)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:368)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.theartofdev.edmodo:android-image-cropper:2.8.0.
Searched in the following locations:
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.theartofdev.edmodo:android-image-cropper:2.8.0.
- https://dl.google.com/dl/android/maven2/com/theartofdev/edmodo/android-image-cropper/2.8.0/android-image-cropper-2.8.0.pom
- https://repo.maven.apache.org/maven2/com/theartofdev/edmodo/android-image-cropper/2.8.0/android-image-cropper-2.8.0.pom
Required by:
project :app
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 719ms
23 actionable tasks: 10 executed, 13 up-to-date
It looks like there are problems in my build.gradle files but I can't figure out where exactly
build.gradle project file:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle module file (Image Cropper implementation is in the last line):
plugins {
id ("com.android.application")
id ("org.jetbrains.kotlin.android")
id ("kotlin-kapt")
id ("com.google.gms.google-services")
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.shercofaqapp"
minSdkVersion 21
targetSdkVersion 32
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_11
targetCompatibility JavaVersion.VERSION_11
}
composeOptions {
kotlinCompilerExtensionVersion = "1.2.0-beta03"
}
kotlinOptions {
jvmTarget = '11'
freeCompilerArgs = ['-Xjvm-default=compatibility']
}
buildFeatures {
dataBinding true
compose true
viewBinding true
}
dataBinding {
enabled = true
}
}
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//Firebase
implementation platform('com.google.firebase:firebase-bom:29.3.1')
implementation 'com.google.firebase:firebase-database-ktx'
implementation 'com.google.firebase:firebase-auth-ktx:21.0.6'
implementation 'com.firebaseui:firebase-ui-database:8.0.1'
implementation 'com.google.firebase:firebase-storage:20.0.1'
implementation 'com.google.firebase:firebase-storage-ktx:20.0.1'
//Material
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
// ViewModel
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0-alpha01")
// LiveData
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.0-alpha01")
// Annotation processor
//noinspection LifecycleAnnotationProcessorWithJava8
kapt("androidx.lifecycle:lifecycle-compiler:2.6.0-alpha01")
def roomVersion = "2.4.2"
implementation("androidx.room:room-runtime:$roomVersion")
kapt("androidx.room:room-compiler:$roomVersion")
annotationProcessor("androidx.room:room-compiler:$roomVersion")
// optional - Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$roomVersion")
// optional - RxJava2 support for Room
implementation("androidx.room:room-rxjava2:$roomVersion")
// optional - RxJava3 support for Room
implementation("androidx.room:room-rxjava3:$roomVersion")
def nav_version = "2.5.0"
// Kotlin
implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
implementation("androidx.navigation:navigation-ui-ktx:$nav_version")
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// Kotlin
implementation("androidx.fragment:fragment-ktx:1.5.0")
implementation "androidx.activity:activity-ktx:1.5.0"
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1")
implementation('com.google.android.material:material:1.6.1')
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.0'
implementation 'androidx.compose.ui:ui:1.1.1'
// Tooling support (Previews, etc.)
implementation 'androidx.compose.ui:ui-tooling:1.1.1'
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation 'androidx.compose.foundation:foundation:1.1.1'
// Material Design
implementation 'androidx.compose.material:material:1.1.1'
// Material design icons
implementation 'androidx.compose.material:material-icons-core:1.1.1'
implementation 'androidx.compose.material:material-icons-extended:1.1.1'
// Integration with activities
implementation 'androidx.activity:activity-compose:1.5.0'
// Integration with ViewModels
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.5.0'
// Integration with observables
implementation 'androidx.compose.runtime:runtime-livedata:1.1.1'
implementation 'androidx.compose.runtime:runtime-rxjava2:1.1.1'
debugImplementation "androidx.compose.ui:ui-tooling:1.1.1"
implementation "androidx.compose.ui:ui-tooling-preview:1.1.1"
// UI Tests
androidTestImplementation 'androidx.compose.ui:ui-test-junit4:1.1.1'
//Glide
implementation 'com.github.bumptech.glide:glide:4.13.0'
kapt('com.github.bumptech.glide:compiler:4.13.0')
//Google play-services
implementation 'com.google.android.gms:play-services-auth:20.2.0'
//Image Cropper
api 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
}
CodePudding user response:
The issue has been opened. You can check: https://github.com/ArthurHub/Android-Image-Cropper/issues/853
New GitHub Repo: https://github.com/CanHub/Android-Image-Cropper
You should do it by following the steps here:
Add to your project
Step 1. Add the JitPack repository to your root build.gradle
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven { url='https://jitpack.io'}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url='https://jitpack.io'}
}
}
rootProject.name = "My Application"
include ':app'
Step 2. Add the dependency
dependencies {
implementation 'com.github.CanHub:Android-Image-Cropper:4.3.0'
}
It's worked.
CodePudding user response:
That library has not been updated in four years. You might want to consider a newer library, as there are dozens of image-cropping libraries available for Android.
The reason why you cannot use it is because that library is not published in either the google()
or mavenCentral()
repositories, which is all that you have configured. You would have to add jcenter()
to that list, and jcenter()
is no longer a recommended repository.