简体   繁体   中英

Android Studio - Execution failed for task ':app:compileDebugJavaWithJavac'

I am running Ubuntu 16.04 with Android Studio 2.3.2 and Gradle 3.3. i just downloaded android studio and made a project. The target of the project is Android KitKat. When I try to run it, it gives and error saying "Execution failed for task ':app:compileDebugJavaWithJavac'..."

I just created this project and have not added any code.

Full Error Screenshot: 错误信息

After a long search, I finally found the cause and the solution.

Cause:

The problem was caused by an automatically mounted ntfs hard disk. I saved all my projects files in an ntfs partition, but Ubuntu recognized the ntfs partition as a removable device (eg USB).

Solution:

1. Run sudo umount <name of the drive (eg /dev/sda1)> to unmount the drive in problem.
2. Run sudo cp /etc/fstab /etc/fstab.backup to make a backup of fstab.
3. Open /etc/fstab with any text editor.

Here, find the line that specifies your ntfs partition. The line should look like this:

 UUID=<16 digit uuid> <something> ntfs defaults,umask=007,gid=46 0 0 

Add errors=remount-ro,uid=1000 after defaults,umask=007,gid=46
So after the change, it will look like this:

 UUID=<16 digit uuid> <something> ntfs defaults,umask=007,gid=46,errors=remount-ro,uid=1000 0 0 
  1. Reboot your system

Now, gradle should not give the execution failed error anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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