<rt id="hkid1"></rt>
    <s id="hkid1"><meter id="hkid1"></meter></s>
  1. <rp id="hkid1"><meter id="hkid1"></meter></rp>
    <source id="hkid1"></source>
  2. <ruby id="hkid1"><optgroup id="hkid1"></optgroup></ruby>

    Cordova 初識

    小編:管理員 218閱讀 2022.09.13

    Cordova 是使用 HTML,CSS 和 JavaScript構建混合移動應用程序的平臺。官方文檔給了我們 Cordova 的定義。

    “Apache Cordova是一個開源移動開發框架,它允許您使用標準的Web技術,如HTML5,CSS3和JavaScript進行跨平臺開發,避免每個移動平臺本機開發語言。應用程序在針對每個平臺的包裝內執行,并依靠符合標準的API綁定來訪問每個設備的傳感器,數據和網絡狀態。"

    Cordova

    Cordova提供了一組設備相關的API,通過這組API,移動應用能夠以JavaScript訪問原生的設備功能,如攝像頭、麥克風等。

    1. Installing Cordova$ npm install -g cordova

    Cordova command-line runs on Node.js and is available on NPM. Follow platform specific guides to install additional platform dependencies. Open a command prompt or Terminal, and type npm install -g cordova.

    2. Create a project

    cordova create <path>.

    $ cordova create myapp com.mycompany.myteam.myapp MyApp

    3. Add a platform

    To add a platform, typecordova platform add <platform name>.

    4. Run your app From the command line, runcordova run <platform name>.

    5. Common next steps

    • Read the docs
    • Add a Plugin
    • Customize app icons
    • Configure Your App
    Add Platforms

    cordova platform add android

    Install pre-requisites for building

    To check your current set of platforms 檢查您當前的平臺集

    cordova platform ls

    likaideMacBook-Pro:myapp ale$ cordova platform ls
    
    Installed platforms:
      android 7.1.4
    Available platforms: 
      browser ~5.0.1
      ios ~4.5.4
      osx ~4.0.1
      windows ~6.0.0
    復制

    To check if you satisfy requirements for building the platform:

    cordova requirements

    Build the App 創建應用程序

    Run the following command to build the project for all platforms:$ cordova build

    You can optionally limit the scope of each build to specific platforms - 'ios' in this case:$ cordova build ios

    可以將手機插入您的電腦和直接測試應用程式:

    $ cordova run android

    Add Plugins 添加插件 A plugin exposes a Javascript API for native SDK functionality.

    你也可以使用 CLI 來啟動搜索頁面: $ cordova plugin search camera

    To add and save the camera plugin to config.xml and package.json

    $ cordova plugin add cordova-plugin-camera
    
    Fetching plugin "cordova-plugin-camera@~2.1.0" via npm
    Installing "cordova-plugin-camera" for android
    Installing "cordova-plugin-camera" for ios
    復制Updating Cordova and Your Project

    在安裝 cordova 實用程序之后,你總是可以通過運行以下命令將其更新為最新版本:$ sudo npm update -g cordova

    運行 cordova-v 查看當前運行的版本。 要找到最新發布的 cordova 版本,你可以運行:$ npm info cordova version

    Customize Icons This section shows how to configure an application's icon for various platforms. Documentation about splash screen images can be found in the Cordova-Plugin-Splashscreen documentation Splashscreen plugin docs.

    Plugin Upgrades 插件升級

    目前還沒有使用單一命令升級更改過的插件的機制。 取而代之的是,移除插件并將其添加到你的項目中,新版本將被安裝:

    cordova plugin rm "some-plugin"
    cordova plugin add "some-plugin"
    復制安卓平臺Setting the Version Code 設定版本代碼

    更改應用程序生成的 apk 的版本代碼,請在應用程序的 config.xml 文件的 widget 元素中設置 android-versionCode 屬性。 如果沒有設置 android-versionCode,則將使用 version 屬性確定版本代碼。

    對于發布簽名,可以排除密碼,構建系統將提示輸入密碼。

    使用Android Studio 進行調試

    Please note that when opening your project in Android studio, it is recommended that you do NOT edit your code in the IDE.

    下載資源gradle 下載

    Gradle Build Tool https://gradle.org/

    android plugin 和 required Gradle version的對應關系

    相關問答

    : Downloading https://services.gradle.org/distributions/gradle-4.1-all.zip Exception in thread "main" java.net.UnknownHostException: services.gradle.org at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java :184) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

    : 根據url下載對應zip壓縮包, 并找到對應目錄, Copy到對應下載文件夾

    關聯標簽:
    快三群