0

I am integrating famo.us application with apache cordova, i've followed the following steps to achieve this task

1) Installed the cordova , famo.us and all the other packges necessary to build cordova as well as famo.us applications

2) I've created a famo.us project using yo famous, as per suggested on this link : https://github.com/Famous/famous and have also served it using grunt serve

3) i copied the timbre tutorial from the famo.us starter kit and pasted into the app folder of the famo.us project (build through yo famous ).

4) Then again i served the project using grunt serve and it worked absolutely fine in browser (chrome and Firefox both)

5) Then i created a project in netbeans by new project -> html5 -> cordova application

6) Then i copied all the content in app folder of famo.us application and pasted in www folder of cordova project and built it using net beans and tested it on browser and it worked absolutely fine (both chrome and firefox)

7) Then i built the cordova project on my Android and it's not showing the strip view of the Timbre Sample Application of famo.us, it opens the menu drawer but there all i can see the blank white background and nothing where it was supposed to show the strip view options of the timbre project

8) Then i copied the package from cordova project platform -> android -> AndroidManifest.xml and pasted it into the DDMS of eclips and opened the menu drawer and see the following error on it:

err: has no method 'now' at http://code.famo.us/famous/0.2/famous.min.js:48

I don't know where i am going wrong, I've also tried download http://code.famo.us/famous/0.2/famous.min.js file and saved it into the js folder in www folder of cordova project and included it into the html and also check it is including, but facing the same problem.

I am doing Google on it from so many time but no success. Please guide me in this regards. it's working absolutely fine on browser but not on the Android.

Also please let me know if there is any other more efficient way to integrate Famo.us Project with Apache Cordova.

EDIT

I've added the code.famo.us in my whitelist, the config.xml code is:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="com.coolappz.coda" version="1.0.0">
    <name>coda</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html"/>
    <access origin="*"/>
    <access uri="code.famo.us" subdomains="false" />
    <access uri="*" subdomains="true" />


</widget>

but still i got the error

err: 09-17 13:23:58.666: E/Web Console(13557): Uncaught TypeError: Object #<Performance> has no method 'now' at file:///android_asset/www/js/famous.min.js:48

index.html file is:

<!DOCTYPE HTML>

    
        <title>famo.us App</title>
        <meta name="viewport" content="width=device-width, maximum-scale=1, user-scalable=no" />
        <meta name="mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />

        <!-- shims for backwards compatibility -->
        <script type="text/javascript" src="http://code.famo.us/lib/functionPrototypeBind.js"></script>
        <script type="text/javascript" src="http://code.famo.us/lib/classList.js"></script>
        <script type="text/javascript" src="http://code.famo.us/lib/requestAnimationFrame.js"></script>

        <!-- module loader -->
        <script type="text/javascript" src="http://code.famo.us/lib/require.js"></script>
<!--        <script type="text/javascript" src="js/famous.min.js" ></script>-->

        <!-- famous -->
        <link rel="stylesheet" type="text/css" href="http://code.famo.us/famous/0.2/famous.css" />
        <script type="text/javascript" src="http://code.famo.us/famous/0.2/famous.min.js"></script>

        <!-- app code -->
        <link rel="stylesheet" type="text/css" href="css/app.css" />
        <script type="text/javascript">
            require.config({
                baseUrl: './src/'
            });
            require(['main']);
        </script>
    
    <body></body>
Community
  • 1
  • 1
Ahsan Hussain
  • 75
  • 1
  • 6
  • Do you see any errors in logcat? Did you add the code.famo.us link to your Cordova whitelist? – MBillau Sep 16 '14 at 16:28
  • Most of the JS libraries have a large number of files separated into modules. What you have done is included only a single `famous.min.js` in your local `asset\www\js` directory. The `famous.min.js` is just the entry point into the library n will require additional files as per your app. You either download **ALL** the files into the local phone or use the `code.famo.us` site for downloading. In ur case the error is mostly due to CORS issue as it is tryin to get the remaining files required from `code.famo.us`. U need 2 enable your app for CORS, which U can search on stackoverflow for solution – frank Sep 16 '14 at 18:37
  • do i need to whitelist code.famo.us like this? :" " ?? i am doing it for android @frank – Ahsan Hussain Sep 17 '14 at 08:11
  • yes i've seen error in logcat, i've told the err of logcat in the question @MBillau – Ahsan Hussain Sep 17 '14 at 08:14
  • @AhsanHussain I m not an expert on require.js, but what I undrstand is that u r requiring modules from different domain. 1) `famo.us` libary Modules frm `code.famo.us`2) Local Phone module. Module from the `www` directory 3) WebServer module. Module frm ur webserver i.e `http://your.webserver/`(I am not sure about point 3. I m making a guess). U need 2 tell `require.js` how it shud differentiate between the modules. Have a look at [this](http://stackoverflow.com/questions/24350691/cross-domain-modules-with-require-js-not-adding-js-for-submodules) link for getting modules from different domain. – frank Sep 17 '14 at 09:08
  • @AhsanHussain In your `config.xml` file there are multiple values set ` `. Remove the `` line and keep the ``. – frank Sep 17 '14 at 09:10
  • @frank I've deleted the `` from the config.xml but still getting the same error – Ahsan Hussain Sep 17 '14 at 11:44
  • and @frank i've also tried download all the file on my pc of famo.us and including them in my project, but still i got the same error, it looks like there is some issue in famo.min.js file of famo, or may be i am getting it wrong – Ahsan Hussain Sep 17 '14 at 11:46
  • as soon as starts my application it shows error `09-17 16:48:56.972: E/linker(25530): load_library(linker.cpp:759): library "libmaliinstr.so" not found `, and after that when i open the menu drawer of timber view sample app of famo.us it shows me `09-17 16:49:54.317: E/Web Console(25530): Uncaught TypeError: Object # has no method 'now' at http://code.famo.us/famous/0.2/famous.min.js:48 ` – Ahsan Hussain Sep 17 '14 at 11:49
  • Hi @AhsanHussain, I have a similar problem. Did you find a solution? – Geoffrey Lalloué Oct 29 '14 at 09:33

0 Answers0