Nativescript - build error under Android - nativescript

Getting the following error when doing a production build on the Android.
Debug build works - but web-packing is disabled.
I've get web-packing enabled.
The build script was working before I upgraded to 3.4 - something changed?
`FAILURE: Build failed with an exception.
Where:
Build file '/Users/asrock/Documents/publish-android/platforms/android/build-tools/android-static-binding-generator/build.gradle' line: 281
What went wrong:
Execution failed for task ':asbg:generateBindings'.
No /Users/asrock/Documents/publish-android/platforms/android/build-tools/android-static-binding-generator/bindings.txt was found after runAstParser task was ran! Check to see if there are any .js files inside /Users/asrock/Documents/publish-android/platforms/android/app/src/main/assets/app`

I had the same error, resolved with upgrade:
Component nativescript has 4.0.0 version and is up to date.
Component tns-core-modules has 4.0.0 version and is up to date.
Component tns-android has 4.0.0 version and is up to date.
Component tns-ios has 4.0.1 version and is up to date.
nativescript-angular │ 5.3.0 │

Related

No version of NDK matched the requested version in nativescript 7.0.11

After updating nativescript to latest version 7.0.11 I created a new project and just run it using tns run android and I get this error
No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.3.6528147
Then based on update gradle I tried to change gradle version in ~\platforms\android\build.gradle like
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4' // tried for 4.0.0 , 4.1.0 also
...
...
}
for both 4.0.0,4.1.0 I'm getting different errors And that's not worth showing here.
how to solve this issue ?

NativeScript | Can't run Android app: Please fix the version conflict either by updating version 11.4.0 of the google-services plugin

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the
google-services plugin (information about the latest version is available at
https://bintray.com/android/android-tools/com.google.gms.google-services/)
or updating the version of com.google.android.gms to 11.4.0.

Getting error `spawn ./gradlew ENOENT` when I run `tns build android`

I'm starting with nativescript. I'm trying to build a hello world application to test it. However, when I run it, I get an exit status 127 for command not found.
Here is how I try to build:
[ahmed#localhost hello]$ tns build android
Executing before-shouldPrepare hook from /home/ahmed/PycharmProjects/hello/hooks/before-shouldPrepare/nativescript-dev-webpack.js
Skipping prepare.
Building project...
Gradle build...
spawn ./gradlew ENOENT
[ahmed#localhost hello]$ echo $?
127
[ahmed#localhost hello]$
If I run tns doctor, everything seems to be ok
[ahmed#localhost hello]$ tns doctor
✔ Getting environment information
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 5.1.0 version and is up to date.
✔ Component tns-core-modules has 5.1.1 version and is up to date.
✔ Component tns-android has 5.1.0 version and is up to date.
✔ Component tns-ios has 5.1.0 version and is up to date.
[ahmed#localhost hello]$
What did I miss?
I ran tns install to install dependencies. That solved my issue.
I was trying several things, the one that worked fort me, was:
ns clean
ns install

Getting the following build error under iOS

I'm using latest NS, TNS and tns-ios and getting the following error
node_modules/tns-core-modules/ui/styling/gradient.d.ts(7,25): error TS6143: Module '../../css/parser' was resolved to '/Users/asrock/Documents/test/node_modules/tns-core-modules/css/parser.js', but '--allowJs' is not set.
I cleaned my project - and now the typescript compiler fails and exit.
Using TS 2.4.2.
NS 4.1, TNS-CORE 4.1 and TNS-IOS 4.1
This is the tns build iOS output
`
Support for Node.js ^6.0.0 is deprecated and will be removed in one of the next releases of NativeScript. Please, upgrade to the latest Node.js LTS version.
Support for macOS 10.12 is deprecated and will be removed in one of the next releases of NativeScript. Please, upgrade to the latest macOS version.
Executing before-prepare hook from /Users/asrock/Documents/test/hooks/before-prepare/nativescript-dev-sass.js
Found peer node-sass
Executing before-prepare hook from /Users/asrock/Documents/test/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.4.2
node_modules/tns-core-modules/ui/styling/gradient.d.ts(7,25): error TS6143: Module '../../css/parser' was resolved to '/Users/asrock/Documents/test/node_modules/tns-core-modules/css/parser.js', but '--allowJs' is not set.
TypeScript compiler failed with exit code 1`
I experienced that error and I managed to fixed it. If you're using nativescript-angular you need to upgrade your angular version to 6 and it's dependencies.
You can follow this link https://www.nativescript.org/blog/upgrading-to-nativescript-webpack-0.12.0. Nativescript-core or nativescript-angular.
Hope this helps! Happy coding.
Needed typescript#2.7.2.
Nice if NS printed a message somewhere.

Nativescript - Error: more than one library with package name (Android)

I'm getting the following error when I build under Android
Error: more than one library with package name 'com.google.android.gms.license'
How can I fix this?
I understand this has to do with some incompatibility with Android sdk library - but I didn't update anything explicitly - are libs being auto updated in the background?
If your tns-android version is 4+ then you can try with tns platform add android#3.4
It worked for me.

Resources