Cannot run or debug seed project angular-native-seed


#1

I’ve worked through the steps described to get started with code sharing

However I cannot get the project to run on a connected device (I’ve tried 2 android devices: tablet and phone)

Looking at other issues, I’ve tried deleting node_modules, platforms and hooks and re-installing.

I’ve also started again by cloning the project from git 3 times, but still cannot get the seed project to run.

On the first device I get a message Hook skipped because either bundling or livesync is in progress. Maybe that’s normal - it’s non fatal.

The fatal error appears to be “cannot remove previously installed assets”, but the app does actually open on the first device, however, it displays an error relating to resolving home.component.css.

The home component doesn’t have a css file but does have a scss file which is referenced in home.component.tns

styleUrls: [’./home.component.scss’]

Further info below:

Successfully installed on device with identifier ‘110914PE5078871’.
Successfully transferred all files.
Refreshing application…
Successfully synced application com.domain.project on device 110914PE5078871.
Skipping prepare.
ActivityManager: Start proc com.domain.project for activity com.domain.project/com.tns.NativeScriptActivity: pid=17538 uid=10109 gids={50109, 1028, 1015, 3003}
D/JS: AssetExtraction(17538): Can’t remove previously installed assets in /data/data/com.domain.project/files/app
Successfully transferred app.gradle.Refreshing application…
Successfully synced application com.domain.project on device 110914PE5078871.
ActivityManager: Start proc com.domain.project for activity com.domain.project/com.tns.NativeScriptActivity: pid=17668 uid=10109 gids={50109, 1028, 1015, 3003}
D/JS: AssetExtraction(17668): Can’t remove previously installed assets in /data/data/com.domain.project/files/snapshots/x86
JS: ns-renderer: ERROR BOOTSTRAPPING ANGULAR
JS: ns-renderer: Could not resolve /data/data/com.domain.project/files/app/app/home/components/home/home.component.css. Looked for: /data/data/com.domain.project/files/app/app/home/components/home/home.component.css.
JS:
JS: Error: Could not resolve /data/data/com.domain.project/files/app/app/home/components/home/home.component.css. Looked for: /data/data/com.domain.project/files/app/app/home/components/home/home.component.css.
JS: at FileSystemResourceLoader.resolve (file:///data/data/com.domain.project/files/app/tns_modules/nativescript-angular/resource-loader.js:33:19) []

On the second device, I get

Unable to apply changes on device: 37b59983. Error is: The package archive file is invalid…

tns doctor

says there are updates for tns-core-modules, tns-android, tns-ios

I’ve run npm update after updating these to 4.1.0, 4.1.3 nad 4.1.1 respectively in the nativescript package.json

No issues were detected.
√ Your ANDROID_HOME environment variable is set and points to correct directory.
√ Your adb from the Android SDK is correctly installed.
√ The Android SDK is installed.
√ A compatible Android SDK for compilation is found.
√ Javac is installed and is configured properly.
√ The Java Development Kit (JDK) is installed and is configured properly.
√ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
√ Getting NativeScript components versions information…
√ Component nativescript has 4.2.0-2018-06-29-11848 version and is up to date.
√ Component tns-core-modules has 4.1.0 version and is up to date.
√ Component tns-android has 4.1.3 version and is up to date.
√ Component tns-ios has 4.1.1 version and is up to date.

npm run android now gives

Unable to apply changes on device: 37b59983. Error is: spawn gradlew.bat ENOENT.

Following also gives the error above: tns debug android --device 37b59983

Could it be that I have issues with both my Android devices, is there an issue with the seed project, or have I not followed the instructions carefully enough?

Thanks.


#2

Did you try the latest nativescript-schematics for Angular?


#3

Would that be relevant to new projects or components only rather than trying to run the pre-prepared seed project? (I haven’t edited or added anything to the seed project)


#4

I’ve still not been able to run the seed project for code sharing between web and native, but can confirm that I can create and run new nativescript projects with or without nativescript-schematics.

Latest error in seed project is as follows

Preparing project…
Executing before-prepareJSApp hook from C:\Users\Alex\Development\NativeScript\angular-native-seed\nativescript\hooks\before-prepareJSApp\nativescript-dev-webpack.js
No manifest found in C:\Users\Alex\Development\NativeScript\angular-native-seed\nativescript\app\App_Resources\Android\AndroidManifest.xml
Unable to apply changes on device: 110914PE5078871. Error is: cp: no such file or directory: C:\Users\Alex\Development\NativeScript\angular-native-seed\nativescript*app*\App_Resources.

App_Resources lives under the nativescript folder directly, not within app. I’ve spent a short amount of time trying to track that down, but the number of hours I’ve spent on this is already too much, so unfortunately for now I’m giving up on the code sharing dream, will re-focus on my web project, and will rethink mobile app development at a later time either as an independent app or hopefully with a lot of code re-use that doesn’t involve a lot of copy-and-paste.

Has anyone else been able to code share (just up to “Getting Started”)?