Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.0)

After I am running ionic cordova build android I get this error:

FAILURE: Build failed with an exception.  * What went wrong: Could not resolve all files for configuration ':debugCompileClasspath'. > Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.0).   Searched in the following locations:   https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar 

And it is right. When I go to this URL https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar I get an 404 Not found error as a JSON.

I don't see any android/ cordova specific versions in that URL so I can't say its from my cordova installation.

Cordova version: 7.1.0

Ionic info:

cli packages: (C:\Users\%User%\AppData\Roaming\npm\node_modules)      @ionic/cli-utils  : 1.19.2     ionic (Ionic CLI) : 3.20.0  global packages:      cordova (Cordova CLI) : not installed // this is strange. I can run cordova in my terminal tho  local packages:      @ionic/app-scripts : 3.1.8     Cordova Platforms  : android 6.4.0     Ionic Framework    : ionic-angular 3.9.2  System:      Android SDK Tools : 26.1.1     Node              : v8.4.0     npm               : 5.3.0     OS                : Windows 10  Environment Variables:      ANDROID_HOME : C:\Users\%User%\AppData\Local\Android\Sdk  Misc:      backend : pro 

Also, I don't have any cordova-android folders in C:\Users\%USER%\.cordova\lib\npm_cache (I don't know if this helps. I saw people talking about this folder)

What's the problem here? Where is that URL coming from? How can I change it and with what can I change it?

If I cannot solve this easily there is one last step to do: remove and install everything again.

Thank you!

like image 425
Ionel Lupu Avatar asked May 28 '18 09:05

Ionel Lupu


2 Answers

A quick temporary fix is to include the google maven repo in your top level gradle file.

allprojects {   repositories {       mavenLocal()       maven { url 'https://maven.google.com' } // <-- add this!       jcenter() 
like image 136
Moritz Avatar answered Sep 19 '22 21:09

Moritz


For me AIT MANSOUR and Moritz answers didn't work, because I had other dependencies that required jcenter() and jitpack, additionally, for react-native you need the node_modules.

So, my solution for react-native is

allprojects {     repositories {         // this is for native modules I'm developing         mavenLocal()         // for modules depending on jitpack.io         maven { url "https://jitpack.io" }         // add this one         maven {             url "https://maven.google.com"         }         maven {             url "$rootDir/../node_modules/react-native/android"         }         // keep this at the end         jcenter()     } } 
like image 21
Computer's Guy Avatar answered Sep 16 '22 21:09

Computer's Guy