8

when i use this library :

compile 'co.ronash.android:pushe-base:1.4.0'

I get this error in gradle:

Failed to resolve: com.android.support:support-v4:26.0.2

I can't fix it.

There is a solution to be there library Ignored 'com.android.support:support-v4:26.0.2' from 'co.ronash.android:pushe-base:1.4.0' ?

Because I have already compiled a newer version of support-v4 library.

All my dependencies code in gradle :

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.+' //--> its ok and no problem
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'co.ronash.android:pushe-base:1.4.0' //--->this code is error Failed to resolve: com.android.support:support-v4:26.0.2
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
testCompile 'junit:junit:4.12'
}
0

1 Answer 1

4

There are a few reasons which can cause this kind of problem.
Checkout these solution, I guess it might help you:

1. Remove Pushe and try adding support-v4 library with version of 26.0.2 to make sure it gets downloaded and cached to your system.
compile 'com.android.support:support-v4:26.0.2' // or implementation

If it still can't be resolved then you have a problem getting it from it's repository server. checkout build.gradle(project:your_prj) and make sure this block is valid.

allprojects {
    repositories {
        google() // or maven { url 'https://maven.google.com/' } for lower gradles
        jcenter()
    }
}

If your country is included in sanction you might need to use a VPN to be able to get them. You can also use a proxy like Fod(also donate if you can since it's opensource) or shecan. Remember all support libraries better be 26.0.2 to avoid conflict and crashing. Your support libraries are 26.0.0-alpha1 which is lower.

  1. After you successfully added and cached support-v4 then try to add Pushe to your dependencies again.

! And also remember that pushe has a support-v4 bundled in it and it's not really needed for you to add it yourself

And Make sure you have

<uses-sdk tools:overrideLibrary="co.ronash.pushe" />

in you manifest. Therefore you can override it's libraries and dependencies. At the end keep your SDK update.

Edit:
Current version of Pushe is using android support libraries. If you attend to use AndroidX be sure to enable jettifier in order to do runtime conversion.

4
  • support-v4 is not compatible with androidx. in order to fix that i set android.useAndroidX and android.enableJetifier to true. Oct 21, 2018 at 4:23
  • The currrent version of pushe has support-v4 bundled in itself. Isn't it a concern? Because of the library you might not be able to use androidX. Am i right?
    – Mahdi-Malv
    Oct 21, 2018 at 5:42
  • I am confused about that as well. but it seems it fixed the problem for me. i got similar error here and this answer fixed my problem stackoverflow.com/a/50472281/4767498 Oct 21, 2018 at 5:58
  • AndroidX also has jettifier which does runtime conversion of supportlib to androidX packages. So no worries about that.
    – Mahdi-Malv
    Dec 13, 2018 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.