Code works fine on web and using ionic serve but android build is broken

I have production code deployed to the web and looking fine.

I can run the same code using ‘ionic serve’ command.

But when I run ‘ionic run android’ command - all seems good but the apk opens on my Samsung Galaxy S4 and looks vanilla - no styling - no ionic css - no angular js - just like a plain template.

Makes me think there is a path issue but cannot figure it out.

Any ideas? Do I need to target a different build api for an S4? Any pathing tricks for css and js files?


Thanks for any help or ideas the community can offer.

show us your index.html please

Have you debug you device. I think you have some issue in angularjs code.

<!DOCTYPE html>
<html ng-app="podcastgrabber">
    <meta charset="utf-8" />
    <title ng-bind="PageTitle" ></title>
    <base href="/index.html" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimal-ui" />
    <meta name="apple-mobile-web-app-status-bar-style" content="yes" />
    <meta name="fragment" content="!" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
	<link rel="icon" href="favicon.ico" type="image/x-icon">
    <meta name="google-site-verification" content="dlCUY9Z4MrzyDKcMb-g5EveXxwMqxVGsPEYO8uM_0UE" />
    <meta name="description" ng-attr-content="{{MetaDesc}}" />
    <meta name="keywords" ng-attr-content="{{MetaKeywords}}" />

<!-- styles -->
<link rel="stylesheet" href="css/style.css" />

<!-- jplayer -->
<link rel="stylesheet" href="css/fontawesome.css" />
<link rel="stylesheet" href="jplayer/skin/metro-fire/jplayer.metro-fire.css" />

<!-- ionic -->
<script src="ionic_1.3.1/js/ionic.bundle.min.js"></script>
<link rel="stylesheet" href="ionic_1.3.1/css/ionic.min.css" /> 
<link rel="stylesheet" href="ionic_1.3.1/css/ionicons.min.css" /> 

<!-- angular route  -->
<script src="js/angular-route.min.js"></script>

<!-- angular storage -->
<script src="js/ngStorage.js"></script>
<!-- jquery -->
<script src="js/jquery.min.js"></script>

<!-- satellizer oauth -->
<!--[if lte IE 9]>
<script src="//"></script>
<script src="js/satellizer.js"></script>

<!-- toastr -->
<script src="js/toastr.min.js"></script>
<link rel="stylesheet" href="css/toastr.min.css" />

<!-- Go to to customize your tools -->
<script type="text/javascript" src="//"></script>



  <ion-side-menu-content >
  <div class="bar bar-header bar-royal bar-stable nav-title-slide-ios7">
  	 <button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
  	  <span class="search_drawer_toggle" style="margin:5px 0 0 15px;"><i class="ion-search" style="font-size:24px !important;" ></i></span>
  	 <div class="header_title">
  	     <a ng-href="/">
  	         <i class="icon ion-headphone"></i> 
  	<div style="float:right; margin:4px 6px 0 0; display:inline;" ng-controller="navController">
  		  <span ng-if="!isAuthenticated()">&nbsp;<a ng-href="/login"><i class="ion-power" style="color:white;font-size:24px !important;"></i></a></span>
		   <span ng-if="isAuthenticated()">&nbsp;<a href="/profile"><i class="ion-person" style="color:white;font-size:24px !important;"></i></a>&nbsp; &nbsp; <a href="/logout" class="header_link"><i class="ion-close-circled" style="color:white;font-size:24px !important;"></i></i></a></span>
    <ion-nav-bar class="bar-stable nav-title-slide-ios7" align-title="middle" ng-controller="navController">
		   <ion-nav-buttons side="left" >
		   <button menu-toggle="left" class="button button-icon icon ion-navicon"></button>

		   <i class="icon ion-headphone"></i> 
    <ion-nav-view name="menuContent" animation="slide-left-right" title="">
<!-- search bar -->
<div class="search_bar_header bar bar-subheader bar-stable item-input-inset" ng-controller="searchBar">
 <form  ng-submit="dosearch()">
     <label class="item-input-wrapper">
    <i class="icon ion-ios-search placeholder-icon" ></i>
    <input type="search" placeholder="Search" class="input_search" ng-model="keywords">
  <button  type="submit" class="button button-small button-positive" >

 <ion-content style="margin-top:50px;" >
<!-- content start -->	

<!-- used by routing to display page -->

 <!-- content -->
 <div class="ng-view">
 <!-- where the initial view template will be rendered -->	
<!-- end content -->

<!-- end main page content -->

  <ion-side-menu side="left">
    <header class="bar bar-header bar-stable">
      <h1 class="title">Nav</h1>
    <ion-content class="has-header">
      <ion-list ng-controller="navController">
        <ion-item class="item-icon-left" nav-clear menu-close ng-if="isAuthenticated()"  href="/profile">
  <i class="icon ion-person"></i> Profile
   	 <ion-item class="item-icon-left" nav-clear menu-close ng-if="!isAuthenticated()" href="/login">	
  <i class="icon ion-power"></i> Login
    <ion-item class="item-icon-left" nav-clear menu-close ng-if="!isAuthenticated()" href="/signup">
    <i class="icon ion-person-add"></i> Sign up
     <ion-item nav-clear menu-close ng-if="isAuthenticated()">
   <a href="/#/logout">Logout</a> 
        <ion-item class="item-icon-left" nav-clear menu-close href="/categories">
          <i class="icon ion-grid"></i> Categories
        <ion-item class="item-icon-left" nav-clear menu-close href="/favorites" ng-if="isAuthenticated()">
         <i class="icon ion-heart"></i> Favorites
        <ion-item class="item-icon-left" nav-clear menu-close href="/about">
         <i class="icon ion-help-circled"></i> About
                <ion-item nav-clear menu-close href="/add_podcast">
          Add a Podcast

<div class="bar bar-footer bar-dark player" style="display:none; height:70px;">
<div class="title pull-left jpdisplayname" style="margin-top:-8px;" ></div>
  <!-- jplayer -->
  <div id="jquery_jplayer_1" class="jp-jplayer"></div>
	<div id="jp_container_1" class="jp-audio" style="margin-top:25px;">
		<div class="jp-controls">
			<a class="jp-play"><i class="fa fa-play"></i></a>
			<a class="jp-pause"><i class="fa fa-pause"></i></a>
		<div class="jp-progress">
			<div class="jp-seek-bar">
				<div class="jp-play-bar">
			<div class="jp-current-time"></div>
		<div class="jp-no-solution">
			Media Player Error<br>
			Update your browser or Flash plugin
<!-- /jplayer -->

  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  ga('create', 'UA-72636622-1', 'auto');
  ga('send', 'pageview');
        <script src="js/app.js"></script>
        <script src="js/service-auth.js"></script>
        <script src="js/controller-home.js"></script>
        <script src="js/controller-about.js"></script>
        <script src="js/controller-add-podcast.js"></script>
        <script src="js/controller-categories.js"></script>
        <script src="js/controller-podcast-category.js"></script>
        <script src="js/controller-favorites.js"></script>
        <script src="js/controller-episodes.js"></script>
          <script src="js/controller-search-results.js"></script>
        <script src="js/controller-all-podcasts.js"></script>
	     <script src="js/controller-episode-detail.js"></script>
	     <script src="js/controller-auth.js"></script>
	     <script src="js/md5.js"></script>
        <script src="jplayer/jplayer/jquery.jplayer.min.js"></script>
        <script src="js/jplayer-load.js"></script>
       <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>


Hi Virender - yes I am using the Chrome developer tools console and it shows no angular errors.

Thanks for your reply.

Thanks for your reply to my question.
I appreciate your time and your help.

I have posted the index.html I am using for builds.
If you want to see the app in action you can view it here:

Not pretty - my first angular/ionic app - but it works.

Thanks again for your help.

Finally noticed my files were not being loaded into the build.
This had to do with the
<base href="/"/>
I had in place for web use.

I changed it to
<base href="."/>
For use in my app and files loaded.

Now debugging some angular issues.

1 Like