简体   繁体   English

反应本地构建失败

[英]React Native Build Failing

Hi I am new to react native and was trying to setup the sample project, but while trying to build the app i am getting following error 嗨,我是本机反应新手,正在尝试设置示例项目,但是在尝试构建应用程序时,我遇到了以下错误

Task :app:installDebug FAILED 任务:app:installDebug失败

Skipping device 'd18a96d67d94 - 7.1.2' for 'app:debug': Could not find build of variant which supports density -1 and an ABI in FAILURE: Build failed with an exception. 跳过设备'd18a96d67d94-7.1.2'的'app:debug':无法找到支持密度-1和ABI的变体版本:失败,发生异常。

What went wrong: Execution failed for task ':app:installDebug'. 出了什么问题:任务':app:installDebug'的执行失败。

Failed to install on any devices. 无法在任何设备上安装。

Any idea why this is happening? 知道为什么会这样吗?

  1. enable developer mode - In your phone, go to Settings, About phone and click on MIUI version 7 times. 启用开发人员模式-在您的手机中,依次转到“设置”,“关于手机”,然后单击MIUI版本7次。 You'll see a pop up which says you are a developer now. 您会看到一个弹出窗口,提示您现在是开发人员。

  2. Go back to Settings, Additional settings, Developer options and enable USB Debugging. 返回设置,其他设置,开发人员选项并启用USB调试。

  3. Connect your phone to your PC/Mac and on the phone authorize your computer 将手机连接到PC / Mac,然后在手机上授权计算机

  4. go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. 返回“开发人员选项”,向下滚动以找到“打开MIUI优化”并将其禁用。 Your phone will be rebooted 您的手机将重新启动

  5. Try it now :) 现在就试试 :)

===== =====

  1. cek list devices : adb devices cek列表设备:adb设备

  2. kill adb device : adb kill-server deviceId 329cb478 // is my id devices 杀死adb设备:adb kill-server deviceId 329cb478 //是我的id设备

  3. run again : adb devices 再次运行:adb设备

  4. npm start npm开始

  5. Open another console / cmd 打开另一个控制台/ cmd

  6. run this inside folder project : react-native run-android --deviceId 329cb478 在文件夹项目内部运行此命令:react-native run-android --deviceId 329cb478

If you have error something like this : 如果您有这样的错误:

Running C:\Android\sdk/platform-tools/adb -s 329cb478 reverse tcp:8081 tcp:8081
Installing the app on the device (cd android && adb -s 329cb478 install app/build/outputs/apk/app-debug.apk
adb: error: cannot stat 'app/build/outputs/apk/app-debug.apk': No such file or directory
Command failed: C:\Android\sdk/platform-tools/adb -s 329cb478 install app/build/outputs/apk/app-debug.apk
Could not install the app on the device, read the error above for details.

=== ===

please cek : app-debug.apk location 请cek:app-debug.apk位置

mylocation default : C:\\Users\\base\\react_cargo\\cargomobile\\mobile_json2\\android\\app\\build\\outputs\\apk\\debug\\app-debug.apk mylocation默认值:C:\\ Users \\ base \\ react_cargo \\ cargomobile \\ mobile_json2 \\ android \\ app \\ build \\ outputs \\ apk \\ debug \\ app-debug.apk

and you must move : app-debug.apk 并且您必须移动:app-debug.apk

C:\\Users\\base\\react_cargo\\cargomobile\\mobile_json2\\android\\app\\build\\outputs\\apk\\app-debug.apk C:\\ Users \\ base \\ react_cargo \\ cargomobile \\ mobile_json2 \\ android \\ app \\ build \\ outputs \\ apk \\ app-debug.apk

up for one level folder : "debug"

outputs\apk\debug
--
outputs\apk\

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM