Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ionic mobile app working fine on development but not in production

$
0
0

@FranStoker wrote:

I am developing my first ionic app. I have finished it and it works perfectly when i make

ionic serve --open

Or when I open it on the Ionic DevApp on my mobile device.

When I create the .apk, almost every functionality works fine; but this one not:

<ion-tab [root]="tab1Root" [enabled]="  _tabs.textToEnableTabs !='AddListPage' " tabTitle="Pending Tasks" tabIcon="home"></ion-tab>

<ion-tab [root]="tab2Root" [enabled]="  _tabs.textToEnableTabs !='AddListPage' " tabTitle="Finished Tasks" tabIcon="information-circle"></ion-tab>

<ion-tab [root]="tab3Root" [enabled]="  _tabs.textToEnableTabs !='AddListPage' " tabTitle="Contact Author" tabIcon="contacts">      </ion-tab>

This code checks if we are on certain component or not, so in case we are on that component, we make tabs not to be clickable.

As I said, this functionality works perfectly on development but not on production, where tabs are ALWAYS clickable. So the [enabled] tag or the condition is not working fine. I don´t know.

Which could be the problem?

In case it helps you, I have a service ShowTabsService where I create that property

//ShowTabsService.ts

textToEnableTabs

And I initialize on constructor:

// ShowTabsService.ts constructor

constructor()
{
    this.textToEnableTabs=""; /*value will change on the addList.ts constructor and on its onDestroy, to make tabs available again*/
}

When I am on the constructor of the AddListPage, where tabs should not be clickeable, I do:

//AddListPage.ts

constructor(
    private _viewController:ViewController,
    private _tabs:ShowTabsService) {

       this._tabs.textToEnableTabs=this._viewController.name; //this will be 'AddListPage' when we are on that component

}

And on the ngOnInit, when we leave that component, we make tabs clickable again by doing:

//AddListPage.ts

ngOnDestroy()
{
    this._tabs.textToEnableTabs="";
}

Maybe it is not the best way of doing it (I am new on both Angular and Ionic) but as I said, that works right on development. Not when I install the signed APK

I also put here an error that I obtain when creating the APK, but I don´t think it has something to do:

BUILD SUCCESSFUL in 4s
45 actionable tasks: 2 executed, 43 up-to-date
Built the following apk(s):
        C:\pameter\meterenpen\POST-MODULO\Ionic\IonicList-NativeStorage\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk
ANDROID_HOME=C:\Users\franp\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181
No target specified and no devices found, deploying to emulator
No emulator images (avds) found.
1. Download desired System Image by running: "C:\Users\franp\AppData\Local\Android\Sdk\tools\android.bat" sdk
2. Create an AVD by running: "C:\Users\franp\AppData\Local\Android\Sdk\tools\android.bat" avd
HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver

[ERROR] An error occurred while running subprocess cordova.

        cordova run android --release exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

My environment is:

OS:Windows 10
Node:10.5.0
npm:6.1.0
Cordova:8.1.2
ionic cli:4.2.1
JDK:1.8.0_181

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>