Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Firebase Studio offre diversi modi per visualizzare l'anteprima e testare la tua
applicazione durante lo sviluppo. Ciò include l'utilizzo di App Prototyping agent
e lo sfruttamento dei visualizzatori di anteprima web integrati e dei visualizzatori di anteprima web e Android
disponibili all'interno dei workspace Firebase Studio.
Attivare e configurare l'ambiente di anteprima
Se utilizzi un modello o generi la tua app
utilizzando App Prototyping agent, le anteprime
sono spesso già configurate. Se le anteprime non sono già configurate nel modello, puoi configurarle nel file di configurazione Nix del progetto.
Dallo spazio di lavoro, apri .idx/dev.nix.
Firebase Studio genera automaticamente questo file quando crei un nuovo spazio di lavoro e include tutti gli ambienti di anteprima applicabili in base al modello selezionato. Se il file non è presente nel repository di codice Firebase Studio, crealo e imposta l'attributo idx.previews su
true. Poi, aggiungi gli attributi di configurazione, come mostrato nell'esempio seguente:
{ pkgs,...}:{# NOTE: This is an excerpt of a complete Nix configuration example.# For more information about the dev.nix file in Firebase Studio, see# https://firebase.google.com/docs/studio/customize-workspace# Enable previews and customize configuration
idx.previews={enable=true;previews={# The following object sets web previewsweb={command=["npm""run""start""--""--port""$PORT""--host""0.0.0.0""--disable-host-check"];manager="web";# Optionally, specify a directory that contains your web app# cwd = "app/client";};# The following object sets Android previews# Note that this is supported only on Flutter workspacesandroid={manager="flutter";};};};}
Per un elenco completo degli attributi Nix in Firebase Studio, consulta Nix +
Firebase Studio.
Ricostruisci l'ambiente:
Dalla tavolozza dei comandi (Cmd+Shift+P/Ctrl+Shift+P), esegui il comando
Firebase Studio: Hard restart.
Nella notifica Configurazione dell'ambiente aggiornata, fai clic su
Ricrea ambiente.
Quando ricompili l'ambiente dopo aver modificato il file dev.nix,
nel riquadro di anteprima dell'area di lavoro vengono visualizzate una o entrambe le schede
Android e Web, a seconda di ciò che hai attivato.
Utilizzare le anteprime delle app
Firebase Studio offre anteprime web su Chrome e su emulatori Android negli spazi di lavoro Flutter che installano l'app nell'ambiente di anteprima. In questo modo
puoi testare la tua app completamente, end-to-end, direttamente dal tuo spazio di lavoro.
Aggiornare le anteprime per il web e Android
Firebase Studio si integra con le funzionalità di ricarica rapida dei framework sottostanti (come npm run start e flutter hot-reload) per offrirti un ciclo di sviluppo interno semplificato. Firebase Studio fornisce
i seguenti tipi di ricariche:
Ricarica rapida automatica: le ricariche rapide vengono eseguite automaticamente quando salvi un file. A volte noto come Hot Module Replacement (o HMR), un ricaricamento
rapido aggiorna l'app senza ricaricare la pagina (per le app web) o senza
riavviare o reinstallare l'app (per gli emulatori). Questo approccio è
utile per preservare lo stato attivo dell'app, ma potrebbe non funzionare sempre come
previsto.
Ricarica completa manuale: questa opzione equivale a un aggiornamento della pagina (per le app web) o a un riavvio dell'app (per gli emulatori). Ti consigliamo di utilizzare un ricaricamento completo per
acquisire modifiche significative al codice sorgente, ad esempio quando esegui il refactoring
di grandi blocchi di codice.
Riavvio forzato manuale: questa opzione esegue un riavvio completo del sistema di anteprima di Firebase Studio, che include l'arresto e il riavvio del server web della tua app.
Tutte le opzioni di ricaricamento sono disponibili utilizzando la barra degli strumenti di anteprima o il riquadro dei comandi (Cmd+Shift+P su Mac o Ctrl+Shift+P su ChromeOS, Windows o Linux), nella categoria Firebase Studio.
Per utilizzare la barra degli strumenti di anteprima:
Fai clic sull'icona Ricarica per aggiornare la pagina. In questo modo viene forzato un ricaricamento completo.
Per un altro tipo di aggiornamento, fai clic sulla freccia accanto all'icona di ricarica per
espandere il menu.
Seleziona l'opzione di aggiornamento che preferisci dal menu: Ricarica rapida, Ricarica
completa o Riavvio forzato.
Condividere l'anteprima web con altre persone
Puoi condividere l'anteprima web della tua app con altri utenti per ricevere feedback attivando l'accesso
e poi condividendo il link diretto all'anteprima:
Nella barra degli strumenti di anteprima web, fai clic sull'icona Condividi link di anteprima, a destra della barra degli indirizzi, per aprire
il menu di condivisione.
Consenti ad altri utenti di accedere al tuo spazio di lavoro utilizzando una delle seguenti opzioni:
Rendi pubblica l'anteprima: rendi l'anteprima del tuo spazio di lavoro accessibile pubblicamente. In questo modo, chiunque su internet
può raggiungere il server di anteprima in esecuzione nel tuo spazio di lavoro mentre il tuo spazio di lavoro
è attivo e finché non disattivi l'accesso pubblico.
Gestisci l'accesso allo spazio di lavoro. Condividi il tuo spazio di lavoro solo con le persone
a cui vuoi concedere l'accesso.
Seleziona Copia URL anteprima per copiare un link diretto all'anteprima dello spazio di lavoro,
che puoi poi inviare alle persone da cui vuoi ricevere feedback. Puoi
anche utilizzare il codice QR visualizzato per aprire l'anteprima sul tuo dispositivo
mobile.
Configurare il salvataggio automatico e il ricaricamento rapido
Per impostazione predefinita, Firebase Studio salva automaticamente il tuo lavoro un secondo dopo che hai smesso di digitare, attivando i ricaricamenti rapidi automatici. Se vuoi che
Firebase Studio salvi il tuo lavoro a un intervallo diverso, modifica l'impostazione
di salvataggio automatico. Puoi anche disattivare il salvataggio automatico.
Cerca File: Salvataggio automatico e verifica che il campo sia
impostato su `afterDelay`.
Cerca File: ritardo salvataggio automatico.
Inserisci un nuovo
intervallo di ritardo del salvataggio automatico, espresso in millisecondi. Le modifiche al tuo
lavoro vengono ora salvate automaticamente in base alla nuova impostazione di ritardo del salvataggio automatico.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-07-25 UTC."],[],[],null,["Firebase Studio offers several ways to preview and test your\napplication during development. This includes using the App Prototyping agent\nand leveraging the built-in web previewer, and the web and Android\npreviewers available within Firebase Studio workspaces.\n\nEnable and configure your preview environment\n\nIf you use a [template](/docs/studio/get-started-template) or generate your app\nusing the App Prototyping agent, previews are\noften already configured for you. If previews aren't already set up in your\ntemplate, you can configure them in the project's Nix configuration file.\n\n1. From your workspace, open `.idx/dev.nix`.\n\n Firebase Studio automatically generates this file when you create a\n new workspace and includes any applicable preview environments based on\n the template you select. If the file isn't in your Firebase Studio\n code repository, create it and then set the `idx.previews` attribute to\n `true`. Then, add configuration attributes, as the following example shows: \n\n { pkgs, ... }: {\n\n # NOTE: This is an excerpt of a complete Nix configuration example.\n # For more information about the dev.nix file in Firebase Studio, see\n # https://firebase.google.com/docs/studio/customize-workspace\n\n # Enable previews and customize configuration\n idx.previews = {\n enable = true;\n previews = {\n # The following object sets web previews\n web = {\n command = [\n \"npm\"\n \"run\"\n \"start\"\n \"--\"\n \"--port\"\n \"$PORT\"\n \"--host\"\n \"0.0.0.0\"\n \"--disable-host-check\"\n ];\n manager = \"web\";\n # Optionally, specify a directory that contains your web app\n # cwd = \"app/client\";\n };\n # The following object sets Android previews\n # Note that this is supported only on Flutter workspaces\n android = {\n manager = \"flutter\";\n };\n };\n };\n }\n\n For a full list of Nix attributes in Firebase Studio, see [Nix +\n Firebase Studio](/docs/studio/customize-workspace#nix+fs).\n2. Rebuild your environment:\n\n - From the command palette (`Cmd+Shift+P`/`Ctrl+Shift+P`), run the **Firebase Studio: Hard restart** command.\n - From the **Environment config updated** notification, click **Rebuild environment**.\n\n When you rebuild the environment after modifying your `dev.nix` file,\n the preview panel appears in your workspace showing either or both of\n **Android** and **Web** tabs, depending on what you've enabled.\n\n| **Key Point:** You can preview your app in a separate browser tab by clicking the **Open in new window** icon in the preview window toolbar. This pop-out link is also useful for demoing your work in progress to a friend or colleague through [workspace sharing](/docs/studio/share-your-workspace). If you close a preview and want to re-open it, open the command palette and search for the appropriate preview command.\n\nUse app previews\n\nFirebase Studio offers web previews on Chrome and Android emulators in\nFlutter workspaces that install your app on the preview environment. This lets\nyou test your app fully, from end to end, directly from your workspace.\n\nRefresh previews for web and Android\n\nFirebase Studio hooks into the hot reload functionalities of the\nunderlying frameworks (like `npm run start` and `flutter hot-reload`) to\ngive you a streamlined inner development loop. Firebase Studio provides\nthe following types of reloads:\n\n- **Automatic Hot Reload** : Hot reloads are automatically performed when you\n save a file. Sometimes known as *Hot Module Replacement* (or HMR), a hot\n reload updates your app without reloading the page (for web apps) or without\n restarting or reinstalling the app (for emulators). This approach is\n useful for preserving your app's live state but might not always work as\n intended.\n\n- **Manual Full Reload**: This option is equivalent to a page refresh (for web\n apps) or an app restart (for emulators). We recommend using a full reload to\n capture significant changes to your source code, such as when refactoring\n large chunks of code.\n\n- **Manual Hard Restart** : This option performs a complete restart of\n Firebase Studio's preview system, which includes stopping and\n restarting your app's web server.\n\nAll reload options are available using either the preview toolbar or the command\npalette (`Cmd+Shift+P` on Mac or `Ctrl+Shift+P` on ChromeOS, Windows, or\nLinux), under the **Firebase Studio** category.\n\nTo use the preview toolbar, follow these steps:\n\n1. Click the **Reload** icon to refresh the page. This forces a full reload.\n For a different type of refresh, click the arrow next to the reload icon to\n expand the menu.\n\n2. Select the refresh option you want from the menu: **Hot Reload** , **Full\n Reload** , or **Hard Restart**.\n\nShare your web preview with others\n\nYou can share your app's web preview with others for feedback by enabling access\nand then sharing the direct link to the preview:\n\n1. In the web preview toolbar, click the\n **Share Preview Link** icon, to the right of the address bar to open\n the sharing menu.\n\n2. Allow others to access your workspace, using one of these options:\n\n - **Make preview public** : Make your workspace preview publicly\n accessible. This lets anyone on the Internet\n reach the preview server running on your workspace *while your workspace\n is active*, and until you turn off public access.\n\n - **Manage workspace access**. Share your workspace with just the people\n to which you want to give access.\n\n | **Warning:** Sharing your workspace lets other users make changes to your code and access other private information like authentication tokens saved on the workspace, so only share with those you trust. Learn more at [Share your workspace](/docs/studio/share-your-workspace).\n3. Select **Copy preview URL** to copy a direct link to the workspace preview,\n which you can then send to those you'd like to get feedback from. You can\n also use the QR code that appears to open your preview on your mobile\n device.\n\nConfigure autosave and hot reload\n\nBy default, Firebase Studio autosaves your work one second after you\nstop typing, triggering automatic hot reloads. If you want\nFirebase Studio to save your work at a different interval, change the\nautosave setting. You can also turn off autosave. \n\nConfigure autosave\n\n1. Open [Firebase Studio](https://studio.firebase.google.com/).\n2. Click the **Settings** icon.\n3. Search for **Files: Auto Save** and verify that the field is set to \\`afterDelay\\`.\n4. Search for **Files: Auto Save\n Delay**.\n5. Enter a new autosave delay interval, expressed in milliseconds. Changes to your work are now automatically saved based on the new autosave delay setting. \n\nTurn off autosave\n\n1. Open [Firebase Studio](/docs/studio/https/studio.firebase.google.com).\n2. Click the **Settings** icon.\n3. Search for **Files: Auto Save**.\n4. Click the drop-down and select **off**.\n\nPreview backend disconnected\n\nYou can safely disregard the \"Preview backend disconnected\" message.\n\nNext steps\n\n- [Publish with Firebase](/docs/studio/deploy-app).\n- [Monitor your app](/docs/studio/monitor)."]]