ionic新建工程並打包
1、新建工程
D:\project\eyeshot\eyeshot>ionic start app tabs [INFO] You are about to create an Ionic 3 app. Would you like to try Ionic 4 (beta)?
Ionic 4 uses the power of the modern Web and embraces the Angular CLI and Angular Router to bring you the best version of Ionic ever. See our blog announcement[1] and documentation[2] for more information. We'd love to hear your feedback on our latest version!
[1]: https://blog.ionicframework.com/announcing-ionic-4-beta/ [2]: https://beta.ionicframework.com/docs/
? Try Ionic 4? No [INFO] Existing git project found (D:/project/eyeshot/eyeshot). Git operations are disabled. √ Preparing directory .\app - done! √ Downloading and extracting tabs starter - done!
Installing dependencies may take several minutes.
✨ IONIC DEVAPP ✨
Speed up development with the Ionic DevApp, our fast, on-device testing mobile app
- ? Test on iOS and Android without Native SDKs - ? LiveReload for instant style and JS updates
--> Install DevApp: https://bit.ly/ionic-dev-app <--
────────────────────────────────────────────────────────────
> npm i npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version. npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version. npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.
> [email protected] install D:\project\eyeshot\eyeshot\app\node_modules\node-sass > node scripts/install.js
Cached binary found at C:\Users\lenovo\AppData\Roaming\npm-cache\node-sass\4.9.0\win32-x64-64_binding.node
> [email protected] postinstall D:\project\eyeshot\eyeshot\app\node_modules\uglifyjs-webpack-plugin > node lib/post_install.js
> [email protected] postinstall D:\project\eyeshot\eyeshot\app\node_modules\node-sass > node scripts/build.js
Binary found at D:\project\eyeshot\eyeshot\app\node_modules\node-sass\vendor\win32-x64-64\binding.node Testing binary Binary is fine npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN [email protected] requires a peer of [email protected]^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 716 packages from 635 contributors in 18.679s
? IONIC PRO ?
Supercharge your Ionic development with the Ionic Pro SDK
- ⚠️ Track runtime errors in real-time, back to your original TypeScript - ? Push remote updates and skip the app store queue
Learn more about Ionic Pro: https://ionicframework.com/pro
────────────────────────────────────────────────────────────
? Install the free Ionic Pro SDK and connect your app? Yes > npm i --save -E @ionic/pro npm WARN [email protected] requires a peer of [email protected]^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ionic/[email protected] requires a peer of [email protected]^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ @ionic/[email protected] added 1 package from 1 contributor in 4.112s > ionic link --name app ? What would you like to do? Link an existing app on Ionic Pro √ Looking up your apps - done! ? Which app would you like to link app (257e003a) √ Looking up app 257e003a - done!
[INFO] Ionic Pro uses a git-based workflow to manage app updates.
You will be prompted to set up the git host and repository for this new app. See the docs[1] for more information.
[1]: https://ionicframework.com/docs/pro/basics/git/
? Which git host would you like to use? Ionic Pro > ionic config set pro_id "257e003a" --json [OK] pro_id set to "257e003a"! > ionic git remote > git init Initialized empty Git repository in D:/project/eyeshot/eyeshot/app/.git/ [WARN] Initializing a git repository for your project.
Before your first git push ionic master, you'll want to commit all the files in your project:
git commit -a -m "Initial commit"
> git remote add ionic [email protected]:daqiang/app.git [OK] Added remote ionic. [OK] Project linked with app 257e003a!
[INFO] Next Steps:
- Go to your newly created project: cd .\app - Get Ionic DevApp for easy device testing: https://bit.ly/ionic-dev-app - Finish setting up Ionic Pro Error Monitoring: https://ionicframework.com/docs/pro/monitoring/#getting-started - Finally, push your code to Ionic Pro to perform real-time updates, and more: git push ionic master
D:\project\eyeshot\eyeshot>cd app
2、安裝包
D:\project\eyeshot\eyeshot\app>npm install npm WARN @ionic/[email protected] requires a peer of [email protected]^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected]^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
up to date in 3.799s
3、啟動服務
D:\project\eyeshot\eyeshot\app>ionic serve > ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser [app-scripts] [15:32:21] ionic-app-scripts 3.2.0 [app-scripts] [15:32:21] watch started ... [app-scripts] [15:32:21] build dev started ... [app-scripts] [15:32:21] clean started ... [app-scripts] [15:32:21] clean finished in 2 ms [app-scripts] [15:32:21] copy started ... [app-scripts] [15:32:21] deeplinks started ... [app-scripts] [15:32:21] deeplinks finished in 10 ms [app-scripts] [15:32:21] transpile started ... [app-scripts] [15:32:23] transpile finished in 2.21 s [app-scripts] [15:32:23] preprocess started ... [app-scripts] [15:32:23] preprocess finished in less than 1 ms [app-scripts] [15:32:23] webpack started ... [app-scripts] [15:32:23] copy finished in 2.35 s [app-scripts] [15:32:26] webpack finished in 2.29 s [app-scripts] [15:32:26] sass started ... [app-scripts] [15:32:26] sass finished in 860 ms [app-scripts] [15:32:26] postprocess started ... [app-scripts] [15:32:26] postprocess finished in 5 ms [app-scripts] [15:32:26] lint started ... [app-scripts] [15:32:26] build dev finished in 5.47 s [app-scripts] [15:32:27] watch ready in 5.54 s
[INFO] Development server running!
Local: http://localhost:8100 External: http://192.168.0.102:8100 DevApp: [email protected] on DQ
Use Ctrl+C to quit this process
[INFO] Browser window opened to http://localhost:8100!
[app-scripts] [15:32:29] lint finished in 2.44 s 終止批處理操作嗎(Y/N)? y
4、打包
D:\project\eyeshot\eyeshot\app>ionic cordova run android --device > ionic integrations enable cordova [INFO] Downloading integration cordova [INFO] Copying integrations files to project CREATE config.xml CREATE resources CREATE resources\android CREATE resources\icon.png CREATE resources\ios CREATE resources\README.md CREATE resources\splash.png CREATE resources\ios\icon CREATE resources\ios\splash CREATE resources\android\icon CREATE resources\android\splash CREATE resources\android\icon\drawable-hdpi-icon.png CREATE resources\android\icon\drawable-ldpi-icon.png CREATE resources\android\icon\drawable-mdpi-icon.png CREATE resources\android\icon\drawable-xhdpi-icon.png CREATE resources\android\icon\drawable-xxhdpi-icon.png CREATE resources\android\icon\drawable-xxxhdpi-icon.png CREATE resources\ios\icon\icon-1024.png CREATE resources\ios\icon\icon-40.png CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\icon-50.png CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\icon-60.png CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\icon-72.png CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\icon-76.png CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\icon-small.png CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\[email protected] CREATE resources\ios\icon\icon.png CREATE resources\ios\icon\[email protected] CREATE resources\ios\splash\[email protected]~iphone.png CREATE resources\ios\splash\Default-667h.png CREATE resources\ios\splash\Default-736h.png CREATE resources\ios\splash\Default-Landscape-736h.png CREATE resources\ios\splash\[email protected]~ipad.png CREATE resources\ios\splash\[email protected]~ipadpro.png CREATE resources\ios\splash\Default-Landscape~ipad.png CREATE resources\ios\splash\[email protected]~ipad.png CREATE resources\ios\splash\[email protected]~ipadpro.png CREATE resources\ios\splash\Default-Portrait~ipad.png CREATE resources\ios\splash\[email protected]~iphone.png CREATE resources\ios\splash\[email protected]~universal~anyany.png CREATE resources\ios\splash\Default~iphone.png CREATE resources\android\splash\drawable-land-hdpi-screen.png CREATE resources\android\splash\drawable-land-ldpi-screen.png CREATE resources\android\splash\drawable-land-mdpi-screen.png CREATE resources\android\splash\drawable-land-xhdpi-screen.png CREATE resources\android\splash\drawable-land-xxhdpi-screen.png CREATE resources\android\splash\drawable-land-xxxhdpi-screen.png CREATE resources\android\splash\drawable-port-hdpi-screen.png CREATE resources\android\splash\drawable-port-ldpi-screen.png CREATE resources\android\splash\drawable-port-mdpi-screen.png CREATE resources\android\splash\drawable-port-xhdpi-screen.png CREATE resources\android\splash\drawable-port-xxhdpi-screen.png CREATE resources\android\splash\drawable-port-xxxhdpi-screen.png [OK] Integration cordova added! > cordova platform add android --save Using cordova-fetch for [email protected]~7.1.1 Adding android project... Creating Cordova project for the Android platform: Path: platforms\android Package: io.ionic.starter Name: MyApp Activity: MainActivity Android target: android-27 Android project created with [email protected] Android Studio project detected Android Studio project detected Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
Adding cordova-plugin-whitelist to package.json Saved plugin info for "cordova-plugin-whitelist" to config.xml Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to the project Installing "cordova-plugin-statusbar" for android Adding cordova-plugin-statusbar to package.json Saved plugin info for "cordova-plugin-statusbar" to config.xml Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project Installing "cordova-plugin-device" for android Adding cordova-plugin-device to package.json Saved plugin info for "cordova-plugin-device" to config.xml Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it to the project Installing "cordova-plugin-splashscreen" for android Adding cordova-plugin-splashscreen to package.json Saved plugin info for "cordova-plugin-splashscreen" to config.xml Discovered plugin "cordova-plugin-ionic-webview" in config.xml. Adding it to the project Installing "cordova-plugin-ionic-webview" for android Subproject Path: CordovaLib Subproject Path: app Adding cordova-plugin-ionic-webview to package.json Saved plugin info for "cordova-plugin-ionic-webview" to config.xml Discovered plugin "cordova-plugin-ionic-keyboard" in config.xml. Adding it to the project Installing "cordova-plugin-ionic-keyboard" for android Adding cordova-plugin-ionic-keyboard to package.json Saved plugin info for "cordova-plugin-ionic-keyboard" to config.xml --save flag or autosave detected Saving [email protected]~7.1.2 into config.xml file ... > ionic-app-scripts build --target cordova --platform android [15:34:25] ionic-app-scripts 3.2.0 [15:34:25] build dev started ... [15:34:26] clean started ... [15:34:26] clean finished in 11 ms [15:34:26] copy started ... [15:34:26] deeplinks started ... [15:34:26] deeplinks finished in 16 ms [15:34:26] transpile started ... [15:34:29] transpile finished in 3.57 s [15:34:29] preprocess started ... [15:34:29] preprocess finished in 1 ms [15:34:29] webpack started ... [15:34:29] copy finished in 3.73 s [15:34:32] webpack finished in 2.66 s [15:34:32] sass started ... [15:34:33] sass finished in 895 ms [15:34:33] postprocess started ... [15:34:33] postprocess finished in 5 ms [15:34:33] lint started ... [15:34:33] build dev finished in 7.28 s [15:34:35] lint finished in 2.31 s > cordova run android --device Android Studio project detected ANDROID_HOME=C:\Users\lenovo\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171 studio Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details :wrapper
BUILD SUCCESSFUL in 5s 1 actionable task: 1 executed Subproject Path: CordovaLib Subproject Path: app Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details publishNonDefault is deprecated and has no effect anymore. All variants are now published. The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead. at build_4qn5yqfuwmg23b7w9if8zaiqq.run(D:\project\eyeshot\eyeshot\app\platforms\android\app\build.gradle:143) Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead. :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preDebugBuild UP-TO-DATE :CordovaLib:compileDebugAidl :CordovaLib:compileDebugRenderscript :CordovaLib:checkDebugManifest :CordovaLib:generateDebugBuildConfig :CordovaLib:prepareLintJar :CordovaLib:generateDebugResValues :CordovaLib:generateDebugResources :CordovaLib:packageDebugResources :CordovaLib:platformAttrExtractor :CordovaLib:processDebugManifest :CordovaLib:javaPreCompileDebug :CordovaLib:processDebugJavaRes NO-SOURCE :app:preBuild UP-TO-DATE :app:preDebugBuild :app:compileDebugAidl :CordovaLib:packageDebugRenderscript NO-SOURCE :app:compileDebugRenderscript :app:checkDebugManifest :app:generateDebugBuildConfig :app:prepareLintJar :app:generateDebugResValues :app:generateDebugResources :app:mergeDebugResources :app:createDebugCompatibleScreenManifests :app:processDebugManifest :app:splitsDiscoveryTaskDebug :app:compileDebugNdk NO-SOURCE :CordovaLib:mergeDebugShaders :CordovaLib:compileDebugShaders :CordovaLib:generateDebugAssets :CordovaLib:mergeDebugAssets :app:mergeDebugShaders :app:compileDebugShaders :app:generateDebugAssets :app:mergeDebugAssets :CordovaLib:compileDebugNdk NO-SOURCE :CordovaLib:mergeDebugJniLibFolders :CordovaLib:transformNativeLibsWithMergeJniLibsForDebug :CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug :app:mergeDebugJniLibFolders :app:processDebugJavaRes NO-SOURCE :app:validateSigningDebug :CordovaLib:processDebugResources :CordovaLib:generateDebugSources ע: ijЩ�����ļ�ʹ�û?����ѹ�ʱ�� API�� ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣 :CordovaLib:compileDebugJavaWithJavac :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug :app:processDebugResources :app:generateDebugSources :app:javaPreCompileDebug ע: ijЩ�����ļ�ʹ�û?����ѹ�ʱ�� API�� ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣 :app:compileDebugJavaWithJavac :app:compileDebugSources :app:transformClassesWithStackFramesFixerForDebug :app:transformClassesWithDesugarForDebug :app:transformClassesWithDexBuilderForDebug :app:transformDexArchiveWithExternalLibsDexMergerForDebug :app:transformDexArchiveWithDexMergerForDebug :app:transformNativeLibsWithMergeJniLibsForDebug :app:transformResourcesWithMergeJavaResForDebug :app:packageDebug :app:assembleDebug :app:cdvBuildDebug
BUILD SUCCESSFUL in 20s 46 actionable tasks: 46 executed Built the following apk(s): D:\project\eyeshot\eyeshot\app\platforms\android\app\build\outputs\apk\debug\app-debug.apk ANDROID_HOME=C:\Users\lenovo\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171 Failed to deploy to device, no devices found. [ERROR] An error occurred while running subprocess cordova.
cordova run android --device exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.