Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App not working when I run the application after installing the plugin #1576

Open
sharatchandra99 opened this issue Apr 12, 2018 · 5 comments

Comments

@sharatchandra99
Copy link

PS D:\PushPOC\PushPOC> ionic cordova run android
Running app-scripts build: --platform android --target cordova
[19:01:01] build dev started ...
[19:01:01] clean started ...
[19:01:01] clean finished in 4 ms
[19:01:01] copy started ...
[19:01:02] deeplinks started ...
[19:01:02] deeplinks finished in 78 ms
[19:01:02] transpile started ...
[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 4
In ambient enum declarations member initializer must be constant expression.

   L3:  export declare enum ELocalNotificationTriggerUnit {
   L4:      SECOND = "second",
   L5:      MINUTE = "minute",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 5
In ambient enum declarations member initializer must be constant expression.

   L4:  SECOND = "second",
   L5:  MINUTE = "minute",
   L6:  HOUR = "hour",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 6
In ambient enum declarations member initializer must be constant expression.

   L5:  MINUTE = "minute",
   L6:  HOUR = "hour",
   L7:  DAY = "day",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 7
In ambient enum declarations member initializer must be constant expression.

   L6:  HOUR = "hour",
   L7:  DAY = "day",
   L8:  WEEK = "week",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 8
In ambient enum declarations member initializer must be constant expression.

   L7:  DAY = "day",
   L8:  WEEK = "week",
   L9:  MONTH = "month",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 9
In ambient enum declarations member initializer must be constant expression.

   L8:  WEEK = "week",
   L9:  MONTH = "month",
  L10:  QUARTER = "quarter",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 10
In ambient enum declarations member initializer must be constant expression.

   L9:  MONTH = "month",
  L10:  QUARTER = "quarter",
  L11:  YEAR = "year",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 11
In ambient enum declarations member initializer must be constant expression.

  L10:  QUARTER = "quarter",
  L11:  YEAR = "year",
  L12:  WEEKDAY = "weekday",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 12
In ambient enum declarations member initializer must be constant expression.

  L11:  YEAR = "year",
  L12:  WEEKDAY = "weekday",
  L13:  WEEKDAY_ORDINAL = "weekdayOrdinal",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 13
In ambient enum declarations member initializer must be constant expression.

  L12:  WEEKDAY = "weekday",
  L13:  WEEKDAY_ORDINAL = "weekdayOrdinal",
  L14:  WEEK_OF_MONTH = "weekOfMonth",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 14
In ambient enum declarations member initializer must be constant expression.

  L13:      WEEKDAY_ORDINAL = "weekdayOrdinal",
  L14:      WEEK_OF_MONTH = "weekOfMonth",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 84
In ambient enum declarations member initializer must be constant expression.

  L83:  export declare enum ILocalNotificationActionType {
  L84:      INPUT = "input",
  L85:      BUTTON = "button",

[19:01:09] typescript: D:/PushPOC/PushPOC/node_modules/@ionic-native/local-notifications/index.d.ts, line: 85
In ambient enum declarations member initializer must be constant expression.

  L84:      INPUT = "input",
  L85:      BUTTON = "button",

Error: Failed to transpile program
at new BuildError (D:\PushPOC\PushPOC\node_modules@ionic\app-scripts\dist\util\errors.js:16:28)
at D:\PushPOC\PushPOC\node_modules@ionic\app-scripts\dist\transpile.js:159:20
at new Promise ()
at transpileWorker (D:\PushPOC\PushPOC\node_modules@ionic\app-scripts\dist\transpile.js:107:12)
at Object.transpile (D:\PushPOC\PushPOC\node_modules@ionic\app-scripts\dist\transpile.js:64:12)
at D:\PushPOC\PushPOC\node_modules@ionic\app-scripts\dist\build.js:109:82

@rwillett
Copy link
Collaborator

The template is there for a reason, it provides useful information.

We have no idea about what plugin version, what ionic version, what other plugins you have, what android version, what phone you have, what code you are running, what you have done, what you haven't, how you have installed, what android SDK.

@sharatchandra99
Copy link
Author

sharatchandra99 commented Apr 13, 2018

Thanks for quick reply.

please find package.json, config.xml and ionic info for more details:

package.json:
{ "name": "io.cordova.myapp6f2394", "author": "", "homepage": "", "private": true, "scripts": { "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "ionic:build": "ionic-app-scripts build", "ionic:serve": "ionic-app-scripts serve", "watch": "ionic-app-scripts watch" }, "dependencies": { "@angular/common": "2.4.8", "@angular/compiler": "2.4.8", "@angular/compiler-cli": "2.4.8", "@angular/core": "2.4.8", "@angular/forms": "2.4.8", "@angular/http": "2.4.8", "@angular/platform-browser": "2.4.8", "@angular/platform-browser-dynamic": "2.4.8", "@angular/platform-server": "2.4.8", "@ionic-native/core": "^4.6.0", "@ionic-native/local-notifications": "^4.7.0", "@ionic-native/push": "^4.6.0", "@ionic/storage": "2.0.0", "cordova-android": "6.3.0", "cordova-plugin-badge": "^0.8.7", "cordova-plugin-device": "^2.0.1", "cordova-plugin-ionic-keyboard": "^2.0.5", "cordova-plugin-ionic-webview": "^1.1.16", "cordova-plugin-local-notification": "^0.9.0-beta.2", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-whitelist": "^1.3.3", "ionic-angular": "2.2.0", "ionic-native": "2.4.1", "ionicons": "3.0.0", "phonegap-plugin-push": "^2.1.3", "rxjs": "5.0.1", "sw-toolbox": "3.4.0", "zone.js": "0.7.2" }, "devDependencies": { "@ionic/app-scripts": "^3.1.8", "typescript": "2.0.9" }, "description": "Ionic2Tabs: An Ionic project", "cordovaPlugins": [ "cordova-plugin-whitelist", "cordova-plugin-console", "cordova-plugin-statusbar", "cordova-plugin-device", "cordova-plugin-splashscreen", "ionic-plugin-keyboard" ], "cordovaPlatforms": [], "-vs-binding": { "BeforeBuild": [ "ionic:build" ] }, "cordova": { "plugins": { "cordova-plugin-whitelist": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-webview": {}, "cordova-plugin-ionic-keyboard": {}, "phonegap-plugin-push": { "FCM_VERSION": "11.6.2" }, "cordova-plugin-local-notification": {} }, "platforms": [ "android" ] } }

Config.xml:
<?xml version='1.0' encoding='utf-8'?> <widget id="com.notification.poc" version="0.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>NotificationPOC</name> <description>An awesome Ionic/Cordova app.</description> <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author> <content src="index.html" /> <access origin="*" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <preference name="ScrollEnabled" value="false" /> <preference name="android-minSdkVersion" value="16" /> <preference name="BackupWebStorage" value="none" /> <preference name="SplashMaintainAspectRatio" value="true" /> <preference name="FadeSplashScreenDuration" value="300" /> <preference name="SplashShowOnlyFirstTime" value="false" /> <preference name="SplashScreen" value="screen" /> <preference name="SplashScreenDelay" value="3000" /> <platform name="android"> <allow-intent href="market:*" /> <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" /> <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" /> <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" /> <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" /> <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" /> <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" /> <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" /> <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" /> <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" /> <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" /> <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" /> <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" /> <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" /> <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" /> <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" /> <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" /> <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" /> <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" /> </platform> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> <icon height="57" src="resources/ios/icon/icon.png" width="57" /> <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" /> <icon height="40" src="resources/ios/icon/icon-40.png" width="40" /> <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" /> <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" /> <icon height="50" src="resources/ios/icon/icon-50.png" width="50" /> <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" /> <icon height="60" src="resources/ios/icon/icon-60.png" width="60" /> <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" /> <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" /> <icon height="72" src="resources/ios/icon/icon-72.png" width="72" /> <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" /> <icon height="76" src="resources/ios/icon/icon-76.png" width="76" /> <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" /> <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" /> <icon height="29" src="resources/ios/icon/icon-small.png" width="29" /> <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" /> <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" /> <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" /> <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" /> <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" /> <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" /> <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" /> <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" /> <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" /> <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" /> <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" /> <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" /> <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" /> <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" /> <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" /> </platform> <plugin name="cordova-plugin-whitelist" spec="^1.3.3" /> <plugin name="cordova-plugin-device" spec="^2.0.1" /> <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" /> <plugin name="cordova-plugin-ionic-webview" spec="^1.1.16" /> <plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" /> <plugin name="phonegap-plugin-push" spec="^2.1.3"> <variable name="SENDER_ID" value="608303837297" /> <variable name="FCM_VERSION" value="11.6.2" /> </plugin> <platform name="android"> <resource-file src="google-services.json" target="google-services.json" /> </platform> <platform name="ios"> <resource-file src="GoogleService-Info.plist" /> </platform> <engine name="android" spec="6.3.0" /> <plugin name="cordova-plugin-local-notification" spec="^0.9.0-beta.2" /> </widget>

ionic Info:
cli packages: (C:\Users\sdoulaghar\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 2.2.0

System:

Android SDK Tools : 25.2.5
Node              : v8.9.4
npm               : 5.6.0
OS                : Windows 10

Environment Variables:

ANDROID_HOME : D:\base-android-sdk

Am Using Moto E phone for testing and I Installed the following cordova and npm plugins from terminal:
ionic cordova plugin add cordova-plugin-local-notification
npm install --save @ionic-native/local-notifications

After installation, I added the following import line in app.module.ts
import { LocalNotifications } from '@ionic-native/local-notifications';

and then in providers I added the LocalNotifications.

@ignasg
Copy link

ignasg commented Apr 22, 2018

I had the same issue and upgrading to typescript 2.4 causes more troubles than it solves. This is not production code, but you can change two bits of code where compilation fails in
node_modules@ionic-native\local-notifications\index.d.ts

declare const SECOND = "second";
declare const MINUTE = "minute";
declare const HOUR = "hour";
declare const DAY = "day";
declare const WEEK = "week";
declare const MONTH = "month";
declare const QUARTER = "quarter";
declare const YEAR = "year";
declare const WEEKDAY = "weekday";
declare const WEEKDAY_ORDINAL = "weekdayOrdinal";
declare const WEEK_OF_MONTH = "weekOfMonth";


export declare enum ELocalNotificationTriggerUnit {
    SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR, WEEKDAY, WEEKDAY_ORDINAL, WEEK_OF_MONTH
}
declare const INPUT = "input";
declare const BUTTON = "button";
export declare enum ILocalNotificationActionType {
    INPUT, BUTTON
}

And then it should at least compile with older typescript

@juanjoseadan
Copy link

I ran into this problem a few minutes ago, if you see the complete error you'll notice that the error is with the Ionic plugin. You just need to downgrade @ionic-native/local-notifications to previous version (4.6.0) and that's all.

@kunalkakkad
Copy link

I had the same issue and upgrading to typescript 2.4 causes more troubles than it solves. This is not production code, but you can change two bits of code where compilation fails in
node_modules@ionic-native\local-notifications\index.d.ts

declare const SECOND = "second";
declare const MINUTE = "minute";
declare const HOUR = "hour";
declare const DAY = "day";
declare const WEEK = "week";
declare const MONTH = "month";
declare const QUARTER = "quarter";
declare const YEAR = "year";
declare const WEEKDAY = "weekday";
declare const WEEKDAY_ORDINAL = "weekdayOrdinal";
declare const WEEK_OF_MONTH = "weekOfMonth";


export declare enum ELocalNotificationTriggerUnit {
    SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR, WEEKDAY, WEEKDAY_ORDINAL, WEEK_OF_MONTH
}
declare const INPUT = "input";
declare const BUTTON = "button";
export declare enum ILocalNotificationActionType {
    INPUT, BUTTON
}

And then it should at least compile with older typescript

Hello team,
using the solution by @ignasg it is working fine and perfect but we all know that its not correct method for the same. So expecting the team of @katzer to look over and try to publish the latest version for the same.

Thanks,
Kunal Kakkad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants