5

When i add to this line implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+' in my dependency it cause error

* my error *

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:8:5-25:19 to override.

And

implementation 'com.android.support:appcompat-v7:28.0.0'

this line become red line

I think the problem is reason of version

How can I avoid that clash?

I already try to change version and add code in manifest

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<usespermissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

but it didn't work

This is my manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.blogapp">

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".Activities.LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".Activities.RegisterActivity" />
        <activity android:name=".Activities.PostActivity" />
        <activity android:name=".Activities.HomeActivity" />
    </application>

</manifest>

This is my dependency

apply plugin: 'com.android.application'

    android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.blogapp"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        }
    }



dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    implementation 'com.google.firebase:firebase-core:16.0.1'

    implementation 'com.google.firebase:firebase-auth:16.0.1'

    implementation 'com.google.firebase:firebase-storage:16.0.1'

    implementation 'com.google.firebase:firebase-database:16.0.1'

    implementation "com.wdullaer:materialdatetimepicker:3.6.4"

    implementation 'com.android.support:support-v4:28.0.0'

    implementation 'com.android.support:recyclerview-v7:28.0.0'

    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'

    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 'com.android.support:design:28.0.0'

    implementation 'de.hdodenhof:circleimageview:3.0.0'

    implementation 'com.github.siyamed:android-shape-imageview:0.9.3@aar'

    implementation 'com.github.bumptech.glide:glide:4.9.0'
}

apply plugin: 'com.google.gms.google-services'

I hope use this imageCropper no trouble in my dependency https://github.com/ArthurHub/Android-Image-Cropper

VIISHRUT MAVANII
  • 11,410
  • 7
  • 34
  • 49
ru hee
  • 103
  • 1
  • 1
  • 7

6 Answers6

6

The library has moved to a new one (old one not maintained)

https://github.com/CanHub/Android-Image-Cropper

Read here

Rami Alloush
  • 2,308
  • 2
  • 27
  • 33
1

Use version 2.7.0

implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'

version 2.8.0 uses androidx support libraries , so use it only if you use androidx support libraries in your project

Change log

2.8.0

  1. Fix crash on Android O (thx @juliooa)
  2. Update to support library to AndroidX (thx @mradzinski)
  3. Handle failure when selecting non image file (thx @uncledoc)
  4. More translations (thx @jkwiecien, @david-serrano)

EDIT :

Add this at the end of app level build.gradle file

configurations.all {
 resolutionStrategy.eachDependency {  details ->
    def requested = details.requested
    if (requested.group == 'com.android.support') {
        if (!requested.name.startsWith("multidex")) {
            details.useVersion "28.0.0"
        }
    }
  }
}

Credit to Eugen Pechanec

Community
  • 1
  • 1
Manohar
  • 22,116
  • 9
  • 108
  • 144
  • I was try do this before but after i change version 2.7 but when i change that implementation 'com.android.support:appcompat-v7:28.0.0' show red line and show me message like this All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.1. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-v13:27.1.1 more... (Ctrl+F1) – ru hee Mar 26 '19 at 09:02
0

if you want to use below

implementation com.theartofdev.edmodo:android-image-cropper:2.8.+

Add two lines in gradle.properties file:

android.useAndroidX=true
android.enableJetifier=true
VIISHRUT MAVANII
  • 11,410
  • 7
  • 34
  • 49
  • But after i add that two lines one of my implement occured error android.support.v7.app.AppCompatActivit Is that incompatible? – ru hee Mar 26 '19 at 08:54
  • yes, after you need to use AppCompatActivit from androidx . it means you need to change your import. – VIISHRUT MAVANII Mar 26 '19 at 10:52
0

I have handled this issue by importing this library as module and replacing dependencies from

dependencies {
api "androidx.appcompat:appcompat:$androidXLibraryVersion"
implementation "androidx.exifinterface:exifinterface:$androidXLibraryVersion"
}

to

dependencies {
api "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:exifinterface:28.0.0"
}

And updating imports in all files of library

0

Not sure about case but after facing same issue it was because i did not add

tools:replace="android:appComponentFactory"

This line in Manifest

Zahid Iqbal
  • 394
  • 6
  • 12
0

change version don't use + if you use android studio bumblebee, go to setting.gradle, and add jcenter() :

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841