Ad
Storage Access Framework - Some Methods Of DocumentsContract Not Compiled When Included In My Android App
I would like to add Storage Access Framework support to my app.
I created an utility Java class for some SAF operations.
I added it to a sample project with
compileSdkVersion 29
buildToolsVersion "29.0.0"
minSdkVersion 25
targetSdkVersion 29
and
import androidx.documentfile.provider.DocumentFile;
is inclued.
It is successfully compiled.
My app has
compileSdkVersion 21
buildToolsVersion '28.0.3'
minSdkVersion 21
targetSdkVersion 26
But I see that the method names in
DocumentContracts.copyDocument()
and
DocumentContracts.removeDocument()
are in red (but they belong to API level 19).
If I include
import androidx.documentfile.provider.DocumentFile;
I see that
documentfile
is in red.
Note that auto-completion works on
DocumentsContract
and shows me many methods from SAF.
Furthermore I see that some exceptions are not required anymore like when
renameDocument()
or
createDocument()
are used.
What is wrong? What is the fix?
Ad
Answer
your app has minSdkVersion 21
(= the app promises to run on android-21 and newer) while your lib has minSdkVersion 25
(=the lib tells that it can not run on android-24 or older)
so your 21-app cannot use your 25-lib
Ad
source: stackoverflow.com
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad