1. 安装 angular, Ionic
2.Ionic start
一路选择,
这会先从github上download 选择的模板,如果当时离线,可以用离线包 https://github.com/ionic-team/ionic-conference-app
之后会 npm i
3.这就可以 ionic serve 看到界面了
4.集成 capacitor:
ionic integrations enable capacitor
4.1 这一步会下载 capacitor. npm.cmd i --save -E @capacitor/core
capacitor 不会全局安装。说是为了版本好管理。运行capacitor命令,用npx cap
cadova 却是全局安装的
4.2 接着执行这两个命令
npm.cmd i -D -E @capacitor/cli
capacitor.cmd init ionic-conference-app io.ionic.starter --web-dir www --npm-client npm
执行成功,会打印
* Your Capacitor project is ready to go! *
Add platforms using "npx cap add":
npx cap add android
npx cap add ios
npx cap add electron
5 npm install
6 ionic capacitor build android --prod --release
> capacitor.cmd add android √ Installing android dependencies in 15.82s √ Adding native android project in: D:Worklan_aunt est2android in 69.36ms √ Syncing Gradle in 414.70μp √ add in 15.90s √ Copying web assets from www to androidappsrcmainassetspublic in 757.50ms √ Copying native bridge in 2.30ms √ Copying capacitor.config.json in 1.70ms Found 4 Cordova plugins for android cordova-plugin-device (2.0.3) cordova-plugin-inappbrowser (3.2.0) cordova-plugin-statusbar (2.4.3) cordova-plugin-whitelist (1.3.4) √ copy in 905.76ms √ Updating Android plugins in 38.13ms Found 0 Capacitor plugins for android: Found 4 Cordova plugins for android cordova-plugin-device (2.0.3) cordova-plugin-inappbrowser (3.2.0) cordova-plugin-statusbar (2.4.3) cordova-plugin-whitelist (1.3.4) Found 3 incompatible Cordova plugins for android, skipped install cordova-plugin-ionic-keyboard (2.2.0) cordova-plugin-ionic-webview (4.1.3) cordova-plugin-splashscreen (5.0.3) √ update android in 129.46ms Now you can run npx cap open android to launch Android Studio > ng.cmd run app:build:production
7.在Android studio 里生成APK
可能会出现 fail to open zip. 这是下载的 Gradle 包不全。 可以下载完整的包,复制到 C:UsersQiGongbo.gradlewrapperdistsgradle-6.5-bin
就会在Build 下出现 build APKS
8. 点击 run ,可以运行 模拟器。
9.修改logo 和 Name
androidappsrcmain esvaluesstring.xml 这里修改名字
androidappsrcmain esmipmap-hdpi 修改Logo
10 发布到 应用市场
https://ionicframework.com/docs/deployment/play-store
其他资料:
https://raw.githubusercontent.com/airyland/china-area-data/master/v5/data.json