0

I'm developing a mobile application with Phonegap and AngularJS, and the application is working fine so far in desktop browser. Although, when I build it into an APK, some of the code of the application doesn't work. First of all, I've seen this topic Phonegap - app works on desktop, not on mobile and the issue continues.

index.html

<!DOCTYPE html>
<html ng-app="home">
    <head>
        <meta charset="utf-8" />
        <title>My new Application</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimal-ui" />
        <link rel="shortcut icon" href="/favicon.png" type="image/x-icon" />

        <link rel="stylesheet" href="public/css/angular/mobile-angular-ui-hover.min.css" />
        <link rel="stylesheet" href="public/css/angular/mobile-angular-ui-base.min.css" />
        <link rel="stylesheet" href="public/css/angular/mobile-angular-ui-desktop.min.css" />
        <link rel="stylesheet" href="public/css/global.css" />
    </head>

    <body>

      <div class="app">

            <div ng-include="'application/views/header.html'" style="margin-bottom: 51px"></div>

            <div ng-view="">

            </div>

            <div ng-include="'application/views/footer.html'"></div>

        </div>

        <script srC="cordova.js"></script>
        <script type="text/javascript" src="public/js/angular/angular.min.js"></script>
        <script type="text/javascript" src="public/js/angular/angular-route.min.js"></script>
        <script type="text/javascript" src="application/controllers/home.js"></script>
    </body>
</html>

home.js

var app = angular.module('home', [
    'ngRoute'
]);

app.config(function($routeProvider) {
    $routeProvider

        .when('/', {
            templateUrl : '/application/views/home/home.html',
            controller  : 'home_controller'
        })

});

app.controller('home_controller', ['$scope', '$location', function($scope, $location){

    console.log('im here..');
    alert('im here..!!');
}]);

I tried to "debug" by setting console.log and alert messages, but none of them shows up. For debug, I'm using http://debug.build.phonegap.com/ weinre.

Conclusion: my application shows up normally, it loads the header.html and the footer.html, but not the home.html (nor shows up messages). I also tried to set up the controller in the body ng-controller="home_controller" but the route configuration should do the same.

Community
  • 1
  • 1
Linesofcode
  • 5,327
  • 13
  • 62
  • 116
  • try changing to – jcesarmobile Jan 05 '15 at 10:55
  • You should use android emulator (or a real device) and the chrome dev tools to remote-debug your app, I've tried some other solutions, like weinre but they were not working. Take a look at [this](https://developer.chrome.com/devtools/docs/remote-debugging), it explains how to set up android and chrome for remote debugging hybrid android app. You can also have a look on eclipse to check the output of logcat. `` might also be an issue. – n00dl3 Jan 05 '15 at 11:01
  • @JuniusRendel it's not `srC` fault. I've seen that link before comming here, and I can't put it debugging to chrome. The devices appears, I set up the Port etc, but nothing else happens. – Linesofcode Jan 05 '15 at 14:45
  • when you run `cordova ruǹ and then go to chrome://inspect you should see your device and the running webviews / website unless you made a release build... – n00dl3 Jan 05 '15 at 14:48
  • I couldn't make it work in chrome://inspect so I installed ADB and Android Studio, and I'm now debugging by Android Studio Log cat. – Linesofcode Jan 05 '15 at 15:16
  • And I'm starting seeing errors such as: "SQLite database failed to load.." and I don't even use database anywhere.. – Linesofcode Jan 05 '15 at 15:17

0 Answers0