I noticed when I run ionic cordova build --release I get those errors:
An error ocurred while reading directories:
Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\js'
An error ocurred while reading directories:
Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\css'
An error ocurred while reading directories:
Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\img'
Running command: "C:\Program Files\nodejs\node.exe" C:\nodejs\myproject\hooks\after_prepare\uglify.js C:\nodejs\myproject
processFiles err: Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\js'
processFiles err: Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\css'
processFiles err: Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\img'
processFiles err: Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\build'
Again, Iām pretty sure the problems comes from the fact I do not have a .\platforms\android\assets
I donāt have a .\platforms\platforms.json either. I think there is something ābrokeā in my project.
The different structure in platforms is probably because the newer cordova-android versions have a different folder structure. Can you find the assets folder somewhere else, in platforms/android/app for example? Then you might just have to fork and modify the libraries you are trying to use.
No, the tools you are trying to use just donāt work together - the āminifyā stuff assumes the files are in different locations than they actually are, as cordova-android was updated only a few months ago.
As @thesourav says, you should fix the paths. Is there a www in the assets folder you do have? Then update the script to point to that and see if this fixes things.
Just one thing to add what @Sujan12 said,
your uglify.js and platforms class.js would look like
switch (platform) {
case 'android':
wwwPath = path.join(platformPath, platform, 'app','src','main','assets', 'www');
console.log(wwwPath); //You can add console.log to make sure your path is correct
break;
case 'ios':
case 'browser':
case 'wp8':
case 'windows':
wwwPath = path.join(platformPath, platform, 'www');
break;
default:
console.log('this hook only supports android, ios, wp8, windows, and browser currently');
return;
I tried to change those script to my assets path, it works!
The strange part is I still get an error during release building
Running command: "C:\Program Files\nodejs\node.exe" C:\nodejs\myproject\hooks\after_prepare\ionic-minify.js C:\nodejs\myproject
WARN: The use of the --release flag is deprecated!! Use --minify instead!
Starting minifying your files...
An error ocurred while reading directories:
Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\js'
An error ocurred while reading directories:
Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\css'
An error ocurred while reading directories:
Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\img'
Running command: "C:\Program Files\nodejs\node.exe" C:\nodejs\myproject\hooks\after_prepare\uglify.js C:\nodejs\myproject
should I remove ionic-minify module? Currently I have 2 minify hooks: ionic-minify.js and uglify.js
Somewhere a script still search for the old assets path
can you elaborate more why its not working at your side ? if you install the latest cordova-uglify, it already handle 2 possibilities of platform asset location :
my question is which command you use to build your apk ? is it include --release parameter ? if not, then you should set alwaysRun parameter to true in uglify-config.json.
I have just install and test cordova-uglify successfully.