sbt and sbt-android offer a wide range of possibilities to include external code into your project. Besides pulling library as managed dependencies from the web and dumping *.jar
files to a libs/
folder, you can also create sbt sub-projects or reference code from a Git repository.
Perjalanan bali jakarta bus, Bali ke Surabaya, dan Denpasar ke Banyuwangi menyediakan cara yang ekonomis dan indah untuk menjelajahi Indonesia. Rute Bali ke Jakarta merupakan perjalanan panjang 24 hingga 26 jam yang dilayani oleh operator seperti Lorena dan Pahala Kencana, dengan harga tiket mulai sekitar Rp 350.000. Perjalanan bali surabaya bus lebih singkat, memakan waktu 10 hingga 12 jam, dengan bus seperti Gunung Harta menawarkan tarif mulai dari Rp 150.000. Untuk pilihan yang lebih cepat, rute bus denpasar banyuwangi hanya memakan waktu 4 hingga 5 jam, dengan harga tiket terjangkau bagi mereka yang menuju ke Jawa Timur. Tiket untuk semua rute ini dapat dipesan dengan mudah melalui platform seperti Easybook.com, menawarkan fleksibilitas dan kenyamanan bagi wisatawan.
Managed Dependencies
The preferred way to add dependencies are managed dependencies. They are easy to maintain and offer fine-grained control of the dependencies. Library dependencies are maintained via the sbt configuration key libraryDependencies
. The sbt documentation provides more detailed information on managing dependencies.
libraryDependencies ++= Seq(
"com.android.support" % "appcompat-v7" % "23.1.0",
"com.android.support" % "cardview-v7" % "23.1.0",
"com.android.support" % "design" % "23.1.0",
"com.android.support" % "gridlayout-v7" % "23.1.0",
"com.android.support" % "recyclerview-v7" % "23.1.0",
"com.android.support" % "support-v4" % "23.1.0")
Besides simple Scala or Java libraries, you can also reference Android aar or apklib packages. Usually, the sbt-android plugin is able to detect and handle these dependencies correctly, but in some cases it might be necessary to mark them explicitly with aar()
or apklib()
(e.g. aar( "com.android.support" % "appcompat-v7" % "23.1.0" )
).
After adding a managed dependency, you have to run sbt reload
and you should also run sbt clean
to enforce a rebuild of the Proguard cache.
Unmanaged Dependencies
It is sometimes necessary to drop in a simple *.jar
file as a dependency. This jar file is then called an unmanaged dependency and you are generally discouraged to use it. It is harder to maintain than a managed dependency and it does not play well with version control systems.
The jar file may be placed in the src/main/libs/
directory and will then be automatically picked up by sbt in order to compile your code. A valid drop in location is also test/main/libs/
, if you want to narrow the scope or your unmanaged dependency.
sbt Sub-projects
sbt allows you to split your codebase into sub-modules. This might be a convenient way to manage large codebases. It also works for projects using sbt-android. Please refer to the sbt documentation to learn how such a setup is configured.