"确保运行Android模拟器或连接设备"

Dro*_*Bar 1 react-native

我有一个奇怪的错误,一个特定的设备从工作.

我可以在模拟器上运行我的react本机应用程序,在终端和android studio上运行我自己的设备.但是当我尝试运行工作设备表单终端时,它给出了以下错误:

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
Run Code Online (Sandbox Code Playgroud)

请注意,设备已被识别:

adb devices
List of devices attached
S7M7N15610000083    device
Run Code Online (Sandbox Code Playgroud)

即使是陌生人,我也可以从android studio成功运行工作设备!但我希望能够使用:react-native run-android从终端运行它.有谁知道什么可能导致这个错误?

Niy*_*zar 8

检查android/gradlew文件的权限.

在终端中的React本机项目根文件夹中

ls -l android/gradlew
Run Code Online (Sandbox Code Playgroud)

如果文件权限不符合以下条件

-rwxr-xr-x 'links' 'owner' 'group' 'size' 'time' android/gradlew
Run Code Online (Sandbox Code Playgroud)

链接,所有者,组,大小和时间将根据系统进行替换.

chmod 755 android/gradlew
Run Code Online (Sandbox Code Playgroud)

在ReactNative根终端内.

资料来源:https: //github.com/facebook/react-native/issues/8868

与权限相关的有用资源:

https://askubuntu.com/questions/528411/how-do-you-view-file-permissions