Ionic 官网对于Ionic的表述是:自Ionic4开始不再支持android5以下的机器。经过实测,Ionic4一直到Ionic5其实是可以运行在android5一下机器的(例如andriod4.4.4),但是确实有一些组建会出现样式问题,如下是我的项目中使用的package和样式修正的代码,期望帮到读者。
package.json
{
"name": "ionic4-starter-app",
"version": "0.0.1",
"author": "IonicThemes",
"homepage": "https://ionicthemes.com/",
"scripts": {
"start test server": "node ./test/server.js",
"ng": "ng",
"start": "ng serve --host=0.0.0.0",
"browser run": "ionic cordova run browser --host=0.0.0.0 ",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"android prod": "ionic cordova run android --prod",
"install android": "adb install platforms\\android\\app\\build\\outputs\\apk\\debug\\app-debug.apk",
"reinstall android": "adb install -r platforms\\android\\app\\build\\outputs\\apk\\debug\\app-debug.apk & adb shell am start -n io.ionic.starter/io.ionic.starter.MainActivity"
},
"private": true,
"dependencies": {
"@angular/common": "8.2.14",
"@angular/core": "8.2.14",
"@angular/forms": "8.2.14",
"@angular/platform-browser": "8.2.14",
"@angular/platform-browser-dynamic": "8.2.14",
"@angular/router": "8.2.14",
"@awesome-cordova-plugins/camera": "^5.41.0",
"@awesome-cordova-plugins/core": "^5.41.0",
"@ionic-native/core": "5.0.0",
"@ionic-native/splash-screen": "5.0.0",
"@ionic-native/status-bar": "5.0.0",
"@ionic/angular": "5.9.4",
"@ionic/cordova-builders": "^6.1.0",
"cordova-browser": "6.0.0",
"core-js": "^2.6.12",
"rxjs": "^6.5.5",
"ts-md5": "^1.2.11",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/architect": "~0.803.29",
"@angular-devkit/build-angular": "~0.803.29",
"@angular-devkit/core": "~8.3.29",
"@angular-devkit/schematics": "~8.3.29",
"@angular/cli": "~8.3.29",
"@angular/compiler": "~8.2.14",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@ionic/angular-toolkit": "~2.3.3",
"@ionic/lab": "1.0.23",
"@types/jasmine": "^2.8.19",
"@types/jasminewd2": "^2.0.10",
"@types/node": "~10.12.0",
"codelyzer": "~4.5.0",
"cordova-android": "^8.1.0",
"cordova-plugin-camera": "^4.1.0",
"cors": "^2.8.5",
"express": "^4.18.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.4",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"multer": "^1.4.4",
"protractor": "^5.4.4",
"ts-node": "~7.0.0",
"tslint": "~5.12.0",
"typescript": "^3.4.5"
},
"description": "IonicThemes Ionic4 Tutorial",
"cordova": {
"plugins": {
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
}
},
"platforms": [
"android",
"browser"
]
}
}
样式的修正主要是弹出层和选择框,配置在src/global.scss中:
.modal-wrapper,.action-sheet-wrapper {
transform: translate3d(0, 0, 0) !important;
-webkit-transform: translate3d(0, 0, 0) !important;
position: fixed !important;
top:0 !important;
bottom: 0 !important;
left: 0 !important;
right: 0 !important;
}