NativeScript/nativescript-sdk-examples-ng

Error occurred while trying tns run android

Closed this issue ยท 13 comments

Dears

whenever i try to run this app i get an error
below is the error details


Executing before-liveSync hook from /FakePath/nativescript-sdk-examples-ng/hooks/before-liveSync/nativescript-angular-sync.js
Skipping prepare.
Building project...
Gradle build...
+ applying user-defined configuration from /FakePath/nativescript-sdk-examples-ng/app/App_Resources/Android/app.gradle
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
Configuration 'debugCompile' in project ':app' is deprecated. Use 'debugImplementation' instead.
+ adding nativescript runtime package dependency: nativescript-optimized
+ adding aar plugin dependency: /FakePath/nativescript-sdk-examples-ng/node_modules/tns-core-modules/node_modules/tns-core-modules-widgets/platforms/android/widgets-release.aar

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.

All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s
Unable to apply changes on device: emulator-5554. Error is: Command ./gradlew failed with exit code 1.
Executing after-watch hook from /FakePath/nativescript-sdk-examples-ng/hooks/after-watch/nativescript-dev-typescript.js


Any thoughts on this issue?

regards

I had just git cloned the repo and ran the tns run android command and got the exact same error

Node v6.13.0 - Win10 - NativeScript v3.4.3

Presently learning more about Angular (v5) animations inside NativeScript. Would love to play with a working version of this project ;)

  • 1

i also having same error.
i'm using tns cli 3.4.2

Go into your package.json file and change "tns-android":

"tns-android": {
"version": "3.4.1"
}

Hi all,
The nativescript-sdk-examples-ng application refers next version of tns-core-modules, ios and android runtime, which requires @next CLI as well. This is needed because the app is used for testing the upcoming release.
As you have already discussed, to build the project with the official CLI you should change the versions in the package.json file as follow:

{
 ..................
  "nativescript": {
    "id": "org.nativescript.nativescriptsdkexamplesng",
    "tns-ios": {
      "version": "3.4.1"
    },
    "tns-android": {
      "version": "3.4.2"
    }
  },
  "dependencies": {
   ..................
    "tns-core-modules": "3.4.0",
   ..................
  },
  
 ..............
}

This issue still facing in build.... Any solution on this??

Hi @pujareaditya,
Please provide more info about the exact steps, which you are using while building the app. Also, attache the error log from the console.
I tested the Android and iOS build on my side after making a clean git clone and it was built correctly.

Hello same problem here as soon as I run
tns update next
My project wouldn't run.

Log : problem occurred configuring project ':app'.
> All flavors must now belong to a named flavor dimension. Learn more at
https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

Information and versions :

  • cmd -> tns info

    nativescript โ”‚ 3.5.0-2017-12-13-10254 โ”‚ 4.1.1 โ”‚ Update available
    tns-core-modules โ”‚ 4.2.0-2018-06-21-01 โ”‚ 4.1.0 โ”‚ Up to date
    tns-android โ”‚ 4.2.0-2018-06-18-02 โ”‚ 4.1.3 โ”‚ Up to date

  • cmd -> node -v
    v10.4.1

Removing and adding android platform solved this for me.

Thanks @TheOnlyMatt , that's also what worked for me. In particular:

$ rm -rf platforms/android/
$ tns build android

I just want to share this, in my package.json's scripts block I added a command "cleanse" and added the "rm -rf platforms" command. For easier clearing of the platforms folder.

"scripts": {
    "cleanse": "rm -rf platforms",
    ...
}
lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.