When you add new dependencies to an Android project, especially in Android Studio under Dependencies, there are three options for the Compile/Supply/APK section.
What are the implications if we use each of the options? Contrary to what the title says.
Treat the supplied and packaged parts well so they do what they are supposed to do.
supplied and packaged cannot be used with Android libraries and generate an error…. this with http://tools.android.com/tech-docs/new-build-system.
How can I solve this problem?
- provided – only depends on the compilation time
- Package – only package dependencies
- Compilation – dependence on compilation time and packing time
provided it is normally used for libraries based on annotation processing. Usually these libraries are divided into two artifacts – the annotation and the compiler. The compiler is a dependency because it does not need to be used in the application, only for compilation, and the annotation is a compilation dependency – it is used in the application code and thus compiled. Or the generated code requires additional dependencies and your application does not need them. For example, the configuration of the dagger dependency :
provided by ‘com.squareup.dolk:dolk-compiler:1.2.2’.
These features stem from the view of paradise.
They simply indicate how certain dependencies should be managed at each stage of the design process.
- compile is the default approach, it just means that all dependencies must be available at compile time. Compilation dependencies are available in all project class paths. Moreover, these dependencies extend to dependent projects. Compilation time dependency is normally required at runtime.
- Package – declares an additional configuration for building the application. You can create a list of plugins that add extra functionality to the build process.
- This means that the runtime environment contains these dependencies. For example, if you look in the android.jar library, you’ll see a java.lang.RuntimeException : Stump! in every body in the method.
This has certain consequences:
- You can develop Android applications locally without having a full Android environment.
- You will need to run your APK on your Android device or emulator, as they offer an implementation of these methods.
- Your applications that reference the classes in the SDK are built correctly because the jar provides class metadata.
- If you are not using a library that provides artifacts (e.g., Robolectric), you should run the tests on an emulator/device.
and the package cannot be used with Android libraries and generates an error.
Here’s what a set of sources looks like:
For more information about the mounting system: https://www.youtube.com/watch?v=LCJAgPkpmR0
Great article on the crib: http://www.sinking.in/blog/provided-scope-in-gradle/
Xavier is talking about the AIC sighting.
in the Android plugin is called the equivalent (kind of) runtime apk. You can make
apk files (‘libs/foo.jar’)
dependencies and it will only bundle on the compiled classpath, but not on these.
android dependencies list, gradle add dependency, gradle dependencies ( implementation), android studio add module dependency, gradle dependencies ( classpath), how to add google maven repository in android studio, android flavor dependencies, android studio conditional compilation, gradle install dependencies, how to install gradle in android studio, android aar include dependencies, where is build.gradle file in android studio, add dependency to gradle intellij, gradle dependencies compile vs implementation, compile gradle project with another project as a dependency