2016-07-13 14 views
7

Quando si utilizza il reagente nativo 0.28 e superiore (0.29, 0.30-rc), si verifica il seguente errore durante l'esecuzione di react-native run-android in un nuovo progetto react-native init app.Impossibile trovare com.android.support:support-v4:23.2.1

Could not find com.android.support:support-v4:23.2.1. 

Ho installato il nuovo studio Android e persino installato manualmente la libreria obsoleta.

installed

Che cosa sto facendo di sbagliato? Grazie!

risposta

7

Per completare la risposta di Tonithy - il .jar potrebbe non essere sufficiente, è necessario copiare due intere directory, altrimenti volontà Gradle lamentarsi per il .aar mancante. In questo caso, penso che quelli sono stati installati da Android Studio: {USER}/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/

e non dimenticare la dipendenza: {USER}/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.2.1/

Ho avuto esattamente lo stesso problema durante l'aggiornamento a react-native 0.30, che ha risolto il problema.

+1

Grazie sia per le vostre risposte! Alla fine ho dovuto copiare entrambe le cartelle 'support-v4/23.2.1' e' support-annotations/23.2.1' come hai detto @Simon. Questi sono i miei due comandi: 'cp -r ~/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/usr/local/var/lib/android-sdk/extra/android/m2repository/com/android/support/support-v4 ; cp -r ~/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.2.1/usr/local/var/lib/android-sdk/extras/android/m2repository/it/android/support/support-annotations ' – vardump

3

Ho anche ricevuto questo errore, dopo aver installato Android Support Library l'errore è andato. Installare Biblioteca Android di sostegno da Extra

enter image description here

+0

Questo funziona per Io, aggiorno solo il repository di supporto Android e sta andando bene. –

5

Google sembra essersi fermato tra cui una versione di ciascuna libreria di supporto senza fonti/javadoc/etc e React è alla ricerca di questo file specifico. Supponendo che è stato installato manualmente la versione obsoleta, sarà in {YOUR_ANDROID_LOCATION}/extras/android/support/v4/android-support-v4.jar La cosa migliore è copiare manualmente in:

cp {YOUR_ANDROID_LOCATION}/extras/android/support/v4/android-support-v4.jar {YOUR_ANDROID_LOCATION}/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 

Questo un Reagire nativa (versione e probabilmente OSX bug specifico), che sarà probabilmente riparato presto. Ai posteri, l'errore completo è stato qualcosa di simile, in cerca di sostegno in tutti i posti sbagliati:

OsagieTheGreat-MBA:somereactapp osagiethegreat$ react-native run-android 
JS server already running. 
Building and installing the app on the device (cd android && ./gradlew installDebug... 

FAILURE: Build failed with an exception. 

* What went wrong: 
A problem occurred configuring project ':app'. 
> Could not resolve all dependencies for configuration ':app:_debugCompile'. 
    > Could not find com.android.support:support-v4:23.2.1. 
    Searched in the following locations: 
     file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
     https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
     file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
     file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
     file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
    Required by: 
     SomeReactApp:app:unspecified > com.android.support:appcompat-v7:23.0.1 
     SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.android.support:recyclerview-v7:23.0.1 
    > Could not find com.android.support:support-v4:23.2.1. 
    Searched in the following locations: 
     file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
     https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
     file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
     file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
     file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom 
     file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar 
    Required by: 
     SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.facebook.fresco:imagepipeline-okhttp3:0.11.0 > com.facebook.fresco:imagepipeline:0.11.0 
     SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.facebook.fresco:fresco:0.11.0 > com.facebook.fresco:drawee:0.11.0 
     SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.facebook.fresco:imagepipeline-okhttp3:0.11.0 > com.facebook.fresco:imagepipeline:0.11.0 > com.facebook.fresco:imagepipeline-base:0.11.0 

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

BUILD FAILED 

Total time: 10.838 secs 
Could not install the app on the device, read the error above for details. 
Make sure you have an Android emulator running or a device connected and have 
set up your Android development environment: 
https://facebook.github.io/react-native/docs/android-setup.html 
0

per completare la risposta di Tonithy e Simon, sì, il vaso in sé non era sufficiente, tutti i file di due directory -
extras/android/m2repository/com/android/support/support-v4/23.2.1/ e sono necessari extras/android/m2repository/com/android/support/support-annotations/23.2.1/. Sul mio PC Windows, non sono riuscito a trovare i file di queste directory ovunque.

Quindi quello che ho fatto è stato, ho scaricato queste cartelle da googlesource

1. support/support-annotations/23.2.1

Scarica tgz della cartella di sopra e estrarre i file in {YOUR_ANDROID_LOCATION}/extras/android/m2repository/com/android/support/support-annotations/23.2.1/

2.support/support-v4/23.2.1

Scarica tgz della cartella di sopra e estrarre i file in {YOUR_ANDROID_LOCATION}/extras/android/m2repository/com/android/support/support-v4/23.2.1/

Ora vai al tuo propmt comando o terminale ed eseguire react-native run-android

Spero che salvare qualcuno poche ore !!

1

prima soluzione potrebbe essere l'aggiunta di questo

compile 'com.android.tools:sdklib:23.2.1' 

al file successivo

Android/app/build.gradle

Seconda soluzione è l'installazione di Android di sostegno Repository

+0

funziona. nessun file da copiare. facile. –