Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Could not find com.android.support:support-annotations:27.0.0. on RN 0.49.5 #177

Closed
Jacse opened this issue Nov 6, 2017 · 13 comments
Closed

Comments

@Jacse
Copy link

Jacse commented Nov 6, 2017

I'm certain I've missed something but I can't for the life of me figure out why I'm seeing this error. I did not experience it before upgrading react-native.

Expected behaviour

Properly building

Observed behaviour

Spits out following error:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':bugsnag-react-native'.
      > Could not resolve all dependencies for configuration ':bugsnag-react-native:_debugPublishCopy'.
         > Could not find com.android.support:support-annotations:27.0.0.
           Searched in the following locations:
               file:/Users/jacoblauritzen/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.0/support-annotations-27.0.0.pom
               file:/Users/jacoblauritzen/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.0/support-annotations-27.0.0.jar
               file:/Users/jacoblauritzen/my-project/android/sdk-manager/com/android/support/support-annotations/27.0.0/support-annotations-27.0.0.jar
           Required by:
               MitLectio:bugsnag-react-native:unspecified > com.bugsnag:bugsnag-android:4.1.2
         > Could not find com.android.support:support-annotations:27.0.0.
           Searched in the following locations:
               file:/Users/jacoblauritzen/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.0/support-annotations-27.0.0.pom
               file:/Users/jacoblauritzen/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.0/support-annotations-27.0.0.jar
               file:/Users/jacoblauritzen/my-project/android/sdk-manager/com/android/support/support-annotations/27.0.0/support-annotations-27.0.0.jar
           Required by:
               MitLectio:bugsnag-react-native:unspecified > com.facebook.react:react-native:0.20.1 > com.android.support:recyclerview-v7:23.0.1
               MitLectio:bugsnag-react-native:unspecified > com.facebook.react:react-native:0.20.1 > com.android.support:recyclerview-v7:23.0.1 > com.android.support:support-v4:23.0.1

Steps to reproduce

Update and build?

Version

Bugsnag-react-native@2.2.4
React-native@0.49.5

@tafty
Copy link

tafty commented Nov 6, 2017

I've just been handed an existing project for the first time and am having the same issue.

bugsnag-react-native@2.5.4
react-native@0.47.1

@fractalwrench
Copy link
Contributor

Thanks for the report @Jacse - a temporary workaround would be to edit the build.gradle file in the Android directory to include the following, as shown in our plain example app:

repositories {
    maven { url 'https://maven.google.com' }
}

It should be possible for us to specify this within our library - I'll test it out and make a release if everything is ok.

@Jacse
Copy link
Author

Jacse commented Nov 6, 2017

@fractalwrench cool, thanks for the quick response. Sounds good with including it in the library.

@salujaharkirat
Copy link

facing this with 0.47.2 also.. moved to version 2.3.0 for now

@fractalwrench
Copy link
Contributor

We've updated our docs and Changelog to better reflect that Google's maven repository needs to be specified in your project's android/build.gradle:

allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
    }
}

This is because the Android native library depends on the latest version of the Android Support Annotations library, which historically was installed via the SDK manager, but is now only available from https://maven.google.com

@jslok
Copy link

jslok commented Nov 8, 2017

@fractalwrench When I updated bugsnag-react-native to 2.6.0 and added maven.google.com repository, I get this error when I try to build my project now.

Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/zze.class

Do you have any idea why this error occurs? After research I found there must be a mismatch in the google dependencies but I could not find what version bugsnag-react-native is requiring.
Here is my android/app/build.gradle dependencies:

dependencies {
    compile project(':react-native-fetch-blob')
    compile 'com.android.support:multidex:1.0.1'
    compile project(':react-native-billing')
    compile project(':bugsnag-react-native')
    compile project(':react-native-admob')
    compile fileTree(dir: "libs", include: ["*.jar"])

    compile project(':react-native-fbsdk')
    compile project(':react-native-code-push')
    compile project(':react-native-device-info')
    compile project(':react-native-config')
    compile project(':react-native-fast-image')
    compile project(':react-native-camera')
    compile project(':react-native-google-analytics-bridge')
    compile project(':react-native-vector-icons')
    compile(project(":react-native-google-signin")) {
        exclude group: "com.google.android.gms" // very important
    }
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.google.android.gms:play-services-auth:11.0.4'
    compile 'com.google.firebase:firebase-appindexing:11.0.4'
}

Any help would be appreciated. Thanks!

@fractalwrench
Copy link
Contributor

@jslok have any of the other dependencies versions in your project been updated, or can this behaviour be reproduced simply by switching between 2.6.0 and your previous version of Bugsnag?

That error is usually caused by a mismatch in Google Play Service library versions - is it possible one of those dependencies relies on an older version of GPS?

Gradle should allow you to inspect the dependency tree by running ./gradlew :app:dependencies (where app is the name of your module). Would you be able to paste the output of the compile configuration?

@WhoJave
Copy link

WhoJave commented Nov 8, 2017

@fractalwrench thanks for your solutions, if there are any other way to solve this ,pls post here ,tks so much

@jslok
Copy link

jslok commented Nov 8, 2017

@fractalwrench I found the issue arises from simply adding the maven.google repository no matter what version of bugsnag I use.

With gradlew :app:dependencies (thanks for letting me know about that) I found the different versions of google play and firebase services that were causing the issues. Updating my versions in my build.gradle has solved my issue and my project builds now.

Do you know why simply adding the new repository would cause this issue? I made no other changes to my dependencies to reproduce the issue and all google services on my app worked just fine before and after.

@fractalwrench
Copy link
Contributor

@jslok One of the dependencies is probably using a wildcard version for GPS, which means it would use the latest available version. Previously that would default to the latest version installed on disk via the SDK manager, but now it will default to the latest version available on the Google Maven Repo. For example, something like this would cause a version clash:

compile 'com.google.android.gms:play-services-auth:11.0.0'
compile 'com.google.android.gms:play-services-auth:+'

@jslok
Copy link

jslok commented Nov 8, 2017

@fractalwrench Good to know. Thanks!

@patelmanthan777
Copy link

Try adding jcenter like this way

repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
Rather than

repositories {
jcenter()
}

@iampato
Copy link

iampato commented Oct 4, 2018

Finally solved this from help from reactnative
add maven { url 'https://maven.google.com' }

allprojects repositories { google() jcenter() mavenCentral() maven { url 'https://maven.google.com' } } }
'
'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants