ionic-team / legacy-ionic-cloud

JavaScript Client for legacy Ionic Cloud services. See Ionic Pro for our new take on the ionic development lifecycle
Apache License 2.0
65 stars 26 forks source link

Ionic Deploy not injected on Android release #162

Open soniyj opened 7 years ago

soniyj commented 7 years ago

Hello All,

I am trying to build a release for android but it seems that the deploy and native are not injected or loaded correctly for some reasons, it happens only on the release while it works perfectly on the debug version. And my first question is why???!!!

ionic build android --prod --release

I tried to import the Deploy in the app.module, service.ts and page.ts but there is always an error.

import { CloudSettings, CloudModule, Deploy } from '@ionic/cloud-angular';

@NgModule({
  declarations: [
    MyApp,
    Page1,
    Page2
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    CloudModule.forRoot(cloudSettings),
    TranslateModule.forRoot({
      provide: TranslateLoader,
      useFactory: translateLoaderFactory,
      deps: [Http]
    }),
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    Page1,
    Page2
  ],
  /* With or without Deploy in providers is the same */
  providers: [{provide: ErrorHandler, useClass: IonicErrorHandler},Deploy,Storage,TranslatorService]
  providers: [{provide: ErrorHandler, useClass: IonicErrorHandler},Storage,TranslatorService]
})
// service.ts
import { Injector, Injectable } from '@angular/core';
import { Deploy } from '@ionic/cloud-angular';
import { LoadingController, Loading } from 'ionic-angular';

@Injectable()
  export class UpdateController {
    constructor(private _deploy: Deploy, private _loadingCtrl: LoadingController) {
      console.log('UpdateController', this._deploy);
      this._deploy.channel = "dev"; // it's undefined
    }
  }
// page.ts
import { Deploy } from '@ionic/cloud-angular';

private _deploy: Deploy = this._injector.get(Deploy);

constructor(public navCtrl: NavController, private _injector: Injector) {
  console.log('Page1', this._deploy);// undefined
}

Any clue?

janpio commented 7 years ago

This sounds more like a problem than a real issue. I suggest you create a topic on the Ionic Forum at https://forum.ionicframework.com/ and close this issue here. Thanks.

soniyj commented 7 years ago

Hi @piotrowski I already open an issue on the forum and I am not the only one, I guess that something it is not working, I didn't try to do a fresh installation of the framework to see if it is going to solve it.

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.0 
ios-sim version: 5.0.8 
OS: macOS Sierra
Node Version: v6.7.0
Xcode version: Xcode 8.3.2 Build version 8E2002
janpio commented 7 years ago

Then provide a link to your forum post, please. Here is also the wrong package, as this is @ionic/cloud and not @ionic/cloud-angular.

soniyj commented 7 years ago

hi @piotrowski this is the link and I am not the only one.

https://forum.ionicframework.com/t/build-android-with-release-and-prod-make-an-unstable-apk/79760

janpio commented 7 years ago

... which is a topic with 3 unrelated problems all mixed into one thread. If you want someone to debug your problem, create a new topic and include all the relevant information.

soniyj commented 7 years ago

hi @piotrowski not really the problem that i was facing it is related to the fact that the ionic deploy instance it was always undefined when building an app using the --prod and --release flag together. I didn't ask to debug my problem!

janpio commented 7 years ago

There are dozens of apps out there in the app stores using --prod --release.

So if you have a problem with this combination, please provide a link to a forum topic that includes all the necessary information to your situation. This is not an issue with @ionic/cloud-angular (and surely not with @ionic/cloud where you opened this issue).