简体   繁体   English

构建失败,出现异常 java.io.IOException: Permission denied

[英]Build failed with an exception java.io.IOException: Permission denied

I'm trying to get a React Native project to run on my Linux Mint PC but I'm struggling to do so as I'm getting the following error message:我正在尝试让 React Native 项目在我的 Linux Mint PC 上运行,但我正在努力这样做,因为我收到以下错误消息:

yarn android
yarn run v1.21.1
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 977 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
/bin/sh: 1: /user/local/Android/Sdk/platform-tools/adb: not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...

FAILURE: Build failed with an exception.

* Wh

at went wrong:
    java.io.IOException: Permission denied

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

    * Get more help at https://help.gradle.org

    error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
    Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

    FAILURE: Build failed with an exception.

    * What went wrong:
    java.io.IOException: Permission denied

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

    * Get more help at https://help.gradle.org

        at checkExecSyncError (child_process.js:603:11)
        at execFileSync (child_process.js:621:15)
        at runOnAllDevices (/home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 977 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...

FAILURE: Build failed with an exception.

* What went wrong:
java.io.IOException: Permission denied

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

* Get more help at https://help.gradle.org

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
java.io.IOException: Permission denied

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

* Get more help at https://help.gradle.org

    at checkExecSyncError (child_process.js:603:11)
    at execFileSync (child_process.js:621:15)
    at runOnAllDevices (/home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
    at buildAndRun (/home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
    at /home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Command.handleAction (/home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/@react-native-community/cli/build/index.js:164:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

As far as I know It's something related to the gradle's permissions and I've tried the following:据我所知,这与 gradle 的权限有关,我尝试了以下操作:

chown -R username ./android/gradlew
chmod 777 -R ./android
chmod +x ./android/gradlew

But none of these seems to solve my problem.但这些似乎都不能解决我的问题。 I'd appreciate if someone could help me out here.如果有人能在这里帮助我,我将不胜感激。

try this:尝试这个:

1 - build the gradle. 1 - 构建gradle。 if no issue, proceed on access the android folder of your app.如果没有问题,请继续访问您的应用程序的 android 文件夹。 ie c:\\folder\\app\\android即 c:\\文件夹\\应用程序\\android

2 - type in ./gradlew clean 2 - 输入 ./gradlew clean

3 - run react-native run-android 3 - 运行 react-native run-android

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

相关问题 mp4prasser异常java.io.IOException:打开失败:EACCES(权限被拒绝) - mp4prasser exception java.io.IOException: open failed:EACCES (Permission denied) java.io.IOException:createNewFile() 的权限被拒绝 - java.io.IOException: Permission denied for createNewFile() 在Android中使用java.io.IOException写入文件失败:打开失败:EACCES(权限被拒绝) - File write failed in android with java.io.IOException: open failed: EACCES (Permission denied) java.io.IOException:打开失败:在API级别23中写入文件时,EACCES(权限被拒绝) - java.io.IOException: open failed: EACCES (Permission denied) when writing file in API level 23 即使在询问权限后,java.io.IOException 权限也被拒绝 - java.io.IOException Permission denied even after asking the permision java.io.IOException:在Andoid上使用相机时权限被拒绝? - java.io.IOException: Permission denied when using Camera on Andoid? java.io.IOException:权限被拒绝无法创建文件 - java.io.IOException: Permission denied cannot create file Jenkins执行失败:java.io.IOException ant build - Jenkins Execute failed: java.io.IOException ant build 在具有授予权限的Android中写入外部存储中的文件会引发java.io.IOException:权限被拒绝 - Writing to a file in external storage in Android with granted permission raises java.io.IOException: Permission denied java.io.IOException:grpc 失败 - java.io.IOException: grpc failed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM