-1

I tried to use FileProvider in my apk and got an error "FileProvider cannot be resolved".

According to the official documentation of FileProvider https://developer.android.com/reference/android/support/v4/content/FileProvider.html

I added import android.support.v4.content.FileProvider;

as a result I got one more error "import android.support cannot be resolved" After some googling I found that I need android-support-v4.jar and it should be in /sdk/extras/android/support/v4/

But, I don't have .../sdk/extras/android/support/v4/android-support-v4.jar

I tried to get extras by sdk Manager cd android-sdks/tools ./android sdk But it has not downloaded sdk/extras/android/support/v4/android-support-v4.jar

So, here is twwo questions 1. In which way my code (with FileProvider) should be built? 2. What had happened with android-support-v4.jar?

i716
  • 139
  • 1
  • 1
  • 5

1 Answers1

2

Add below dependency to build.gradle file.

dependencies{
     //......
     compile 'com.android.support:support-v4:25.0.0'
}
Sanjeet
  • 2,385
  • 1
  • 13
  • 22
  • Is it any way to overcome the error without using gradle (android studio) because right now I use scripts for building? I don't use eclipse or studio. – i716 Nov 10 '16 at 08:00
  • I'm using AIDE and I don't use gradle, how do I add the support library? – user3574895 Oct 12 '18 at 05:58