Skip to content

error compile andriod in new project #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
A1Gard opened this issue Apr 1, 2018 · 6 comments
Closed

error compile andriod in new project #168

A1Gard opened this issue Apr 1, 2018 · 6 comments

Comments

@A1Gard
Copy link

A1Gard commented Apr 1, 2018

hi and greats dear developers.

I was install successfully:

tns doctor                                       
NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later.

Your components are up-to-date: 
nativescript,tns-core-modules,tns-android,tns-ios

No issues were detected.

when I create new project by this doc: https://nativescript-vue.org/en/docs/getting-started/quick-start/

then try to compile with this command:
tns build android

can't compile the andriod:
but with this issue : NativeScript/nativescript-dev-webpack#111 (comment)

The compile started.

Is that write way, or this bug?
how can I compile andriod app.

@rigor789
Copy link
Member

rigor789 commented Apr 1, 2018

If you are using the vue-cli-template (which you are if you followed the quick start guide) you don't run tns commands in the project, instead you have to run the npm scripts provided in the template.

So to build the application you would have to run npm run build android. If for some reason you must use the tns commands, you can do so inside the dist folder.

@A1Gard
Copy link
Author

A1Gard commented Apr 2, 2018

@rigor789 it's not worked:
$ npm run build android

> [email protected] build /home/myusername/Project/native-vue/myprojname
> webpack --env.tnsAction build "android"

info: Copying NativeScript plugins to template dependencies...
info: Preparing NativeScript application from template...
npm WARN myprojname@ No repository field.
npm WARN myprojname@ license should be a valid SPDX license expression

info: Bundling application for android...
info: Bundling application for ios...
Executing post-build scripts
Child
    
    ERROR in multi ./src/main.js android
    Module not found: Error: Can't resolve 'android' in '/home/myusername/Project/native-vue/myprojname'
     @ multi ./src/main.js android
Child
    
    ERROR in multi ./src/main.js android
    Module not found: Error: Can't resolve 'android' in '/home/myusername/Project/native-vue/myprojname'
     @ multi ./src/main.js android
info: Building NativeScript application...
# build ios

┌─────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Usage   │ Synopsis                                                                                                                      │
│ General │ $ tns build ios [--for-device] [--release] [--copy-to <File Path>] [--provision [<UUID/name>]] [--bundle [<value>] [--env.*]] │
└─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Builds the project for iOS and produces an APP or IPA that you can manually deploy in the iOS Simulator or on device, respectively.

WARNING: You can run this command only on OS X systems. To view the complete help for this command, run $ tns help build ios

Preparing project...
Project successfully prepared (android)
Building project...
Gradle build...
# build android

┌─────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Usage   │ Synopsis                                                                                                                                                                                                                                                            │
│ General │ $ tns build android [--compileSdk <API Level>] [--key-store-path <File Path> --key-store-password <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [--release] [--static-bindings] [--copy-to <File Path>] [--bundle [<value>] [--env.*]] │
└─────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.

### Options

    * --compileSdk - Sets the Android SDK that will be used to build the project.
    * --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
    * --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --copy-to - Specifies the file path where the built .apk will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.
    * --bundle - Specifies that a bundler (e.g. webpack) should be used if one is present. If no value is passed will default to webpack.
    * --env.* - Specifies additional flags that the bundler may process. May be passed multiple times. For example: --env.uglify --env.snapshot.

### Attributes

<API Level> is a valid Android API level. For example: 22, 23.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack --env.tnsAction build "android"`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build 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:

@rigor789
Copy link
Member

rigor789 commented Apr 2, 2018

Sorry, that should of been npm run build:android.

@A1Gard
Copy link
Author

A1Gard commented Apr 2, 2018

@rigor789 : I try this too many :(
Damn to gradle its not work here.

$ npm run build:android                                                                       

> [email protected] build:android /home/myusername/Project/native-vue/myprojname
> npm run build -- --env.android


> [email protected] build /home/myusername/Project/native-vue/myprojname
> webpack --env.tnsAction build "--env.android"

info: Copying NativeScript plugins to template dependencies...
info: Preparing NativeScript application from template...
npm WARN myprojname@ No repository field.
npm WARN myprojname@ license should be a valid SPDX license expression

info: Bundling application for android...
Executing post-build scripts
info: Building NativeScript application...
Preparing project...
Project successfully prepared (android)
Building project...
Gradle build...  ---> wait 2-3 min here
# build android

┌─────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Usage   │ Synopsis                                                                                                                                                                                                                                                            │
│ General │ $ tns build android [--compileSdk <API Level>] [--key-store-path <File Path> --key-store-password <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [--release] [--static-bindings] [--copy-to <File Path>] [--bundle [<value>] [--env.*]] │
└─────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.

### Options

    * --compileSdk - Sets the Android SDK that will be used to build the project.
    * --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
    * --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --copy-to - Specifies the file path where the built .apk will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.
    * --bundle - Specifies that a bundler (e.g. webpack) should be used if one is present. If no value is passed will default to webpack.
    * --env.* - Specifies additional flags that the bundler may process. May be passed multiple times. For example: --env.uglify --env.snapshot.

### Attributes

<API Level> is a valid Android API level. For example: 22, 23.

@rigor789
Copy link
Member

Closing due to inactivity.

@nativescript-vue nativescript-vue locked as resolved and limited conversation to collaborators Jul 3, 2018
@nativescript-vue-bot
Copy link
Collaborator

We are locking this issue because it has been closed for more than 14 days.

If the issue comes up again please open a new issue with additional details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants