Ionic app works in browser emultor (iOS/Android both) and iOS device but not on android device


#1

Hi; I’m trying to develop an app that works totally fine on browser, iOS and Android emulator. However when it comes to Android device it throws an error:
237471 error Uncaught ReferenceError: PhotoEditorSDK is not defined, http://192.168.1.6:8100/js/controllers.js, Line: 297
The part of my controller.js that indicated in error is here:

$scope.openEditor = function(){
  $scope.$apply(function(){
    $scope.showSettings = false;
  });

  var myImage = new Image();
  myImage.src = imageSrc;
  myImage.addEventListener('load', function () {
    var container = document.getElementById('editor');
        var editor = new PhotoEditorSDK.UI.ReactUI({
        preferredRenderer: 'canvas',
        container: container,
        title: 'Pixel',
        showCloseButton: true,
        showNewButton: true,
        maxMegaPixels: {
        mobile: 20
        },
        export:{
          showButton: true,
          type: PhotoEditorSDK.RenderType.DATAURL,
          download: false
        },
        image: myImage,
          assets: {
            baseUrl: 'assets/'
          }
        });

        editor.on('close', function () {
          editor.dispose();
          $scope.$apply(function () {
            $scope.showSettings = true;
          });
        });

        editor.on('export', function (result) {
          saveToPhotoLibrary(result);
        });
  });
}

And finally here is the index.html part where I add script tags of the .js files:

<script src="js/PhotoEditorSDK.min.js"></script>
    <script src="js/PhotoEditorReactUI.min.js"></script>
    <script src="js/app.js"></script>
    <script src="js/controllers.js"></script>

I got no idea what’s wrong with android device, please help me! Any help would be appreciated, thanks.