NathanWalker / nativescript-ng2-magic

Magically turn your Angular2 web app into a NativeScript app.
MIT License
64 stars 14 forks source link

com.tns.Runtime.callJSMethod failing #10

Closed cescoferraro closed 8 years ago

cescoferraro commented 8 years ago

I am starting a new project, but getting this:

BUILD SUCCESSFUL

Total time: 4.916 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.10/userguide/gradle_daemon.html
Project successfully built.
Using  /home/cesco/code/src/bitbucket.org/cescoferraro/track/nativescript/platforms/android/build/outputs/apk/nativescript-debug.apk
Waiting for emulator device initialization...
installing /home/cesco/code/src/bitbucket.org/cescoferraro/track/nativescript/platforms/android/build/outputs/apk/nativescript-debug.apk through adb
running /home/cesco/code/src/bitbucket.org/cescoferraro/track/nativescript/platforms/android/build/outputs/apk/nativescript-debug.apk through adb
JS: heloooo
06-08 07:51:01.005  1796  1796 W System.err:    at com.tns.Runtime.callJSMethodNative(Native Method)
06-08 07:51:01.005  1796  1796 W System.err:    at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:861)
06-08 07:51:01.005  1796  1796 W System.err:    at com.tns.Runtime.callJSMethodImpl(Runtime.java:726)
06-08 07:51:01.005  1796  1796 W System.err:    at com.tns.Runtime.callJSMethod(Runtime.java:712)
06-08 07:51:01.005  1796  1796 W System.err:    at com.tns.Runtime.callJSMethod(Runtime.java:693)
06-08 07:51:01.005  1796  1796 W System.err:    at com.tns.Runtime.callJSMethod(Runtime.java:683)

The device spits

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.nativescript/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: 
Calling js method onCreate failed

TypeError: Cannot read property 'ContentLayout' of undefined
File: "/data/data/org.nativescript.nativescript/files/app/tns_modules/ui/frame/frame.js, line: 229, column: 47

StackTrace: 
    Frame: function:'Frame._createUI', file:'/data/data/org.nativescript.nativescript/files/app/tns_modules/ui/frame/frame.js', line: 229, column: 48
    Frame: function:'View._onContextChanged', file:'/data/data/org.nativescript.nativescript/files/app/tns_modules/ui/core/view.js', line: 209, column: 14
    Frame: function:'View._onAttached', file:'/data/data/org.nativescript.nativescript/files/app/tns_modules/ui/core/view.js', line: 165, column: 14
    Frame: function:'NativeScriptActivity.onCreate', file:'/data/data/org.nativescript.nativescript/files/app/tns_modules/ui/frame/frame.js', line: 606, column: 18

    at android.app.ActivityThread.per

Here is my nativescript/app/main.ts

// this import should be first in order to load some required settings (like globals and reflect-metadata)
import {nativeScriptBootstrap} from "nativescript-angular/application";
import {NS_ROUTER_PROVIDERS, NS_ROUTER_DIRECTIVES} from "nativescript-angular/router";
import {MagicService} from "nativescript-ng2-magic";
MagicService.ROUTER_DIRECTIVES = NS_ROUTER_DIRECTIVES;

// import your root component here
console.log("heloooo");
import {TrackAppComponent} from "./app/track.component";

nativeScriptBootstrap(TrackAppComponent, [NS_ROUTER_PROVIDERS], { startPageActionBarHidden: false });

Here is my nativescript/app/app/track.component.ts

import { Component } from 'nativescript-ng2-magic';

@Component({
  selector: 'track-app',
  templateUrl: './app/track.component.html',
  styleUrls: ['./app/track.component.css']
})
export class TrackAppComponent {
  title = 'track works!';
}

issue

NathanWalker commented 8 years ago

Hi @cescoferraro are you still having this issue? If so, curious to see your track.component.tns.html file?

NathanWalker commented 8 years ago

I'm going to close this due to no response. If still an issue for you, feel free to reopen.