Skip to content

Project with plugin variables does not build #1508

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
enchev opened this issue Feb 18, 2016 · 8 comments
Closed

Project with plugin variables does not build #1508

enchev opened this issue Feb 18, 2016 · 8 comments
Milestone

Comments

@enchev
Copy link
Contributor

enchev commented Feb 18, 2016

From @victorhugom on February 18, 2016 14:16

Error:

malformed document. First element should be <plist>
# build ios

I did:

npm install -g nativescript
tns platform remove ios
tns platform add ios
npm install tns-core-modules@latest --save
tns build ios

And also tried:

remove folder: node_modules
remove folder: platform

npm install -g nativescript
tns platform remove ios
tns platform add ios
npm install tns-core-modules@latest --save
tns build ios

Copied from original issue: NativeScript/NativeScript#1581

@victorhugom-zz
Copy link

You can close this issue, after remove and add the plugins is building again

@rosen-vladimirov
Copy link
Contributor

Ok, that's weird. Can you send me the list of plugins you are using?

@victorhugom-zz
Copy link

Plugins:

 "nativescript-facebook-plugin": "git+https://github.com/NativeScript/nativescript-facebook-plugin.git",
"nativescript-google-maps-sdk": "^1.2.2",
"nativescript-iqkeyboardmanager": "^1.0.0",
"nativescript-loading-indicator": "^1.0.0",
"nativescript-videoplayer": "git+https://github.com/bradmartin/nativescript-videoplayer.git",

After some investigation I discovered where exactly were the errors:

First: the videoplayer plugin didn't have the tag in the file.
Second: The build process wasn't reading the plugin variables used in the Facebook plugin to build the .plist file correctly

@Plamen5kov
Copy link
Contributor

same problem with the plugin variables on android (they don't get replaced in AndroidManifest.xml

@rosen-vladimirov
Copy link
Contributor

Is this only in the facebook plugin or can be reproduced with any kind of plugin with variables?

@Plamen5kov
Copy link
Contributor

Plamen5kov commented Feb 26, 2016

I just tried it out, it looks like it still doesn't work. Here's what id did:

  1. tns plugin add nativescript-barcodescanner
  2. went to node_modules/nativescript-barcodescanner/platforms/android/AndroidManifest.xml and added this line to manifest:
<tag>{APP_ID}</tag>
  1. went to <app_name>/node_modules/nativescript-barcodescanner/package.json and added
    "variables": {
        "APP_ID": {
             "defaultValue": "myAppId"
        }
    }

to the "nativescript" key as described here: #882

  1. run tns prepare android

Error:

tns prepare android
Copying template files...
Project successfully created.
Processing node_modules failed. Exception: Unable to find the value for APP_ID plugin variable into project package.json file. Verify that your package.json file is correct and try again.
Sending exception report (press Ctrl+C to stop).....

Cli version: 1.6.1.
same happens with 1.6.0

@dtopuzov dtopuzov changed the title Project does not build after upgrade to {N} 1.6.0 Project with plugin variables does not build after upgrade to {N} 1.6.0 Jun 6, 2016
@dtopuzov
Copy link
Contributor

dtopuzov commented Jun 6, 2016

Still valid in {N} 2.0.1 with steps Plamen5kov described.

@dtopuzov dtopuzov changed the title Project with plugin variables does not build after upgrade to {N} 1.6.0 Project with plugin variables does not build Jun 6, 2016
@enchev enchev added the plugins label Jun 8, 2016
@Plamen5kov
Copy link
Contributor

Plamen5kov commented Aug 2, 2016

Still able to reproduce with cli 2.1.1.
Build doesn't crash but APP_ID is still not replaced with the value from package.json

EDIT: First I tried putting the APP_ID in the package.json of the plugin, but then the build failed, because CLI searched for the APP_ID in the project <app_name>./package.json file.
After I moved the "variables" object to <app_name>./package.json file, the build didn't fail, but the variable wasn't replaced in the AndroidManifest.xml

EDIT 2: Actually I wasn't testing correctly, the plugin needs to have declared

"variables": {
        "APP_ID": {
...

in it's package.json and then follows the tns plugin add ... command which asks you for a variable id if a default hasn't been set and adds:

    "nativescript-barcodescanner-variables": {
      "APP_ID": "myAppId"
    }

to the <app_name>/package.json file.

If the user follows the correct flow, the prepare command replaces the APP_ID in the AndroidManifest.xml file with the correct value.

@Plamen5kov Plamen5kov added this to the 2.2.0 milestone Aug 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants