Skip to content
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

Can't build demo app on android #213

Open
rnmhdn opened this issue Sep 23, 2019 · 7 comments
Open

Can't build demo app on android #213

rnmhdn opened this issue Sep 23, 2019 · 7 comments
Labels

Comments

@rnmhdn
Copy link

rnmhdn commented Sep 23, 2019

  • CLI: 6.1.0
  • Runtime: tns-android 6.1.0
  • Plugin(s):
  "dependencies": {
    "nativescript-facebook": "../src",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-vue": "~2.4.0",
    "tns-core-modules": "^6.0.0"
  },
  "devDependencies": {
    "@babel/core": "~7.1.0",
    "@babel/preset-env": "~7.1.0",
    "babel-loader": "~8.0.0",
    "nativescript-dev-webpack": "^1.0.0",
    "nativescript-vue-template-compiler": "~2.4.0",
    "node-sass": "~4.12.0",
    "vue-loader": "~15.4.2",
    "typescript": "~3.4.5"
}

Please, tell us how to recreate the issue in as much detail as possible.

I did exactly as stated in the vue demo directory.

Christopher[7:37]0 demos$ git clone https://github.com/NativeScript/nativescript-facebook.git
Cloning into 'nativescript-facebook'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 2406 (delta 5), reused 9 (delta 2), pack-reused 2384
Receiving objects: 100% (2406/2406), 3.70 MiB | 407.00 KiB/s, done.
Resolving deltas: 100% (1439/1439), done.
Christopher[7:38]0 demos$  cd nativescript-facebook/demo-vue
Christopher[7:38]0 demo-vue$  npm run build.plugin && npm install

> @ build.plugin /home/aran/projects/demos/nativescript-facebook/demo-vue
> cd ../src && npm run build


> nativescript-facebook@4.2.0 build /home/aran/projects/demos/nativescript-facebook/src
> npm i && tsc && tns plugin build && npm run ngc


> nativescript-angular@7.2.4 postinstall /home/aran/projects/demos/nativescript-facebook/src/node_modules/nativescript-angular
> node postinstall.js


> nativescript-vue@2.2.2 postinstall /home/aran/projects/demos/nativescript-facebook/src/node_modules/nativescript-vue
> node postinstall.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN nativescript-angular@7.2.4 requires a peer of @angular/platform-browser-dynamic@~7.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN nativescript-angular@7.2.4 requires a peer of @angular/forms@~7.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN nativescript-angular@7.2.4 requires a peer of @angular/http@~7.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN nativescript-angular@7.2.4 requires a peer of @angular/platform-browser@~7.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN nativescript-angular@7.2.4 requires a peer of @angular/router@~7.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN nativescript-facebook@4.2.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {
"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 262 packages from 163 contributors and audited 2346 packages in 95.845s
found 0 vulnerabilities


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':javaPreCompileRelease'.
> Could not resolve all files for configuration ':releaseCompileClasspath'.
   > Could not find support-core-utils.jar (com.android.support:support-core-utils:28.0.0).
     Searched in the following locations:
         https://maven.google.com/com/android/support/support-core-utils/28.0.0/support-core-utils-28.0.0.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

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

BUILD FAILED in 15s
Failed to build plugin nativescript-facebook : 
Error: Command ./gradlew failed with exit code 1
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! nativescript-facebook@4.2.0 build: `npm i && tsc && tns plugin build && npm run ngc`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the nativescript-facebook@4.2.0 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:
npm ERR!     /home/aran/.npm/_logs/2019-09-23T04_10_27_387Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build.plugin: `cd ../src && npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ build.plugin script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/aran/.npm/_logs/2019-09-23T04_10_27_407Z-debug.log

Here is the content of the 387Z-debug.log file:

1 verbose cli [ '/usr/bin/node', '/home/aran/.local/bin/npm', 'run', 'build' ]
2 info using npm@6.8.0
3 info using node@v11.15.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle nativescript-facebook@4.2.0~prebuild: nativescript-facebook@4.2.0
6 info lifecycle nativescript-facebook@4.2.0~build: nativescript-facebook@4.2.0
7 verbose lifecycle nativescript-facebook@4.2.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle nativescript-facebook@4.2.0~build: PATH: /home/aran/.local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/aran/projects/demos/nativescript-facebook/src/node_modules/.bin:/home/aran/.local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/aran/projects/demos/nativescript-facebook/demo-vue/node_modules/.bin:/home/aran/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/aran/packages/direct/android-hometools/:/home/aran/packages/direct/android-homeplatform-tools/:/home/aran/packages/direct/Bento4/bin:/home/aran/packages/direct/Bento4/utils:/home/aran/packages/direct/android-hometools/:/home/aran/packages/direct/android-homeplatform-tools/:/home/aran/packages/direct/Bento4/bin:/home/aran/packages/direct/Bento4/utils
9 verbose lifecycle nativescript-facebook@4.2.0~build: CWD: /home/aran/projects/demos/nativescript-facebook/src
10 silly lifecycle nativescript-facebook@4.2.0~build: Args: [ '-c', 'npm i && tsc && tns plugin build && npm run ngc' ]
11 info lifecycle nativescript-facebook@4.2.0~build: Failed to exec build script
12 verbose stack Error: nativescript-facebook@4.2.0 build: `npm i && tsc && tns plugin build && npm run ngc`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/home/aran/.local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:193:13)
12 verbose stack     at maybeClose (internal/child_process.js:999:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
13 verbose pkgid nativescript-facebook@4.2.0
14 verbose cwd /home/aran/projects/demos/nativescript-facebook/src
15 verbose Linux 5.2.6-arch1-1-ARCH
16 verbose argv "/usr/bin/node" "/home/aran/.local/bin/npm" "run" "build"
17 verbose node v11.15.0
18 verbose npm  v6.8.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error nativescript-facebook@4.2.0 build: `npm i && tsc && tns plugin build && npm run ngc`
23 error spawn ENOENT
24 error Failed at the nativescript-facebook@4.2.0 build script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

Here is the content of the 407Z-debug.log file:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli   '/home/aran/.local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build.plugin' ]
2 info using npm@6.8.0
3 info using node@v11.15.0
4 verbose run-script [ 'prebuild.plugin', 'build.plugin', 'postbuild.plugin' ]
5 info lifecycle @~prebuild.plugin: @
6 info lifecycle @~build.plugin: @
7 verbose lifecycle @~build.plugin: unsafe-perm in lifecycle true
8 verbose lifecycle @~build.plugin: PATH: /home/aran/.local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/aran/projects/demos/nativescript-facebook/demo-vue/node_modules/.bin:/home/aran/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/aran/packages/direct/android-hometools/:/home/aran/packages/direct/android-homeplatform-tools/:/home/aran/packages/direct/Bento4/bin:/home/aran/packages/direct/Bento4/utils:/home/aran/packages/direct/android-hometools/:/home/aran/packages/direct/android-homeplatform-tools/:/home/aran/packages/direct/Bento4/bin:/home/aran/packages/direct/Bento4/utils
9 verbose lifecycle @~build.plugin: CWD: /home/aran/projects/demos/nativescript-facebook/demo-vue
10 silly lifecycle @~build.plugin: Args: [ '-c', 'cd ../src && npm run build' ]
11 silly lifecycle @~build.plugin: Returned: code: 1  signal: null
12 info lifecycle @~build.plugin: Failed to exec build.plugin script
13 verbose stack Error: @ build.plugin: `cd ../src && npm run build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/aran/.local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:193:13)
13 verbose stack     at ChildProcess.<anonymous> (/home/aran/.local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:193:13)
13 verbose stack     at maybeClose (internal/child_process.js:999:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid @
15 verbose cwd /home/aran/projects/demos/nativescript-facebook/demo-vue
16 verbose Linux 5.2.6-arch1-1-ARCH
17 verbose argv "/usr/bin/node" "/home/aran/.local/bin/npm" "run" "build.plugin"
18 verbose node v11.15.0
19 verbose npm  v6.8.0
20 error code ELIFECYCLE
21 error errno 1
22 error @ build.plugin: `cd ../src && npm run build`
22 error Exit status 1
23 error Failed at the @ build.plugin script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
@rnmhdn
Copy link
Author

rnmhdn commented Oct 6, 2019

Is this repo dead?
I've been having this issue for a month now and I have got no response...
this repo has 17 contributors!!!

@rnmhdn
Copy link
Author

rnmhdn commented Oct 16, 2019

this is really sad.

@NickIliev
Copy link

@aranmohyeddin once again thank you for pinging the team on this one.

I can confirm that indeed the build scrip (npm run build) is failing with

 D:\rep\nativescript-facebook\src\node_modules\.bin\ngc:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)

and npm run demo.android is failing with

JS: HMR: Hot Module Replacement Enabled. Waiting for signal.
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to start activity ComponentInfo{org.nativescript.demo/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
System.err:     com.facebook.internal.Validate.sdkInitialized(Validate.java:144)
System.err:     com.facebook.FacebookSdk.getApplicationContext(FacebookSdk.java:577)
System.err:     com.facebook.internal.FetchedAppGateKeepersManager.loadAppGateKeepersAsync(FetchedAppGateKeepersManager.java:87)
System.err:     com.facebook.internal.FeatureManager.checkFeature(FeatureManager.java:36)
System.err:     com.facebook.appevents.internal.ActivityLifecycleTracker.startTracking(ActivityLifecycleTracker.java:72)
System.err:     com.facebook.FacebookSdk.setAutoLogAppEventsEnabled(FacebookSdk.java:919)
System.err:     com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209)
System.err:     com.tns.Runtime.callJSMethodImpl(Runtime.java:1096)
System.err:     com.tns.Runtime.callJSMethod(Runtime.java:1083)
System.err:     com.tns.Runtime.callJSMethod(Runtime.java:1063)
System.err:     com.tns.Runtime.callJSMethod(Runtime.java:1055)
System.err:     com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:19)

@rnmhdn
Copy link
Author

rnmhdn commented Oct 17, 2019

@NickIliev Thank you. I've asked this question on stackoverflow. And someone tried to help but I failed to understand what they told me to do, maybe you can use that information to solve this.

@rnmhdn rnmhdn closed this as completed Oct 17, 2019
@rnmhdn rnmhdn reopened this Oct 17, 2019
@NickIliev
Copy link

@aranmohyeddin not quite sure what is happening in the SO thread but there seems to be an issue with the latest version of the plugin which is causing the npm run demo.android to fail (this is the command that executes the demo). Once the fix is released I will ping you so that you could test with the newer version.

@NickIliev
Copy link

NickIliev commented Oct 17, 2019

@aranmohyeddin there are few things that are wrong here - in the following lines I will explain what is happening and how to fix the development workflow with this plugin on Windows.

  • There was a bug in the plugin which was resolved via this PR. So in order for the demo to work make sure you've pulled the latest changes from this branch (or use the newly published version which will be live in a matter of few hours)

  • Then we are coming to the npm run build issue that is reproducible on Windows. The thing is that the script is calling an Angular specific ngc script. Here is what we have behind npm run build

"build": "npm i && tsc && tns plugin build && npm run ngc",

The last part is failing due to some syntax error when executing bash commands on Windows. The thing is that the npm run is not executing the proper command (onWindows the executable ngx.cmd should be triggered instead of the bash script). So to resolve the issue remove the last part from the build command.

"build": "npm i && tsc && tns plugin build",

Then update the Angular dependencies to version 8.2.x and the TypeScript dependency to 3.4.5

    "devDependencies": {
        "tns-core-modules": "^6.1.2",
        "tns-platform-declarations": "^6.1.2",
        "typescript": "~3.4.5",
        "nativescript-angular": "~8.2.0",
        "nativescript-vue": "~2.2.0",
        "@angular/core": "~8.2.0",
        "@angular/common": "~8.2.0",
        "@angular/compiler": "~8.2.0",
        "@angular/compiler-cli": "~8.2.0",
        "rxjs": "^6.3.3",
        "zone.js": "~0.8.26",
        "tslint": "~5.11.0"
    }

Remove node_modules and re-run the command

npm run build

After that manually execute the Angular ngc command as follows:

./node_modules/.bin/ngc

Now you are good to go with starting the demo

cd ../demo
rm -rf node_modules platforms
cd ../src
npm run demo.android

@rnmhdn
Copy link
Author

rnmhdn commented Oct 18, 2019

I'm not on windows. I'm on Archlinux. I don't just want to run the demo. I want to use the actual plugin in my app. In The SO question I've posted the error I get in the actual plugin.

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

No branches or pull requests

2 participants