How to fix "couldn't follow symbolic link" in Android Studio? - android-studio

I'm now running an Android App project on Windows and running into the condition
Error:Could not list contents of
'D:\source\App\src\main\res\drawable'. Couldn't follow symbolic link.
after did the clean build.
Android Studio states the drawable file is a broken symbolic link.
I just check other related post online but still cannot figure out what does that mean, why is that happened, and how to fix it. Can anyone help to give me a clue to fix it?

Next time to save time you can run the following command:
find . -type l -exec test ! -e {} \; -delete

Still do not know the real reason but problem solved by re-checkout source.
Clean build did not work so I guess there's just something wrong in the project build-up steps.

Removing .bin did not work, but rm -rf node_modules && npm install did the trick.

Navigate to node modules folder of particular package, and delete the .bin folder
Eg:
Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
Could not list contents of '/home/centillion/Documents/CMC/cmc-mobile-repo/node_modules/react-native-image-slider/node_modules/.bin/flow'. Couldn't follow symbolic link.
For this case, navigate to node modules/react-native-image-slider/node modules and delete .bin folder and rerun.
NOTE: To view hidden folders, press CTRL + H

I have always resolved this issue by using
unlink followed by the path where it's not finding symbolic link.
example: unlink ./bin/uuid

Related

Gradle Error: Path is not a readable directory for an Android Project saved in OneDrive

I tried to use a OneDrive folder to store my Flutter project [Windows 10, Android Studio]. I then made edits to it on another machine [same configurations]. The project compiled fine on the first machine initially and on the second one after the changes. Running it on the first machine again after the changes I get the below error:
Execution failed for task ':app:processDebugResources'.
Path "build/[package]/intermediaries/compiled_local_resources" is not a readable directory.
I've tried a number of solutions mentioned in similar, though not equivalent issues:
Updating Android Studio
Running Android Studio as Administrator
Removing the [package] from my dependencies (this resulted in a
different package being identified in the error message).
Pressing File -> Invalidate Caches / Restart...
Commenting out
"org.gradle.jvmargs=-Xmx1536M" in gradle.properties
Doing:
cd android
gradlew clean
None of this worked.
I had the same problem today:
Path "build/[package]/intermediaries/compiled_local_resources/debug/out" is not a readable directory.
I was able to fix this issue by deleting the .gradle and rebuilding the project.
All I did was create the (empty) directory that it was looking for and it built fine afterward.
mkdir -p compiled_local_resources/debug/out
I had the same issue, came out of no where and it really shouldn't make the build fail... but all I did was create the (empty) directory that it was looking for and it built fine afterwards.
In the end the only thing that worked for me was pushing the project up to a Git remote and cloning it from there into another (local) directory.
[not sure this counts as a solution but nothing else worked for me after a long agonising search so hopefully it helps someone]
I know the OP had Windows, but if it helps anyone else in the future:
On Mac OS I discovered (the hard way) that Android Studio and Flutter do not play nice with being stored in iCloud! I noticed that some files weren't available locally and that's what was causing the problem for me. I moved my project out of iCloud (forcing it to download the missing files forever) and then it was fine.
Deleting the android/.gradle folder worked for me.
+1 also to the #1 answer (Vadow). As I do not have 50 points yet was not able to add this as a comment, so will have to post separately.
Like the OP, I have two machines - and got into trouble (Synology Drive). Vadow's solution worked for me, but I also had to do:
Flutter Clean
Flutter Pub Get
on the terminal and from within the project directory to get things follow back up and running.
Thank you Stackoverflow, and thank you Vadow!

Node on Windows error: "Source Path Too Long"

Explanation :
There are about 15 subfolders in the node_modules directory. When going to perform any operation (deleted, moved or renamed) it popup below message.
Error message:
The source file name(s) are larger than is supported by the file
system. Try moving to a location which has a shorter path name, or try
renaming to shorter name(s) before attempting this operation.
Screenshot :
sub folder inside npm_modules directory.
node_modules\gulp-connect\node_modules\gulp-util\node_modules\dateformat\node_modules\meow\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-expression-parse\node_modules\spdx-license-ids\spdx-license-ids.json
Tried so far:
I also tried to delete the folder (node_modules) using command prompt using command rmdir <dirname> /S but did not work as well.
There is a way to do this is that go into subfolder after subfolder, renaming each folder to something short like 'b'. Eventually the path is short enough to allow deletion. This will waste quite a bit of time.
Is there any efficient way to delete this node_modules directory?
Newest versions of npm fix this issue flattening the path: https://github.com/npm/npm/issues/3697.
Try
D:\vms\fe> robocopy d:\path\to\temp\dir node_modules /purge
to remove the nested dirs.
Update
As pointed by Coding Professor, another option is use rimraf util (which basically calls rm -rf):
> npm install -g rimraf
> rimraf node_modules
For the record, and because of the release of a newish open-source project released by Microsoft, you can easily delete paths that are too long using WinFile (which was introduced in WinXP).
Sometimes you have to go "Back to the Future". This can delete paths too long on Microsoft networks share as well.
WinFile (compiled for Win10) available here https://github.com/Microsoft/winfile
To find many paths that are too long and automate a fix, I recommend Path Too Long Auto Fixer - a free demo is available.

How to Delete node_modules - Deep Nested Folder in Windows

Upon trying to remove the node_modules directory created by npm install:
The source file name(s) are larger than is supported by the file
system. Try moving to a location which has a shorter path name, or try
renaming to shorter name(s) before attempting this operation
I also tried shift + delete and still having the same issue.
Since this the top google result, this is what worked for me:
Update, if you have npm v5, use npx:
npx rimraf ./**/node_modules
Otherwise install RimRaf:
npm install rimraf -g
And in the project folder delete the node_modules folder with:
rimraf node_modules
If you want to recursively delete:
rimraf .\**\node_modules
[ http://www.nikola-breznjak.com/blog/nodejs/how-to-delete-node_modules-folder-on-windows-machine/ ]
I've simply done that by using Winrar, this may seem a strange solution but working very well.
right click on node_modules folder
select Add to archive ... from the menu.
Winrar dialog opens
just check the option delete files after archiving
Don't forget to delete the node_modules.rar after finished.
[UPDATE]
This also works with 7Zip
DELETE only by using DOS command without any installation:
Create an empty folder "test" on C or D drive and use following DOS command
robocopy /MIR c:\test D:\UserData\FolderToDelete > NUL
After completing above command, your folder will be empty, now you can delete the folder.
Don't worry your test folder will always be empty, so you can delete it at any time.
I used GitBash to remove de folder!
rm -r node_modules
It took a while to delete everything, but worked for me!
You can use Git Bash to remove the folder:
example:
c:\users\olefrank\projects\mynodeproject
rm -rf /c/users/olefrank/projects/mynodeproject
Please save yourself the need to read most of these answers and just use npx rather than trying to install rimraf globally. You can run a single command and always have the most recent version with none of the issues seen here.
npx rimraf ./**/node_modules
Try Visual Studio Code
After trying many solution i find this one is pretty simple.
just open the project in Visual code and delete it. the UI may freeze for some seconds but it will definitely works.I test using many large size node_modules folder with it
Thanks
Delete Deep Netsted Folder like node_modules in Windows
Option 1
Delete using rimraf NPM package
Open command prompt and change your directory to the folder where
node_modules folder exists.
Run
rimraf node_modules
Missing rimraf ERROR then Install
npm install rimraf -g
When the installation completes, run
rimraf node_modules
Option 2:
Detele without installing anything
Create a folder with name test in any Drive
robocopy /MIR c:\test D:\UserData\FolderToDelete > NUL
delete the folder test and FolderToDelete as both are empty
Why this is an issue in windows?
One of the deep nested folder structure is node_modules, Windows can’t delete the folder as its name is too long. To solve this, Easy solution, install a node module RimRaf
I think this was not mentioned before. but the best way to delete unwanted node_modules is to install an utility called npmkill.
Installation:
From your terminal:
npm i -g npkill
And to use it:
From your terminal:
npkill
or alternatively, you can directly use it without installation by writing:
npx npkill
You will then be presented with a list of projects, and by hitting space bar you can delete their node_modules.
simple just run for windows I haven't tested it for other operating systems
rm -r node_modules
in fact, you can delete any folder with this.
like rm -r AnyFolderWhichIsNotDeletableFromShiftDeleteOrDelete.
just open the gitbash move to root of the folder and run this command
Hope this will help.
Thanks,
Ajay Kotnala
On Windows Platform the simplest way is to use the terminal.
Please Run the command RMDIR /Q/S foldername to delete the folder and all of its subfolders.
Example: RMDIR /Q/S node_modules
The Above Command deletes node_modules folder and its subfolders.
For information please visit this https://www.ghacks.net/2017/07/18/how-to-delete-large-folders-in-windows-super-fast/
You can use Git Bash to remove the folder:
example:
c:\users\stu\projects\mynodeproject
rm /c/users/stu/projects/mynodeproject -rfd
I had a similar problem and RD didn't work, for some unknown reason.
NPM can get rid of its own mess though, so if you do npm uninstall [module-name] for each directory in node_modules, you'll get rid of them.
(I'll look up how to batch loop this later, for those who have lots of dependencies.)
npm install -g remove-node-modules
cd to root and remove-node-modules
or remove-node-modules path/to/folder
Source:
https://github.com/j-quelly/node-cleanup
I just do del node_modules inside my project folder on PowerShell, it will ask you if you want to remove it and its children folder, just hit 'Y' and that's it
Just use powershell..
Run powershell and cd to the parent folder and then:
rm [yourfolder]
as in:
rm node_modules
Tried everything but didn't work. All the above methods did nothing. At last I was able to delete via VSCode.
Just Open your root folder with VSCode.
Select node_modules folder and delete.
Profit. (It will take few milliseconds to delete.)
On Windows, using Total Commander all you have to do is select the folder click shift + delete . Don't forget about the shift key.
Any file manager allow to avoid such issues, e.g Far Manager
I made a Windows context item to fast delete node_modules or other folders.
I use it when Windows doesn't delete a folder because of some invalid chars in the directory path.
HOW TO INSTALL?
Install rimraf => npm install rimraf -g
Create a new file named delete.bat, set the content as below and copy it into c:\windows\system32\
delete.bat:
#ECHO OFF
ECHO.
ECHO %CD%
ECHO.
ECHO Are you sure to delete the folder with Rimraf?
PAUSE
SET FOLDER=%CD%
CD /
rimraf "%FOLDER%"
rem DEL /F/Q/S "%FOLDER%" > NUL
rem RMDIR /Q/S "%FOLDER%"
EXIT
Run fast-delete.reg file to import into registry.
Done!
The PowerShell way:
PS > rm -r -force node_modules
# The same, but without using aliases
PS > Remove-Item -Recurse -Force node_modules
And if you want to delete every node_modules in sub directories:
Note Potentially dangerous as it deletes recursively, be sure of what you're doing here
PS > dir -Path . -Filter node_modules -recurse | foreach {echo $_.fullname; rm -r -Force $_.fullname}
I needed to clean up an entire Projects directory for backup purposes, so I installed rimraf and ran this at the root dir (inside a git bash prompt):
find . -name "node_modules" -type d -prune -exec rimraf '{}' +
Very effective, truly recursive (avoids children node_modules) and fast on windows (thanks to rimraf).
Sources:
https://rtmccormick.com/2018/01/10/clear-node-modules-folders-recursively-mac-linux/
The accepted answer in this question that suggests rimraf but lacks in the recursive aspect
One solution that I use:
(I would prefer to avoid installing a new extension (rimraf) when working with CI environments.)
A) Rename packages.json to something else. B) Specially on CI - after npm install, I usually remove the file instead of renaming it, but if you need it, you don't have to do this. That's your choice.
run npm init - this will create an empty packages.json file (no dependencies)
run npm prune - this will match node_modules with the dependencies section of packages.json - which is now empty as the result of step #2.
If you have chosen #1.A. step, delete the newly created packages.json, and rename original packages.json back to its original name.
Its too easy.
Just delete all folders inside node_modules and then delete actual node_module folder.
This Works for me. Best luck....
Sometimes, even if you install rimraf globally you can have a local rimraf dependency (SASS usually have it). In this case I would run following commands:
Follow first 2 steps as usagidon recommended, if you have issues or errors try
npm uninstall rimraf & rimraf node_modules
this will delete local rimraf and use the global one
On Windows my go to solution is using the rmdir command:
rd /S .\node_modules\
If it fails the first time -- try one more time.
Also check if you have running scripts currently using the modules (npm run serve or similar).
From this looks of this MSDN article, it looks like you can now bypass the MAX_PATH restriction in Windows 10 v1607 (AKA 'anniversary update') by changing a value in the registry - or via Group Policy
I'm on windows 10 and I could'nt delete folders with message "directory not emtpy". Neither rimraf nor rm -rf worked.
Copying an empty text file to every single folder did the trick - I was able to delete the complete node_modules folder.
Not exactly related, but as this is the first post I found in my search for a similar solution I think it's worth posting here.
I was running into permission issues on Windows 10 trying to delete my node_modules folder after a failed attempt at installing electron-redux. It seems electron-redux added #types to my node_modules, which had incorrect permissions set up.
rimraf did not work as it still ran into permission issues.
I ended up renaming node_modules then a simple delete worked.
Okay so my problem was that i had .bin folder inside node_modules and i wasn't able to delete that, I tried all the above solutions for the same but nothing worked.
Error which was repeating was "u do not have permission to delete the folder or its been used by some other program".
Solution that i found "I had Antivirus installed on my pc ,which was unknowingly using the files from node_modules folder".
I uninstalled the antivirus or u can change permission setting from antivirus setting option (depends on which antivirus u have).Now i am able to delete node_modules folder.

Android Studio: Failure [INSTALL_FAILED_INVALID_APK]

I have the following problem when running my app:
Waiting for device.
Target device: samsung-gt
Uploading file
local path: C:\Users\kwmaster\AndroidStudioProjects\Count500\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/xxxxx
Installing xxxxx
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/xxxxx"
pkg: /data/local/tmp/xxxxx
Failure [INSTALL_FAILED_INVALID_APK]
Why did it not let me install the apk???
In my case (I have a rooted device) and when I rooted, something happened with my permission of /data/local/tmp and they have been changed, so adb can't get access temp file.
How I solved it:
Install RootExplorer
Create new tmp folder on SD card
Long press on tmp folder, and select "Link to this folder" (last option in menu)
Go to /data/local/ and tap button "Create link" from bottom
For those that will encounter this problem in the future just go in build.gradle and put at applicationId just put a name with a point betwen 2 words.Example: First.Test
As AndroidGuy thought there was a problem in build.gradle - the gradle version ws wrong.
I also have changed in the settings to use the default gradle wrapper and not the local stuff!!!
I was also having this problem because of changing package name. So do check your package and sub packages names and also in manifest file where activities defined with package name.
when I cd /data/local/tmp, I found my project name in the folder.
So I solved the problem as follows:
adb shell
cd /data/local/tmp
rm -r your project name. For example: rm com.example.pc002.intenttest1
I was facing a similar issue. I fixed it by first closing the Android Studio project and then deleting the .gradle folder within the project.This, forced Android Studio to rebuild it when I opened it again, and then it fixed the issue.

Linux: Where is package installed after installing from .bin

Im a newbie to linux so please dont get annoyed with this basic question.
I searched internet about it but all i could find was the installation instructions.
Can someone tell me where is the program installed when installing from .bin file?
Thanks in advance.
You can use find and Xargs commands for locate files that have been installed. You can use for instance find directory -nmin Number_of_minutes to see which files were modified in some directory in last Number_of_minutes. Xargs is a command "used to build and execute command lines". You can combine that twho command to list the files, as shown in find and Xargs using, but you try it first in root directory or you can limit to /bin.

Resources