Skip to content

Why is Capacitor APK so much bigger than Cordova APK? #1922

@moose4lord

Description

@moose4lord

Description of the problem:
I have a small Ionic app I'm trying to migrate from Cordova to Capacitor, and I'm finding that the APK generated with Capacitor (using Android Studio to generate a signed APK) is quite a bit larger than my app built with Cordova. As a test I built the Ionic blank starter app both ways and with Cordova the APK is about 2MB, but with Capacitor the APK is about 4MB. Inspecting the APKs I see these differences:

                Cordova   Capacitor
                -------   ---------
classes.dex      66.8KB       1.4MB
resources.arsc    3.7KB     461.8KB

Am I missing some optimization step in the Capacitor build?

Affected platform

  • Android
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • macOS
  • linux

Other information:

Ionic:

   Ionic CLI                     : 5.2.7 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.8.1
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.0.0

Capacitor:

   Capacitor CLI   : 1.1.1
   @capacitor/core : 1.1.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 4 other plugins)

Utility:

   cordova-res : 0.6.0 
   native-run  : 0.2.8 

System:

   Android SDK Tools : 26.1.1
   NodeJS            : v12.9.1 (/usr/local/bin/node)
   npm               : 6.10.2
   OS                : macOS Mojave
   Xcode             : Xcode 10.3 Build version 10G8

Capacitor version: 1.1.1

node version: 12.9.1

npm version: 6.10.2

CocoaPods version:

Steps to reproduce:
Build the Ionic blank starter app

Link to sample project:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions