1

I'm trying to build my first mobile app. What I usying: AngularJS, Mobile Angular UI, jQuery and PhoneGap.

My code:

<!doctype html>
<html>
<head>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular-route.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular-touch.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <link rel="stylesheet" href="/mobile-angular-ui/dist/css/mobile-angular-ui-base.min.css" />
    <link rel="stylesheet" href="/mobile-angular-ui/dist/css/mobile-angular-ui-desktop.min.css" />
    <link rel="stylesheet" href="/css/demo.css" />
    <script src="/mobile-angular-ui/dist/js/mobile-angular-ui.min.js"></script>
</head>
<body ng-app="MyApp" ng-controller="MainController">

   HERE HTML CODE

<script>

   HERE ALL LOGIC

</script>
</body>
</html>

In all browsers all works fine, but when I getting apk file from PhoneGap and running it on my Nexus 4 (Android) I seeing white screen :*(

1 Answer 1

2

you need to add the below line at the start of the the head tag

<script type="text/javascript" src="cordova.js"></script>

Also make sure you check the deviceready event to make any native device API calls.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks. I added cordova.js to my project, but now I'm seeing this error: "Uncaught ReferenceError: require is not defined". This is line "var channel = require('cordova/channel')" in cordova.js file.
Have look over here and here for the require error.. How did you create the phonegap project?
another link for phonegap build require error here
phonegap build require error link here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.