且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android Studio-任务':app:compileDebugJavaWithJavac'的执行失败

更新时间:2023-01-25 15:18:38

经过长时间的搜索,我终于找到了原因和解决方法.

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

原因:

该问题是由自动安装的ntfs硬盘引起的.我将所有项目文件都保存在一个ntfs分区中,但是Ubuntu将该ntfs分区识别为可移动设备(例如USB).

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 (e.g. USB).

解决方案:

1.运行sudo umount <name of the drive (e.g. /dev/sda1)>卸载有问题的驱动器.
2.运行sudo cp /etc/fstab /etc/fstab.backup备份fstab.
3.使用任何文本编辑器打开/etc/fstab.

在这里,找到指定您的ntfs分区的行. 该行应如下所示:

Solution:

1. Run sudo umount <name of the drive (e.g. /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

defaults,umask=007,gid=46之后添加errors=remount-ro,uid=1000
因此,更改后,它将如下所示:

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. 重新启动系统

现在,gradle不再应该给出执行失败的错误.

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