React-native: Error:Could not find common.jar (android.arch.core:common:1.0.0)

Created on 29 May 2018  路  7Comments  路  Source: facebook/react-native

When I'm ready to generate a new apk for andriod, I ran ./gradlew installRelease, but something go wrong. And I ran react-native run-android got same error like:

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-device-info'.
      > Could not find common.jar (android.arch.core:common:1.0.0).
        Searched in the following locations:
            https://jcenter.bintray.com/android/arch/core/common/1.0.0/common-1.0.0.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

open Android Studio, the error is:

Error:Could not find common.jar (android.arch.core:common:1.0.0).
Searched in the following locations:
    https://jcenter.bintray.com/android/arch/core/common/1.0.0/common-1.0.0.jar

It's still good in the morning, and suddenly it's an error in the afternoon.I try to solve this problem like React Native - Run Android - Could not find common.jar (android.arch.core:common:1.0.0)
But it does not work for me锛両 don't know what went wrong.

About Version:
react-native: 0.44.3
Android Studio: 2.3.3

Android Ran Commands For Stack Overflow Locked

Most helpful comment

This error is occurring because there is an issue with the common-1.0.0 library on jcenter(). According to the jcenter folks, they only have the .aar file and not the .jar file for this library.

To fix this you just need to add (or move) the maven repository in your build.gradle file above of jcenter().

For example, your build.gradle file should look something like this:

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

    maven { url "$rootDir/../node_modules/react-native/android" }

    jcenter() <!-- Needs to come after maven -->
  }
}

You can read about the problem and solution at these two:

https://stackoverflow.com/a/50565155/293280

https://github.com/zo0r/react-native-push-notification/issues/748

All 7 comments


It looks like your issue may be incomplete. Are all the fields required by the Issue Template filled out?

If you believe your issue contains all the relevant information, let us know in order to have a maintainer remove the No Template label.

I have same issue.

Environment:
  OS: macOS High Sierra 10.13.4
  Node: 8.11.1
  Yarn: 1.5.1
  npm: 5.6.0
  Watchman: 4.9.0
  Xcode: Xcode 9.3.1 Build version 9E501
  Android Studio: 3.1 AI-173.4720617

Packages: (wanted => installed)
  react: 16.2.0 => 16.2.0
  react-native: 0.52.2 => 0.52.2

Please use Stack Overflow for this type of question.

This error is occurring because there is an issue with the common-1.0.0 library on jcenter(). According to the jcenter folks, they only have the .aar file and not the .jar file for this library.

To fix this you just need to add (or move) the maven repository in your build.gradle file above of jcenter().

For example, your build.gradle file should look something like this:

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

    maven { url "$rootDir/../node_modules/react-native/android" }

    jcenter() <!-- Needs to come after maven -->
  }
}

You can read about the problem and solution at these two:

https://stackoverflow.com/a/50565155/293280

https://github.com/zo0r/react-native-push-notification/issues/748

I solved my error by putting google() above jcenter() in my project's gradle file.

I really wish Android Studio can give more helpful error message. Most it's error messages are gibberish and require us to do some digging around, even though the solution is as simple as switching two lines around. Which means productivity lost.

I solved my error by putting google() above jcenter() in my project's gradle file.
I really wish Android Studio can give more helpful error message. Some most it's error messages are gibberish and require us to do some digging around, even though the solution is as simple as switching two lines around. Which means productivity lost.

SOLVED WITH THIS !!!

None of the above solutions worked for me

Was this page helpful?
0 / 5 - 0 ratings