简体   繁体   English

Android Studio 错误 13=Linux 中的权限被拒绝

[英]Android Studio error 13=permission denied in linux

i am using android studio latest version in linux(elementary luna to be specific).我在 linux 中使用 android studio 最新版本(具体是基本的 luna)。 I installed jdk, android studio and sdk successfully, android studio opens us perfectly and even i can work on my app.我成功安装了 jdk、android studio 和 sdk,android studio 完美地打开了我们,甚至我可以在我的应用程序上工作。 but when i bulid app it gives error 13: permission denied and it opens a black circle image png in new tab.但是当我构建应用程序时,它会出现错误 13:权限被拒绝并在新选项卡中打开一个黑色圆圈图像 png。

Information:Gradle tasks [:app:compileDebugSources]
:app:preBuild
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig 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
:app:mergeDebugResources FAILED
/home/suUs12/AndroidStudioProjects/MyApplication/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/res/drawable-mdpi/abc_btn_radio_to_on_mtrl_000.png
Error:Error: Cannot run program "/home/suUs12/Android/Sdk/build-tools/21.1.2/aapt": error=13, Permission denied
Error:Execution failed for task ':app:mergeDebugResources'.
> /home/suUs12/AndroidStudioProjects/MyApplication/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/res/drawable-mdpi/abc_btn_radio_to_on_mtrl_000.png:
Error: Cannot run program "/home/suUs12/Android/Sdk/build-tools/21.1.2/aapt": error=13, Permission denied
Information:BUILD FAILED
Information:Total time: 30.305 secs
Information:2 errors
Information:0 warnings

i dont understand the problem.我不明白这个问题。 i did searched on internet and tried many methods like我确实在互联网上搜索过并尝试了很多方法,例如

  1. changing permissions with chmod:使用 chmod 更改权限:

    chmod +x /home/alex/android-studio/sdk/build-tools/android-4.2.2/dx chmod +x /home/alex/android-studio/sdk/build-tools/android-4.2.2/dx

it executes successfully but with no effect on the problem itself,它成功执行但对问题本身没有影响,

2.closing and re-importing project, 2.关闭并重新导入项目,

3.i also tried this, 3.我也试过这个,

sudo apt-get install lib32stdc++
sudo apt-get install lib32z1

and i get following result我得到以下结果

suUs12@suUs12:~/Android/Sdk$ sudo apt-get install lib32stdc++6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package lib32stdc++6 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'lib32stdc++6' has no installation candidate

i guess this is not issue since my system is 32 bit and this is for 64 bit systems.我想这不是问题,因为我的系统是 32 位的,而这是针对 64 位系统的。

Can anyone help?任何人都可以帮忙吗? since i am really counting on it.因为我真的很依赖它。

my system configurations:(if useful)我的系统配置:(如果有用)

-OS Version: 0.2.1 "Luna" ( 32-bit ), Built on: Ubuntu 12.04 ( "Precise" ) -OS 版本:0.2.1“Luna”(32 位),基于:Ubuntu 12.04(“精确”)

-installed OpenJdk 7: java version "1.6.0_34" OpenJDK Runtime Environment (IcedTea6 1.13.6) (6b34-1.13.6-1ubuntu0.12.04.1) -已安装 OpenJdk 7:java 版本“1.6.0_34”OpenJDK 运行时环境 (IcedTea6 1.13.6) (6b34-1.13.6-1ubuntu0.12.04.1)

OpenJDK Client VM (build 23.25-b01, mixed mode, sharing) OpenJDK Client VM(构建 23.25-b01,混合模式,共享)

I'm running android studio 1.0.2 on ubuntu 14.04 (LTS) 32 bit and i had the same problem.我在 ubuntu 14.04 (LTS) 32 位上运行 android studio 1.0.2,我遇到了同样的问题。 just go to " /home/suUs12/Android/Sdk/build-tools/21.1.2/ " and then right click on ' aapt ' file , properties -> permissions and check ' Allow executing file as program '.只需转到“ /home/suUs12/Android/Sdk/build-tools/21.1.2/ ”,然后右键单击“ aapt ”文件,属性 -> 权限并选中“允许将文件作为程序执行”。 then close the window.然后关闭窗口。

In my case,after giving permission for ' aapt ' file, I had to give the same permission for ' dx ' and ' zipalign ' files in the same directory (/home/suUs12/Android/Sdk/build-tools/21.1.2/) and I was able to run my first app using android studio.就我而言,在授予“ aapt ”文件权限后,我必须为同一目录中的“ dx ”和“ zipalign ”文件授予相同的权限(/home/suUs12/Android/Sdk/build-tools/21.1.2 /) 并且我能够使用 android studio 运行我的第一个应用程序。

Give Root permission to your android studio by using使用 Root 权限授予您的 android 工作室

chmod -777 YourAndroidStudioFolder chmod -777 你的AndroidStudio文件夹

如果这有帮助,我在向/opt/android-bundle/sdk/build-tools/$VERSION/aaptdxzipalign )中的所有可执行文件授予完全执行权限( chmod a+x )后解决了这个问题。

This problem is about insufficient authority.这个问题是权限不足。 If you change your user as 'root' and you open android studio, this problem will be resolved.如果您将用户更改为“root”并打开 android studio,此问题将得到解决。 For ex;对于前;

Open Terminal打开终端

$ sudo -i $ 须藤 -i

[enter your password] : ******** [输入您的密码]:********

root@pc-name:~$ cd /home/username/.../android-studio/bin root@pc-name:~$ cd /home/username/.../android-studio/bin

root@pc-name:~$ ./studio.sh root@pc-name:~$ ./studio.sh

The permissions problem with file not found with aapt wasn't with this file itself but with the *.so files it tries to use.使用 aapt 找不到文件的权限问题不是与此文件本身有关,而是与它尝试使用的 *.so 文件有关。 The first thing to do which I didn't at first was run the following sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686 to get the necessary 32 bit *.so files installed.我一开始没有做的第一件事是运行以下 sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686 来安装必要的 32 位 *.so 文件。 I found out about the missing *.so files by running aapt outside the studio.我通过在工作室外运行 aapt 发现了丢失的 *.so 文件。 I also found there were a number of files that were read or read write only that needed to be executable in these directories.我还发现在这些目录中,有许多文件是只读的或只读的,它们只需要可执行。 android-studio/bin android-studio/jre/bin android-studio/jre/jre/bin android-studio/gradle/gradle-2.14.1/bin android-studio/bin android-studio/jre/bin android-studio/jre/jre/bin android-studio/gradle/gradle-2.14.1/bin

The fsnotifier files and the 2 *.sh file in the first bin directory. fsnotifier 文件和第一个 bin 目录中的 2 *.sh 文件。 All the files in the two jre directories and the gradle file in the last directory needed to be chmod 755. After I did that I no longer get the pop up box about the fsnotifier and the gradle build doesn't get the permission error.两个 jre 目录中的所有文件和最后一个目录中的 gradle 文件都需要是 chmod 755。在我这样做之后,我不再收到关于 fsnotifier 的弹出框,并且 gradle 构建没有得到权限错误。 Running as root doesn't help when the problem is with files not being executable.当问题在于文件不可执行时,以 root 身份运行无济于事。

我通过以下方式解决了这个问题:右键单击像 Android-Studio 这样的主文件夹,然后转到“属性”,然后单击“权限”并选中“允许将文件作为程序执行”的复选框,然后在终端中运行 Android Studio :)

删除构建工具并重新下载它解决了我的问题。

just reinstall the build tool version and then go into folder where sdk is installed and in build tool version's "aapt" file and change permissions from "property" all to read and write and check mark to "Allow executing file as a program" and then close it.只需重新安装构建工具版本,然后进入安装 sdk 的文件夹和构建工具版本的“aapt”文件,将权限从“属性”全部更改为读写并将复选标记更改为“允许将文件作为程序执行”,然后关闭它。 same problem is solved by doing this.这样做可以解决同样的问题。

你可以在/opt/文件夹下重新安装androidstudio。这是一个共享文件夹。关于如何安装androidstudio并解决问题,我参考了官网的视频。我几乎在网上尝试了各种方法,但没有奏效。实际上,这只是一个关于许可的问题。

In my case the partition in which I saved the Sdk was mounted with the defaults option in /etc/fstab, which in turn enabled the default noexec option which forbids execution for all files in that partition.在我的例子中,我保存 Sdk 的分区是使用 /etc/fstab 中的默认选项挂载的,这反过来启用了默认的 noexec 选项,该选项禁止执行该分区中的所有文件。

Then I edited that line in fstab appending exec, resulting in the options list 'user,defaults,exec' for that partition.然后我在 fstab 中编辑了该行并附加了 exec,从而生成了该分区的选项列表“user,defaults,exec”。

I coould resolve the same issue by using the following shell command:我可以使用以下 shell 命令解决同样的问题:

chmod 755 -R android-studio

You need to grant more privileges.您需要授予更多权限。

In Android Studio folder, open your terminal and type the following在 Android Studio 文件夹中,打开您的终端并输入以下内容

chmod 777 * -R

This surely worked like magic for me这对我来说确实很神奇

as error said:正如错误所说:

Error: Cannot run program "/home/suUs12/Android/Sdk/build-tools/21.1.2/aapt": error=13, Permission denied

you don't have permission.你没有权限。 just go to /home/suUs12/Android/Sdk/build-tools/21.1.2/ and remove aapt file.只需转到/home/suUs12/Android/Sdk/build-tools/21.1.2/并删除aapt文件。

I solved this problem by:我通过以下方式解决了这个问题:

chmod +x /User/Library/Android/sdk/build-tools/23.0.1/aapt
chmod +x /User/Library/Android/sdk/build-tools/23.0.1/dx
chmod +x /User/Library/Android/sdk/build-tools/23.0.1/zipalign

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

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