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 find bootstrap.js file in platforms/android/assets/app #95

Closed
niagr opened this issue Jun 2, 2015 · 9 comments
Closed

Can't find bootstrap.js file in platforms/android/assets/app #95

niagr opened this issue Jun 2, 2015 · 9 comments

Comments

@niagr
Copy link

niagr commented Jun 2, 2015

this page talks about a bootstrap.js file in platforms/android/assets/app. But when I build the demo app using tns create this file is nowhere to be found. Has something changed in the bootstrap mechanism?

@blagoev
Copy link
Contributor

blagoev commented Jun 2, 2015

Hi, indeed from v0.10.0 NativeScript supports package.json and index.js in addition to bootstrap.js for bootstraping an application.

Check it out here
https://docs.nativescript.org/Changelogs/Android%20Runtime.html

@niagr
Copy link
Author

niagr commented Jun 2, 2015

So I'm guessing the entry point for the application would be the file specified as main in package.json. In that case, for the hello world app here, where is the code that would normally go in bootstrap.js?

@blagoev
Copy link
Contributor

blagoev commented Jun 3, 2015

Yep, the package.json will reference the startup js file as "main"

The code from the bootstrap.js will be in either index.js or the js file which is referenced inside the package.json as main

@niagr
Copy link
Author

niagr commented Jun 3, 2015

I want to write a nativescript android application without using NSM. I want to work only with the Java APIs for android. Is this possible? I tried following these instructions to no avail. Also, I would like to use the nativescript cli only, not the android sdk tools.

@NathanaelA

This comment was marked as abuse.

@blagoev
Copy link
Contributor

blagoev commented Jun 3, 2015

I guess NSM stands for NativeScript modules. You definitely can use {N} to write android apps without the platform UI abstractions. For example take a look at our watch demo here
https://github.com/NativeScript/sample-Android-Wear/blob/master/app/mainpage.js
It's in fact a pure {N} android application you can run on any android device.
The sample uses the bootstrap.js, but you can switch to package.json if you want.

@niagr
Copy link
Author

niagr commented Jun 4, 2015

Okay so what was wrong was the bootstrap.js code on this page:
http://docs.nativescript.org/runtimes/android/getting-started/hello-world.html#setup-bootstrapjs

compare the class extension code to this one:
https://github.com/NativeScript/sample-Android-Wear/blob/master/app/mainpage.js

I'm guessing the extension syntax was changed to use the global __extends function at some point. Could someone confirm this? Apart from that the instructions from the page worked fine. It builds fine with gradle using the android sdk too so now I have an option to use pure android tools for android only projects :)

Also, I was would appreciate some information on the current status and plans about typescript syntax support for extending native types.

@blagoev
Copy link
Contributor

blagoev commented Jun 5, 2015

You can extend native types with typescript.

Check for example how we extend the android.support.v4.view.ViewPager class
https://github.com/NativeScript/NativeScript/blob/9321f275a15872dcd0e40f4c967fd7201bacd25e/ui/tab-view/tab-view.android.ts#L17

The only requirement is that you have a constructor returning __native(this). We have plans for improving this in our docs here

@niagr
Copy link
Author

niagr commented Jun 8, 2015

Thanks for your help everybody :)

@niagr niagr closed this as completed Jun 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants