I'm trying to remove all my lint warnings but I'm stuck with one of the compile
to implementation
migrations.
If I change this:
compile fileTree(include: ['*.jar'], dir: 'libs')
to this:
implementation fileTree(include: ['*.jar'], dir: 'libs')
then the app won't build and I get the following error:
Error:Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: ... unresolved supertypes: veg.mediaplayer.sdk.MediaPlayer.MediaPlayerCallback
Is this a bug or am I supposed to do something different for fileTree? I couldn't find any explanations looking at the documentation: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html.
I've changed all the other lines in all gradle files from compile
to implementation
and they all work fine.
Edit: I should also note that this particular module does have a jar in the lib folder. For modules with no jars it works.
Edit 2: I've noticed that actually it doesn't always happen if there is a jar. I have another module with a jar (that I created) and it works fine. Something must be wrong with the mediaplayersdk.jar.
Given that it's only complaining about the callback that is implemented from a file in the jar, I suppose that is where it's getting stuck.
I also tried with Android Studio 3.1.0-beta1 and gradle 4.4 but it didn't help.
A FileTree represents a hierarchy of files. It extends FileCollection to add hierarchy query and manipulation methods. You typically use a FileTree to represent files to copy or the contents of an archive. Summarizing, you can include any .
The compileOnly configuration has been deprecated for resolution.
To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build. gradle file. This declares a dependency on an Android library module named "mylibrary" (this name must match the library name defined with an include: in your settings.
Ok I feel like an idiot now. All I had to do was read the documentation more carefully and I would have seen that api
is the equivalent of compile
and is supported going forward.
Using api
works!
i.e. api fileTree(include: ['*.jar'], dir: 'libs')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With