Ionic 3 StatusBar not compiling on Android


#1

I get these errors when I try execute ionic run android:
symbol: class ViewGroup
location: class StatusBar
[MY_PROJECT]\platforms\android\src\com\tangide\statusbar\StatusBar\StatusBar.java:35: error: cannot find symbol
ViewGroup mContentView = (ViewGroup) this.findViewById(Window.ID_ANDROID_CONTENT);

symbol: class View
location: class StatusBar
[MY_PROJECT]\platforms\android\src\com\tangide\statusbar\StatusBar\StatusBar.java:44: error: package FrameLayout does not exist
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mChildView.getLayoutParams();

symbol: variable Window
location: class StatusBar
[MY_PROKECT]\platforms\android\src\com\tangide\statusbar\StatusBar\StatusBar.java:38: error: package WindowManager does not exist
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

Tried to reinstall the android platform and the cordova-plugin-statusbar but it didn’t help.
only if I remove the com.tangide.statusbar plugin can I compile my project

app.module.ts:
import { StatusBar } from '@ionic-native/status-bar';
....
imports: [BrowserModule,...]
providers: [StatusBar, ...]
app.component.ts:
import { StatusBar } from '@ionic-native/status-bar';
constructor(private statusBar: StatusBar,...){
     platform.ready().then(() => {
         this.statusBar.styleDefault();
   }
}
  • I have Android SDK Build-tools V26 installed.

  • This is me system information:
    Cordova CLI: 6.5.0
    Ionic CLI Version: 2.2.1
    Ionic App Lib Version: 2.2.0
    ios-deploy version: Not installed
    ios-sim version: Not installed
    OS: Windows 10
    Node Version: v6.11.0
    Xcode version: Not installed

  • This is my package.json:

{
	"name": "TMS",
	"author": "Adam Galmor",
	"homepage": "http://ionicframework.com/",
	"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"
	},
	"dependencies": {
		"@angular/common": "4.1.3",
		"@angular/compiler": "4.1.3",
		"@angular/compiler-cli": "4.1.3",
		"@angular/core": "4.1.3",
		"@angular/forms": "4.1.3",
		"@angular/http": "4.1.3",
		"@angular/platform-browser": "4.1.3",
		"@angular/platform-browser-dynamic": "4.1.3",
		"@ionic-native/core": "^3.12.1",
		"@ionic-native/push": "^3.12.1",
		"@ionic-native/splash-screen": "^3.12.1",
		"@ionic-native/status-bar": "^3.12.1",
		"@ionic/storage": "2.0.1",
		"chart.js": "2.2.1",
		"cordova-plugin-ms-azure-mobile-apps": "^2.0.0-rc1",
		"ionic-angular": "3.4.2",
		"ionic-native": "^2.9.0",
		"ionicons": "3.0.0",
		"moment": "^2.15.1",
		"ng2-charts": "^1.4.0",
		"reflect-metadata": "^0.1.3",
		"rxjs": "5.4.0",
		"sw-toolbox": "3.6.0",
		"vis": "4.17.0",
		"zone.js": "0.8.12"
	},
	"devDependencies": {
		"@ionic/app-scripts": "1.3.8",
		"typescript": "2.3.4"
	},
	"description": "Time Management System",
	"cordovaPlugins": [
		"cordova-plugin-device",
		"cordova-plugin-console",
		"cordova-plugin-whitelist",
		"cordova-plugin-splashscreen",
		"cordova-plugin-statusbar",
		"ionic-plugin-keyboard",
		"com.cmackay.plugins.googleanalytics",
		"cordova-plugin-inappbrowser",
		{
			"variables": {
				"SENDER_ID": "[YOUR_SENDER_ID]"
			},
			"locator": "phonegap-plugin-push"
		}
	],
	"cordovaPlatforms": []
}


#2

I had an old version of the cordova-plugin-statusbar (V2.2.0) on my config.xml, updating to V2.2.3 removed my errors