{"id":10272,"date":"2023-06-23T01:43:43","date_gmt":"2023-06-23T08:43:43","guid":{"rendered":"https:\/\/www.couchbase.com\/developers\/tutorials\/android-kotlin-prebuilt-database\/"},"modified":"2023-06-23T01:43:43","modified_gmt":"2023-06-23T08:43:43","slug":"android-kotlin-prebuilt-database","status":"publish","type":"tutorials","link":"https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/","title":{"rendered":"Include a Pre-built Database with Kotlin and Jetpack Compose"},"content":{"rendered":"\n<h3 id=\"h-introduction\" class=\"wp-block-heading\">Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In this part of the learning path, you will be working with the &#8220;Audit Inventory&#8221; demo app that allows users to log in and access the developer screens in order to validate the use of a pre-build database in the demo application that is used to store warehouse and stock item documents.  The warehouse and stock item documents will be used in future steps of the learning path when we need to add projects and audits to the database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this step of the learning path you will learn the fundamentals of:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Including a prebuilt database in an Android mobile application<\/li>\n\n\n<li>Preparing the prebuilt database for use<\/li>\n\n\n<li>Creating an Index<\/li>\n\n\n<li>Validating the database works for future steps<\/li>\n\n<\/ul>\n\n\n\n<h3 id=\"h-app-overview\" class=\"wp-block-heading\">App Overview<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">While the demo app has a lot of functionality, this step will walk you through:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log in into the application<\/li>\n\n\n<li>Accessing the Developer Screen<\/li>\n\n\n<li>Accessing the Developer &#8211; Database Information screen<\/li>\n\n\n<li>Reviewing the Logcat logs<\/li>\n\n\n<li>Reviewing the files on the emulator using Device File Explorer<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"app_demo_location_count.gif\" alt=\"App Demo,300\"><\/p>\n\n\n\n<h3 id=\"h-installation\" class=\"wp-block-heading\">Installation<\/h3>\n\n\n\n<h4 id=\"h-fetching-app-source-code\" class=\"wp-block-heading\">Fetching App Source Code<\/h4>\n\n\n\n<h5 id=\"h-clone-source-code\" class=\"wp-block-heading\">Clone Source Code<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you haven&#8217;t already cloned the repo from the previous step, clone the <code>Learn Couchbase Lite with Kotlin and Jetpack Compose<\/code> repository from GitHub.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-bash\"><code>git clone https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path.git\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-try-it-out\" class=\"wp-block-heading\">Try it out<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open src\/build.gradle using Android Studio.<\/li>\n\n\n<li>Build and run the project.<\/li>\n\n\n<li>Verify that you see the <code>No Items found in the database<\/code> message on the Projects screen.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"projects_no_items_screen.png\" alt=\"Projects No Items Screen Image\" title=\"#width=300px\"><\/p>\n\n\n\n<h3 id=\"h-data-model\" class=\"wp-block-heading\">Data Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A reminder that Couchbase Lite is a JSON Document Store. A <code>Document<\/code> is a logical collection of named fields and values. The values are any valid JSON types. In addition to the standard JSON types, Couchbase Lite supports <code>Date<\/code> and <code>Blob<\/code> data types. While it is not required or enforced, it is a recommended practice to include a <em>&#8220;type&#8221;<\/em> property that can serve as a namespace for related documents.<\/p>\n\n\n\n<h4 id=\"h-the-warehouse-document\" class=\"wp-block-heading\">The Warehouse Document<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The sample app comes bundled with a collection of <code>Document<\/code> with a <em>&#8220;documentType&#8221;<\/em> property of <em>&#8220;warehouse&#8221;<\/em>.  Each document represents an warehouse location that a team would visit in order to perform an audit of the inventory at that location.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An example of a document would be:<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>{\n  &quot;warehouseId&quot;:&quot;e1839e0b-57a0-472c-b29d-8d57e256ef32&quot;,\n  &quot;name&quot;:&quot;Santa Clara Warehouse&quot;,\n  &quot;address1&quot;:&quot;3250 Dr Olcott Street&quot;,\n  &quot;address2&quot;:&quot;&quot;,\n  &quot;city&quot;:&quot;Santa Clara&quot;,\n  &quot;state&quot;:&quot;CA&quot;,\n  &quot;postalCode&quot;:&quot;95054&quot;,\n  &quot;salesTax&quot;:0.0913,\n  &quot;latitude&quot;:32.3803024,\n  &quot;longitude&quot;:-121.9674197,\n  &quot;documentType&quot;:&quot;warehouse&quot;,\n  &quot;yearToDateBalance&quot;:0,\n  \t&quot;shippingTo&quot;: [\n\t\t\t&quot;AZ&quot;,\n\t\t\t&quot;CA&quot;,\n\t\t\t&quot;HI&quot;,\n\t\t\t&quot;NV&quot;\n\t\t],\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-the-warehouse-data-class\" class=\"wp-block-heading\">The Warehouse Data Class<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">When a <em>&#8220;warehouse&#8221;<\/em> is retreived from the database it is stored within an Data Class of type Warehouse.<\/p>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>data class Warehouse(\n    val warehouseId: String,\n    val name: String,\n    val address1: String,\n    val address2: String? = &quot;&quot;,\n    val city: String,\n    val state: String,\n    val postalCode: String,\n    val salesTax: Double,\n    val yearToDateBalance: Double,\n    val latitude: Double,\n    val longitude: Double,\n    val documentType: String,\n    val shippingTo: List&lt;String&gt;,\n    )\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-the-item-document\" class=\"wp-block-heading\">The Item Document<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The sample app comes bundled with a collection of <code>Document<\/code> with a <em>&#8220;documentType&#8221;<\/em> property of <em>&#8220;item&#8221;<\/em>.  Each document represents an item in stock that a team would count in order to perform an audit of the inventory in the warehouse.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An example of a document would be:<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>{\n  &quot;itemId&quot;:&quot;00b66fdf-9bdb-451b-bd2a-75bdf0459958&quot;,\n  &quot;name&quot;:&quot;Bachensteiner Beard Export&quot;,\n  &quot;price&quot;:24.22,\n  &quot;description&quot;:&quot;Tranquil Export with Bachensteiner flavors&quot;,\n  &quot;style&quot;: &quot;Imperial Stout&quot;,\n  &quot;documentType&quot;:&quot;item&quot;\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-the-stockitem-data-class\" class=\"wp-block-heading\">The StockItem Data Class<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">When a <em>&#8220;item&#8221;<\/em> is retreived from the database it is stored within an Data Class of type StockItem.<\/p>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>data class StockItem (\n    var itemId: String = &quot;&quot;,\n    var name: String = &quot;&quot;,\n    var price: Float,\n    var description: String = &quot;&quot;,\n    var style: String = &quot;&quot;,\n    var documentType: String = &quot;item&quot;)\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-using-a-prebuilt-database\" class=\"wp-block-heading\">Using a Prebuilt Database<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There are several reasons why you may want to bundle your app with a prebuilt database. This would be suited for data that does not change or change that often, so you can avoid the bandwidth and latency involved in fetching\/syncing this data from a remote server. This also improves the overall user experience by reducing the start-up time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our app, the instance of Couchbase Lite that holds the pre-loaded &#8220;warehouse&#8221; and &#8220;stockItem&#8221; data is separate from the Couchbase Lite instance that holds &#8220;user&#8221;, &#8220;project&#8221;, and &#8220;audit&#8221; data. A separate Couchbase Lite instance is not required. However, in our case, since there can be many users potentially using the app on a given device, it makes more sense to keep it separate. This is to avoid duplication of pre-loaded data for every user and to help speed up the app vs pulling down the warehoue and items when the app is first installed.<\/p>\n\n\n\n<h4 id=\"h-location-of-the-cblite-file\" class=\"wp-block-heading\">Location of the cblite file<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The pre-built database will be in the form of a cblite file. It should be in your app project bundle<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the startinglocations.zip file within the Assets folder.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"cblite_location.png\" alt=\"Prebuilt Database Location\" title=\"#width=300px\"><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The cblite folder will be extracted from the zip file.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-loading-the-prebuilt-database\" class=\"wp-block-heading\">Loading the Prebuilt Database<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/data\/DatabaseManager.kt#L72\"><strong>DatabaseManager.kt<\/strong><\/a> file and locate the <code>initializeDatabases()<\/code> function. The prebuilt database is common to all users of the app (on the device). So it will be loaded once and shared by all users on the device.  Note that the currentUser is required to setup the inventory database for use which holds the user profile documents, as covered in the Key Value step of the learning path.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>fun initializeDatabases(currentUser: User) \n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, we create an instance of the <code>DatabaseConfiguration<\/code> object and specify the path where the database would be located<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>val dbConfig = DatabaseConfigurationFactory.create(context.filesDir.toString())\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Then we determine if the &#8220;warehouse&#8221; database already exists at the specified location. It would not be present if this is the first time we are using the app, in which case, we locate the <em>&#8220;startingWarehouses.zip&#8221;<\/em> resource in the App&#8217;s main bundle, unzip it, and then we copy it over to the Database folder.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If the database is already present at the specified Database location, we simply open the database.<\/p>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>private fun setupWarehouseDatabase(dbConfig: DatabaseConfiguration) {\n \/\/ create the warehouse database if it doesn&#039;t already exist\n if (!Database.exists(warehouseDatabaseName, context.filesDir)) {\n  unzip(startingWarehouseFileName, File(context.filesDir.toString()))\n\n  \/\/ copy the warehouse database to the project database\n  \/\/ never open the database directly as this will cause issues\n  \/\/ with sync\n  val warehouseDbFile =\n   File(\n    String.format(\n    &quot;%s\/%s&quot;,\n    context.filesDir,\n    (&quot;${startingWarehouseDatabaseName}.cblite2&quot;)\n   )\n  )\n  Database.copy(warehouseDbFile, warehouseDatabaseName, dbConfig)\n }\n warehouseDatabase = Database(warehouseDatabaseName, dbConfig)\n}\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note:  You MUST copy the pre-built database using the Database.copy function instead of opening it directly or you will run into issues with data syncronization.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-indexing-the-database\" class=\"wp-block-heading\">Indexing the Database<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Creating indexes for non-FTS based queries is optional. However, to speed up queries, you can create indexes on the properties that you would query against.  Indexes can slow down writes, so it&#8217;s recommended adding indexes as you need them.  Indexing is handled eagerly.<\/p>\n<\/li>\n\n\n<li>\n<p>In the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/data\/DatabaseManager.kt#L209\"><strong>DatabaseManager.kt<\/strong><\/a>  file, locate the <code>createTypeIndex(database: Database?)<\/code> function.<\/p>\n<\/li>\n\n\n<li>\n<p>We create an index on the <code>documentType<\/code> property of the documents in the database that is referenced to the function using the databases createIndex function.  The createIndex function requires the name of the index along with the expression of what to index.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>private fun createTypeIndex(\n  database: Database?\n) {\n  \/\/ create index for document type if it doesn&#039;t exist\n  database?.let {\n    if (!it.indexes.contains(typeIndexName)) {\n      it.createIndex(\n        typeIndexName, IndexBuilder.valueIndex(\n          ValueIndexItem.expression(\n            Expression.property(typeAttributeName))\n        )\n      )\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note:  Since both databases have documents that use a <code>documentType<\/code> property, it was easier to create a function that could be used to create the index for either database.  The <code>typeIndexName<\/code> and <code>typeAttributeName<\/code> variables are defined at the top of the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/data\/DatabaseManager.kt#L22\"><strong>DatabaseManager<\/strong><\/a> class.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-closing-the-database\" class=\"wp-block-heading\">Closing the Database<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">When a user logs out, we close the pre-built database along with other user-specific databases<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>In the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/data\/DatabaseManager.kt#L63\"><strong>DatabaseManager.kt<\/strong><\/a>  file, locate the <code>closeDatabases()<\/code> function.<\/p>\n<\/li>\n\n\n<li>\n<p>Closing the databases is pretty straightforward<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-java\"><code>fun closeDatabases() {\n        try {\n            inventoryDatabase?.close()\n            warehouseDatabase?.close()\n        } catch (e: java.lang.Exception) {\n            android.util.Log.e(e.message, e.stackTraceToString())\n        }\n    }\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-try-it-out\" class=\"wp-block-heading\">Try It Out<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The app should be running in the emulator.<\/li>\n\n\n<li>Log in to the app with any email Id and password. Let&#8217;s use the values <strong><em>&#8220;<a href=\"mailto:demo@example.com\">demo@example.com<\/a>&#8220;<\/em><\/strong> and <strong><em>&#8220;P@ssw0rd12&#8221;<\/em><\/strong> for user Id and password fields respectively. If this is the first time that <strong><em>any<\/em><\/strong> user is signing in to the app, the pre-built database will be loaded from the App Bundle. In addition, a new team-specific Database will be created \/ opened.<\/li>\n\n\n<li>Confirm that the console log output has a message similar to the one below. This output also indicates the location of the pre-built database as well as the inventory database. In this example, we are logging in with a user email Id of <strong><em>&#8220;<a href=\"mailto:demo@example.com\">demo@example.com<\/a>&#8220;<\/em><\/strong>.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-bash\"><code>I\/CouchbaseLite\/DATABASE: Copying prebuilt database from \n\/data\/data\/com.couchbase.kotlin.learningpath\/files\/startingWarehouses.cblite2\/ \nto \/data\/user\/0\/com.couchbase.kotlin.learningpath\/files\/warehouse.cblite2\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The above log message indicates the location of the pre-built database as well as the Database for the inventory data. This would be within the <em>files<\/em> folder.<\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/developer.android.com\/studio\/debug\/device-file-explorer\"><strong>Open the folder on your computer<\/strong><\/a> and verify that a Database with name <em>&#8220;warehouse&#8221;<\/em> exists along with a team specific Database with name <em>&#8220;teamname_inventory&#8221;<\/em> where teamname is the name of the team the user is assigned to<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"device_explorer_files.png\" alt=\"Device File Explorer file listing\" title=\"#width=500px\"><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Click the Drawer menu icon (sometimes referred to the Hamburger icon) and tap on Developer<\/li>\n\n\n<li>Tap on the Database Information button<\/li>\n\n\n<li>Validate the Location Database Path, Warehouse Database Name, and Warehouse Count which should be 50<\/li>\n\n\n<li>Validate that the Stock Item Count is 3000\n<img decoding=\"async\" src=\"developer-database-info.jpg\" alt=\"Developer - Database Information\" title=\"#width=300px\"><\/li>\n\n<\/ul>\n\n\n\n<h3 id=\"h-learn-more\" class=\"wp-block-heading\">Learn More<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Congratulations on completing this step of our learning path!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This step of the learning path walked you through an example of how to use a pre-built Couchbase Lite database. Check out the following links for further documenation and continue on to the next step that covers how to insert documents into the database using Batch operations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">References<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/prebuilt-database.html\">Documentation: Pre-built Database<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/indexing.html\">Documentation: Indexing your Data<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/querybuilder.html#indexing\">Documentation: Querybuilder &#8211; Indexing<\/a><\/li>\n\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In this part of the learning path, you will be working with the &#8220;Audit Inventory&#8221; demo app that allows users to log in and access the developer screens in order to validate the use of a pre-build database in the demo application that is used to store warehouse and stock item documents. The warehouse [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"_acf":"","footnotes":""},"tutorial-languages":[586],"tutorial-tags":[587],"tutorial-technologies":[585],"tutorial-types":[555],"class_list":["post-10272","tutorials","type-tutorials","status-publish","hentry","tutorial-languages-kotlin","tutorial-tags-android","tutorial-technologies-mobile","tutorial-types-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Include a Pre-built Database with Kotlin and Jetpack Compose - Couchbase<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Include a Pre-built Database with Kotlin and Jetpack Compose\" \/>\n<meta property=\"og:description\" content=\"Introduction In this part of the learning path, you will be working with the &#8220;Audit Inventory&#8221; demo app that allows users to log in and access the developer screens in order to validate the use of a pre-build database in the demo application that is used to store warehouse and stock item documents. The warehouse [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/\" \/>\n<meta property=\"og:site_name\" content=\"Couchbase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Couchbase\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2548\" \/>\n\t<meta property=\"og:image:height\" content=\"1171\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@couchbase\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"8 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/developers\\\/tutorials\\\/android-kotlin-prebuilt-database\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/developers\\\/tutorials\\\/android-kotlin-prebuilt-database\\\/\",\"name\":\"Include a Pre-built Database with Kotlin and Jetpack Compose - Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/#website\"},\"datePublished\":\"2023-06-23T08:43:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/developers\\\/tutorials\\\/android-kotlin-prebuilt-database\\\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/developers\\\/tutorials\\\/android-kotlin-prebuilt-database\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/developers\\\/tutorials\\\/android-kotlin-prebuilt-database\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Include a Pre-built Database with Kotlin and Jetpack Compose\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/\",\"name\":\"Couchbase\",\"description\":\"The Operational Data Platform for AI\u2122\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/#organization\"},\"alternateName\":\"Couchbase, Inc.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/#organization\",\"name\":\"Couchbase\",\"alternateName\":\"Couchbase, Inc.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"width\":1129,\"height\":1129,\"caption\":\"Couchbase\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/pt\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Couchbase\\\/\",\"https:\\\/\\\/x.com\\\/couchbase\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/CouchbaseServer\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/couchbase\\\/\",\"https:\\\/\\\/github.com\\\/couchbase\\\/\",\"https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/Couchbase,_Inc.\"],\"description\":\"Couchbase is a database software company headquartered in San Jose, California, providing an operational data platform for AI used by hundreds of global enterprises.\",\"legalName\":\"Couchbase, Inc.\",\"foundingDate\":\"2011-01-01\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Include a Pre-built Database with Kotlin and Jetpack Compose - Couchbase","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/","og_locale":"pt_BR","og_type":"article","og_title":"Include a Pre-built Database with Kotlin and Jetpack Compose","og_description":"Introduction In this part of the learning path, you will be working with the &#8220;Audit Inventory&#8221; demo app that allows users to log in and access the developer screens in order to validate the use of a pre-build database in the demo application that is used to store warehouse and stock item documents. The warehouse [&hellip;]","og_url":"https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/","og_site_name":"Couchbase","article_publisher":"https:\/\/www.facebook.com\/Couchbase\/","og_image":[{"width":2548,"height":1171,"url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@couchbase","twitter_misc":{"Est. reading time":"8 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/","url":"https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/","name":"Include a Pre-built Database with Kotlin and Jetpack Compose - Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/pt\/#website"},"datePublished":"2023-06-23T08:43:43+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/pt\/developers\/tutorials\/android-kotlin-prebuilt-database\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/"},{"@type":"ListItem","position":2,"name":"Include a Pre-built Database with Kotlin and Jetpack Compose"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/pt\/#website","url":"https:\/\/www.couchbase.com\/pt\/","name":"Couchbase","description":"The Operational Data Platform for AI\u2122","publisher":{"@id":"https:\/\/www.couchbase.com\/pt\/#organization"},"alternateName":"Couchbase, Inc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/pt\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/pt\/#organization","name":"Couchbase","alternateName":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/pt\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/pt\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","contentUrl":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","width":1129,"height":1129,"caption":"Couchbase"},"image":{"@id":"https:\/\/www.couchbase.com\/pt\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Couchbase\/","https:\/\/x.com\/couchbase","https:\/\/www.youtube.com\/c\/CouchbaseServer","https:\/\/www.linkedin.com\/company\/couchbase\/","https:\/\/github.com\/couchbase\/","https:\/\/en.wikipedia.org\/wiki\/Couchbase,_Inc."],"description":"A Couchbase \u00e9 uma empresa de software de banco de dados com sede em San Jose, Calif\u00f3rnia, que fornece uma plataforma de dados operacional para a intelig\u00eancia artificial utilizada por centenas de empresas globais.","legalName":"Couchbase, Inc.","foundingDate":"2011-01-01"}]}},"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/pt\/wp-json\/wp\/v2\/tutorials\/10272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/pt\/wp-json\/wp\/v2\/tutorials"}],"about":[{"href":"https:\/\/www.couchbase.com\/pt\/wp-json\/wp\/v2\/types\/tutorials"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/pt\/wp-json\/wp\/v2\/tutorials\/10272\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/pt\/wp-json\/wp\/v2\/media?parent=10272"}],"wp:term":[{"taxonomy":"tutorial-languages","embeddable":true,"href":"https:\/\/www.couchbase.com\/pt\/wp-json\/wp\/v2\/tutorial-languages?post=10272"},{"taxonomy":"tutorial-tags","embeddable":true,"href":"https:\/\/www.couchbase.com\/pt\/wp-json\/wp\/v2\/tutorial-tags?post=10272"},{"taxonomy":"tutorial-technologies","embeddable":true,"href":"https:\/\/www.couchbase.com\/pt\/wp-json\/wp\/v2\/tutorial-technologies?post=10272"},{"taxonomy":"tutorial-types","embeddable":true,"href":"https:\/\/www.couchbase.com\/pt\/wp-json\/wp\/v2\/tutorial-types?post=10272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}