Capacitor: bug: “error: package android.support.v4.content does not exist”

Created on 24 Apr 2020  Â·  3Comments  Â·  Source: ionic-team/capacitor

Bug Report

Capacitor Version

2.0.1

npx cap doctor output:

Affected Platform(s)

  • [X] Android
  • [ ] iOS
  • [ ] Electron
  • [ ] Web

Current Behavior


error: package android.support.v4.content does not exist

Expected Behavior


https://ionicframework.com/docs/native/camera

Sample Code or Sample Application Repo

https://github.com/Hansel03/photoApp

Reproduction Steps

ionic build
ionic capacitor add android
ionic capacitor open android

Other Technical Details

npm --version output: 6.13.4

node --version output: v12.16.1

pod --version output (iOS issues only): 1.9.1

ionic/angular 5.0.0

Android Studio 3.6.3
Captura de Pantalla 2020-04-22 a la(s) 4 38 15 p  m

Other Information

https://github.com/ionic-team/capacitor/issues/1663

Most helpful comment

@jcesarmobile Thank you so much . was getting error :

error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;

using jetify helped to solve .

from jcesarmobile' s post --- >https://github.com/ionic-team/capacitor/pull/2832

Error: "package android.support.* does not exist"

This error occurs when some Cordova or Capacitor plugin has old android support dependencies instead of using the new AndroidX equivalent.
You should report the issue in the plugin repository so the maintainers can update the plugin to use AndroidX dependencies.

As workaround you can also patch the plugin using jetifier

```bash
npm install jetifier
npx jetify
npx cap sync android

All 3 comments

This is a problem on plugins not using old android support dependencies instead of AndroidX equivalent.
Capacitor 2 requires AndroidX dependencies.
It's documented on the migration guide, but since some people can face this in new apps that are not migrated from Capacitor 1, I've added some information about it on the android troubleshooting guide

@jcesarmobile Thank you so much . was getting error :

error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;

using jetify helped to solve .

from jcesarmobile' s post --- >https://github.com/ionic-team/capacitor/pull/2832

Error: "package android.support.* does not exist"

This error occurs when some Cordova or Capacitor plugin has old android support dependencies instead of using the new AndroidX equivalent.
You should report the issue in the plugin repository so the maintainers can update the plugin to use AndroidX dependencies.

As workaround you can also patch the plugin using jetifier

```bash
npm install jetifier
npx jetify
npx cap sync android

@jcesarmobile Thank you so much . was getting error :

error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;

using jetify helped to solve .

from jcesarmobile' s post --- >#2832

Error: "package android.support.* does not exist"

This error occurs when some Cordova or Capacitor plugin has old android support dependencies instead of using the new AndroidX equivalent.
You should report the issue in the plugin repository so the maintainers can update the plugin to use AndroidX dependencies.

As workaround you can also patch the plugin using jetifier

npm install jetifier
npx jetify
npx cap sync android

Thank you so much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicobytes picture nicobytes  Â·  3Comments

MatanYadaev picture MatanYadaev  Â·  3Comments

mlynch picture mlynch  Â·  3Comments

json-derulo picture json-derulo  Â·  3Comments

alexcroox picture alexcroox  Â·  3Comments