2017-08-16 4 views
5

J'ai suivi les instructions exactes montrées dans React Native's Android Setup Page et exécutez le code sans rencontrer de problèmes hier.Aujourd'hui, j'essaye de courir exactement le même code .Il dit comme je l'ai fourni ci-dessous . « build est réussie », mais je vois il n'y a qu'un fichier android/build/intermediates/dex-cache/cache.xml et rien de plus dans le dossier android/builid ont également l'erreur suivante as shown in this image J'essaie de comprendre ce qui est mauvais est ici la sortie du terminal:..Réagir natif: Transformer l'erreur pour le jeton inattendu (

[email protected]:~/Desktop/tutorials/react native tutorial/NewPro$ react-native run-android 
Scanning 559 folders for symlinks in /home/ugur/Desktop/tutorials/react native tutorial/NewPro/node_modules (2ms) 
Starting JS server... 
Building and installing the app on the device (cd android && ./gradlew installDebug)... 
Incremental java compilation is an incubating feature. 
:app:preBuild UP-TO-DATE 
:app:preDebugBuild UP-TO-DATE 
:app:checkDebugManifest 
:app:preReleaseBuild UP-TO-DATE 
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE 
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DATE 
:app:prepareComFacebookFrescoDrawee101Library UP-TO-DATE 
:app:prepareComFacebookFrescoFbcore101Library UP-TO-DATE 
:app:prepareComFacebookFrescoFresco101Library UP-TO-DATE 
:app:prepareComFacebookFrescoImagepipeline101Library UP-TO-DATE 
:app:prepareComFacebookFrescoImagepipelineBase101Library UP-TO-DATE 
:app:prepareComFacebookFrescoImagepipelineOkhttp3101Library UP-TO-DATE 
:app:prepareComFacebookReactReactNative0471Library UP-TO-DATE 
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE 
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE 
:app:prepareDebugDependencies 
:app:compileDebugAidl UP-TO-DATE 
:app:compileDebugRenderscript UP-TO-DATE 
:app:generateDebugBuildConfig UP-TO-DATE 
:app:mergeDebugShaders UP-TO-DATE 
:app:compileDebugShaders UP-TO-DATE 
:app:generateDebugAssets UP-TO-DATE 
:app:mergeDebugAssets UP-TO-DATE 
:app:generateDebugResValues UP-TO-DATE 
:app:generateDebugResources UP-TO-DATE 
:app:mergeDebugResources UP-TO-DATE 
:app:bundleDebugJsAndAssets SKIPPED 
:app:processDebugManifest UP-TO-DATE 
:app:processDebugResources UP-TO-DATE 
:app:generateDebugSources UP-TO-DATE 
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE 
:app:compileDebugJavaWithJavac UP-TO-DATE 
:app:compileDebugNdk UP-TO-DATE 
:app:compileDebugSources UP-TO-DATE 
:app:transformClassesWithDexForDebug UP-TO-DATE 
:app:mergeDebugJniLibFolders UP-TO-DATE 
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE 
:app:processDebugJavaRes UP-TO-DATE 
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE 
:app:validateSigningDebug 
:app:packageDebug UP-TO-DATE 
:app:assembleDebug UP-TO-DATE 
:app:installDebug 
Installing APK 'app-debug.apk' on 'SM-N910C - 6.0.1' for app:debug 
Installed on 1 device. 

BUILD SUCCESSFUL 

Total time: 17.032 secs 
Running /home/ugur/Android/Sdk/platform-tools/adb -s 4100fef8e47db1b3 reverse tcp:8081 tcp:8081 
adb server version (32) doesn't match this client (39); killing... 
* daemon started successfully * 
Starting the app on 4100fef8e47db1b3 (/home/ugur/Android/Sdk/platform-tools/adb -s 4100fef8e47db1b3 shell am start -n com.newpro/com.newpro.MainActivity)... 
Starting: Intent { cmp=com.newpro/.MainActivity } 

Mon système d'exploitation est OS élémentaire, nœud v6.11.2, reac-native-cli v2.0.1

Je serais heureux si vous me guidez pour savoir ce qui ne va pas avec ma construction.

Répondre

17

Ceci est quelque chose lié à babel-preset-react-native modules. Essayez d'exécuter,

yarn remove babel-preset-react-native 
yarn add [email protected] 

Ou si vous utilisez NPM,

npm uninstall babel-preset-react-native 
npm install [email protected] 
+0

Je t'aime <3 Ça a marché! –

+0

On dirait qu'il y a un problème avec la version 3.0 ou que les documents ne sont pas alignés avec les nouveaux changements. –

+0

oui ça a marché !!! –

0

Supprimez le dossier node_modules, puis exécutez la commande.

npm install 

Ensuite, exécutez le projet.

0

Essayez de tuer tout processus sur le port 8081

si vous êtes sur MAC puis exécutez ci-dessous commande

sudo lsof -n -i4TCP:8081 
2

A répondu au sujet suivant: https://stackoverflow.com/a/45778766/4621698

Cela a fonctionné pour moi.

Solution:

"dependencies": { 
"react": "16.0.0-alpha.12", 
"react-native": "0.47.1", 
"babel-preset-react-native": "2.1.0" 
}, 

Voir ci-dessus, maintenant des points babel-préprogrammée réagiront-natifs à 2.1.0. Ensuite,

rm -rf node_module 
npm cache clean 
npm i 

et redémarrez selon Android ou ios.