相关文章推荐
英姿勃勃的勺子  ·  报错error: command ...·  1 年前    · 
喝醉的米饭  ·  可观测监控 Prometheus ...·  1 年前    · 
帅气的消防车  ·  在 Azure Boards ...·  1 年前    · 
高兴的眼镜  ·  ubuntu安装openmpi && ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

i am using android studio latest version in linux(elementary luna to be specific). I installed jdk, android studio and sdk successfully, android studio opens us perfectly and even i can work on my app. but when i bulid app it gives error 13: permission denied and it opens a black circle image png in new tab.

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

  • changing permissions with chmod:

    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,

    3.i also tried this,

    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.

    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" )

    -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 Client VM (build 23.25-b01, mixed mode, sharing)

    I'm running android studio 1.0.2 on ubuntu 14.04 (LTS) 32 bit and i had the same problem. 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'. 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.

    This problem is about insufficient authority. If you change your user as 'root' and you open android studio, this problem will be resolved. For ex;

    Open Terminal

    $ sudo -i

    [enter your password] : ********

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

    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. 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. I found out about the missing *.so files by running aapt outside the studio. 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

    The fsnotifier files and the 2 *.sh file in the first bin directory. 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. Running as root doesn't help when the problem is with files not being executable.

    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. same problem is solved by doing this.

    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.

    Then I edited that line in fstab appending exec, resulting in the options list 'user,defaults,exec' for that partition.

    I coould resolve the same issue by using the following shell command:

    chmod 755 -R android-studio
    

    You need to grant more privileges.

    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.

    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
            

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.