NathanWalker / angular-seed-advanced

Advanced Angular seed project with support for ngrx/store, ngrx/effects, ngx-translate, angulartics2, lodash, NativeScript (*native* mobile), Electron (Mac, Windows and Linux desktop) and more.
MIT License
2.26k stars 451 forks source link

run start.android (mergeF0DebugResources) #460

Closed unit-cesar closed 6 years ago

unit-cesar commented 6 years ago

I'm submitting a ...

[ x] bug report => search github for a similar issue or PR before submitting

Current behavior I just cloned from github and did not change anything, and... npm run start (Works perfect) npm run start.desktop.windows (Works perfect) But... npm run start.android (Not working) npm run clean (Not working) Deleting folder: nativescript/platforms (Not working too)

Expected behavior With "npm run start.android" run on the emulator. I made the HelloWorld of the NativeScript manual at the same folder level (C:\www\Projetos\x-Testes\NativeScript\CrossCode\HelloWorld), and it works perfect. But it is not working with Advanced Angular Seed project (C:\www\Projetos\x-Testes\NativeScript\CrossCode\angular-seed-advanced).

Minimal reproduction of the problem with instructions [1] FAILURE: Build failed with an exception. [1] [1] What went wrong: [1] Execution failed for task ':mergeF0DebugResources'. [1] > Error: Failed to crunch file C:\www\Projetos\x-Testes\NativeScript\CrossCode\angular-seed-advanced\nativescript\platforms\android\build\intermediates\exploded-aar\com.android.support\appcompat-v7\26.0.0-alpha1\res\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png into C:\www\Projetos\x-Testes\NativeScript\CrossCode\angular-seed-advanced\nativescript\platforms\android\build\intermediates\res\merged\F0\debug\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png [1] [1] Try: [1] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. [1] [1] BUILD FAILED [1] [1] Total time: 25.137 secs [1] Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1. [1] cd nativescript && tns run android --emulator exited with code 0 --> Sending SIGTERM to other processes.. [0] gulp build.tns.watch exited with code 1 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! angular-seed-advanced@0.0.0 start.android: npm run nativescript-install && gulp build.tns && concurrently --kill-others "gulp build.tns.watch" "cd nativescript && tns run android --emulator" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the angular-seed-advanced@0.0.0 start.android script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\CesarAzevedoJr\AppData\Roaming\npm-cache_logs\2017-09-03T00_40_37_708Z-debug.log

What is the motivation / use case for changing the behavior? After changing the project folder from 'C:\www\Projects\x-Tests\NativeScript\CrossCode\' to 'C:\', it worked correctly. When this error appears, is it possible to show a message to try again in a different folder??? I don't know what happened, but I still can not generate in this folder, I deleted the folder and cloned again and it gives the same error, but if I do in another folder it works. It took me a long time to find the answer, an alert message would have helped me!

Please tell us about your environment: OS: Windows 10 Console: cmder Emulator: AVD from Android Studio (Nexus 5 - Android 6.0 - API level 23)

angular/cli: 1.2.0 node: 6.11.0 os: win32 x64 angular/animations: 4.1.3 angular/common: 4.1.3 angular/compiler: 4.1.3 angular/core: 4.1.3 angular/forms: 4.1.3 angular/http: 4.1.3 angular/platform-browser: 4.1.3 angular/platform-browser-dynamic: 4.1.3 angular/router: 4.1.3 angular/service-worker: 1.0.0-beta.16 angular/compiler-cli: 4.1.3 angular/platform-server: 4.1.3

npm -v 5.3.0

psmontte commented 6 years ago

Your project structure is too deep. Try this also:

delete nativescript\app folder
cd nativescript
tns platform remove android
tns platform add android

cd..
npm run start.android
unit-cesar commented 6 years ago

Thanks for your tip, but it still does not fix. For now I've tried too:

//delete "angular-seed-advanced" folder //New clone in same path git clone https://github.com/NathanWalker/angular-seed-advanced.git cd angular-seed-advanced\ //Install npm install //Run npm run start.android <<<Error

Then...

//delete "nativescript\app" folder //Remove Android cd nativescript\ tns platform remove android //Add android tns platform add android //Run cd.. npm run start.android <<<Error

============================================= npm cache clean --force npm cache verify npm config set unsafe-perm=true -g //Close AVD and "adb.exe (32 bits)" in Windows Task Manager //delete "angular-seed-advanced" folder //New clone git clone https://github.com/NathanWalker/angular-seed-advanced.git cd angular-seed-advanced\ //Install npm install //Run npm run start.android <<<Error //delete "nativescript\app" folder cd nativescript\ //Remove Android tns platform remove android //Add android tns platform add android //Run cd.. npm run start.android <<<Error

=============================================

//Upgrade npm 5.4 to 5.4.1 //By powershell as recomended: https://github.com/felixrieseberg/npm-windows-upgrade //Return to Cmder npm cache verify npm cache clean npm cache clean --force npm cache verify //delete "angular-seed-advanced" folder //New clone git clone https://github.com/NathanWalker/angular-seed-advanced.git //Install cd angular-seed-advanced\ npm install //Run npm run start.android <<<Error //Run in PowerShell (admin) npm run start.android <<<Error

==== All run as Administrator level. I also rebooted the PC several times.

It seems obvious that it is not directly related to the project. I think it's about npm or nodeJS, about permission or deadlock due to active processes.

I am trying several other options, I will soon return with the result. Thanks for more tips!

psmontte commented 6 years ago

Test on a fresh Virtual Machine. Check installation guide here: http://docs.nativescript.org/angular/tutorial/ng-chapter-0 http://docs.nativescript.org/angular/start/ns-setup-installer

unit-cesar commented 6 years ago

The reason for this is the size of the path (max 248), after configuring the OS the commands work perfect for me.

"Starting in Windows 10, version 1607, MAX_PATH limitations have been removed..." But you have to opt for it and enable long path to fix, see how:

//In Registry Editor navigate to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

//Change LongPathsEnabled = 0 //To LongPathsEnabled = 1

If you don’t see the value listed, you’ll need to create it, choosing New > DWORD (32-bit) Value, and then naming the new value "LongPathsEnabled" and value "1".

More details and change by Local Group Policy Editor: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/ and... https://mspoweruser.com/ntfs-260-character-windows-10/

_ About the Maximum File Path Length Limitation in Windows: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

More tips There are other options, but I prefer to change the OS to avoid errors in other projects, below are links with tips for: Symbolic links, or Mount a folder as a drive, or Change variable "buildDir" from build.gradle, but I prefer to change the OS, but these tips try to fix this same issue: https://stackoverflow.com/questions/1880321/why-does-the-260-character-path-length-limit-exist-in-windows https://stackoverflow.com/questions/41267005/failed-to-crunch-file-android-studio-appmergedebugresources https://stackoverflow.com/questions/30764604/execution-failed-for-task-appmergedebugresources-crunching-cruncher-png-fa https://github.com/googlesamples/android-play-location/issues/57

@psmontte, thank you for your attention!