Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 4 tasks
Hansel03 opened this issue Apr 24, 2020 · 8 comments
Closed
1 of 4 tasks

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

Hansel03 opened this issue Apr 24, 2020 · 8 comments

Comments

@Hansel03
Copy link

Hansel03 commented Apr 24, 2020

Bug Report

Capacitor Version

2.0.1

npx cap doctor output:

Affected Platform(s)

  • 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

#1663

@jcesarmobile
Copy link
Member

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

@deborahjames
Copy link

deborahjames commented Jun 2, 2020

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

@thesurya9
Copy link

thesurya9 commented Nov 16, 2020

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.

@sasithahtl
Copy link

sasithahtl commented Feb 9, 2021

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

Thanks. This works.

@tirrth
Copy link

tirrth commented Apr 7, 2021

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

Thanks. This works just fine for me!!!

@marvinero1
Copy link

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

Thanks!!!!!

@mamta-99
Copy link

mamta-99 commented Jul 7, 2021

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

i'am still getting same error

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

@mamta-99
Copy link

mamta-99 commented Jul 7, 2021

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

\platforms\android\app\src\main\java\org\apache\cordova\camera\CordovaUri.java:25: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;

platforms\android\app\src\main\java\org\apache\cordova\camera\FileProvider.java:21: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {}

platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:303: error: cannot find symbol
this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider

@ionic-team ionic-team locked as resolved and limited conversation to collaborators Jul 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants