├── src └── android │ └── build.gradle ├── .prettierrc.json ├── .eslintrc.json ├── .editorconfig ├── plugin.xml ├── README.md ├── LICENSE ├── scripts └── android │ └── editManifest.js ├── package.json └── .travis.yml /src/android/build.gradle: -------------------------------------------------------------------------------- 1 | android { 2 | defaultConfig { 3 | multiDexEnabled true 4 | } 5 | } 6 | 7 | dependencies { 8 | implementation 'androidx.multidex:multidex:2.0.1' 9 | } 10 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "tabWidth": 4, 4 | "useTabs": false, 5 | "semi": false, 6 | "singleQuote": true, 7 | "trailingComma": "es5", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": true 10 | } 11 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": ["standard", "prettier"], 4 | "plugins": ["prettier"], 5 | "rules": { 6 | "prettier/prettier": "error" 7 | }, 8 | "env": { 9 | "jest": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # http://editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | # Change these settings to your own preference 10 | indent_style = space 11 | indent_size = 4 12 | 13 | # We recommend you to keep these unchanged 14 | end_of_line = lf 15 | charset = utf-8 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | 19 | [*.md] 20 | trim_trailing_whitespace = false 21 | -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Enable Multidex 8 | Enable multidex for Cordova apps with over 64K methods 9 | Adriano Di Giovanni 10 | MIT 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Multidex for Cordova 2 | 3 | [![Build Status](https://travis-ci.org/adriano-di-giovanni/cordova-plugin-enable-multidex.svg?branch=master)](https://travis-ci.org/adriano-di-giovanni/cordova-plugin-enable-multidex) 4 | 5 | Enable Multidex for Cordova Android apps with over 64K methods. 6 | 7 | When your app and the libraries it references exceed 65,536 methods, you encounter a build error that indicates your app has reached the limit of the Android build architecture. 8 | 9 | Move past this limitation by enabling an app configuration known as multidex, which allows your app to build and read multiple DEX files. 10 | 11 | More information can be found at https://developer.android.com/studio/build/multidex.html 12 | 13 | ## Installation 14 | 15 | ```bash 16 | cordova plugin add cordova-plugin-enable-multidex 17 | ``` 18 | 19 | ## Supported platforms 20 | 21 | * Android 22 | 23 | ## License 24 | 25 | This project is [MIT-licensed](https://github.com/adriano-di-giovanni/cordova-plugin-enable-multidex/blob/master/LICENSE). 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Adriano Di Giovanni 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /scripts/android/editManifest.js: -------------------------------------------------------------------------------- 1 | module.exports = function(context) { 2 | var fs = require('fs') 3 | var path = require('path') 4 | var Q = require('q') 5 | var xml = require('cordova-common').xmlHelpers 6 | 7 | var deferred = Q.defer() 8 | 9 | var platformRoot = path.join(context.opts.projectRoot, './platforms/android') 10 | 11 | var filepaths = [ 12 | path.join(platformRoot, './AndroidManifest.xml'), 13 | path.join(platformRoot, './app/src/main/AndroidManifest.xml'), 14 | ] 15 | 16 | var filepath = filepaths.find(function(filepath) { 17 | try { 18 | fs.accessSync(filepath, fs.constants.F_OK) 19 | return true 20 | } catch (err) { 21 | return false 22 | } 23 | }) 24 | 25 | var doc 26 | 27 | if (filepath != null) { 28 | doc = xml.parseElementtreeSync(filepath) 29 | doc.getroot().find('./application').attrib['android:name'] = 30 | 'androidx.multidex.MultiDexApplication' 31 | fs.writeFileSync(filepath, doc.write({ indent: 4 })) 32 | deferred.resolve() 33 | } else { 34 | deferred.reject(new Error("Can't find AndroidManifest.xml")) 35 | } 36 | 37 | return deferred.promise 38 | } 39 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-enable-multidex", 3 | "version": "0.2.0", 4 | "description": "Enable multidex for Cordova Android apps with over 64K methods", 5 | "scripts": { 6 | "precommit": "lint-staged" 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "git+https://github.com/adriano-di-giovanni/cordova-plugin-enable-multidex.git" 11 | }, 12 | "keywords": ["ecosystem:cordova", "cordova-android", "multidex"], 13 | "author": "Adriano Di Giovanni (http://adrianodigiovanni.com/)", 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/adriano-di-giovanni/cordova-plugin-enable-multidex/issues" 17 | }, 18 | "lint-staged": { 19 | "*.js": ["eslint --fix", "git add"], 20 | "*.json": ["prettier --write", "git add"] 21 | }, 22 | "homepage": "https://github.com/adriano-di-giovanni/cordova-plugin-enable-multidex#readme", 23 | "devDependencies": { 24 | "eslint": "^4.17.0", 25 | "eslint-config-prettier": "^2.9.0", 26 | "eslint-config-standard": "^11.0.0-beta.0", 27 | "eslint-plugin-import": "^2.8.0", 28 | "eslint-plugin-node": "^5.2.1", 29 | "eslint-plugin-prettier": "^2.6.0", 30 | "eslint-plugin-promise": "^3.6.0", 31 | "eslint-plugin-standard": "^3.0.1", 32 | "husky": "^0.14.3", 33 | "jest": "^22.1.4", 34 | "lint-staged": "^6.1.0", 35 | "prettier": "^1.10.2" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | env: 3 | global: 4 | - TRAVIS_NODE_VERSION="4.2" 5 | matrix: 6 | include: 7 | - env: PLATFORM=android-4.4 8 | os: linux 9 | language: android 10 | jdk: oraclejdk8 11 | android: 12 | components: 13 | - tools 14 | - build-tools-26.0.2 15 | - env: PLATFORM=android-5.1 16 | os: linux 17 | language: android 18 | jdk: oraclejdk8 19 | android: 20 | components: 21 | - tools 22 | - build-tools-26.0.2 23 | - env: PLATFORM=android-6.0 24 | os: linux 25 | language: android 26 | jdk: oraclejdk8 27 | android: 28 | components: 29 | - tools 30 | - build-tools-26.0.2 31 | - env: PLATFORM=android-7.0 32 | os: linux 33 | language: android 34 | jdk: oraclejdk8 35 | android: 36 | components: 37 | - tools 38 | - build-tools-26.0.2 39 | 40 | before_install: 41 | - rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install ${TRAVIS_NODE_VERSION} 42 | - node --version 43 | - gradle --version 44 | - echo y | android update sdk -u --filter android-22,android-23,android-24,android-25,android-26 45 | - git clone https://github.com/apache/cordova-paramedic /tmp/paramedic && pushd /tmp/paramedic && npm install && popd 46 | - npm install -g cordova 47 | 48 | install: 49 | npm install 50 | 51 | script: 52 | - node /tmp/paramedic/main.js --config pr/${PLATFORM} --plugin $(pwd) --justbuild 53 | --------------------------------------------------------------------------------