bubblewrap
Bubblewrap is a Command Line Interface (CLI) that helps developers to create a Project for an Android application that launches an existing Progressive Web App (PWAs) using a Trusted Web Activity.
Top Related Projects
WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
An installation and update framework for Windows desktop apps
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
The snapd and snap tools enable systems to work with .snap files.
Linux application sandboxing and distribution framework
Quick Overview
Bubblewrap is a command-line tool that helps developers create and manage Progressive Web Apps (PWAs) as Android App Bundles or APKs. It simplifies the process of packaging a PWA for distribution on the Google Play Store, allowing developers to focus on building the app rather than dealing with the complexities of the Android platform.
Pros
- Simplified Packaging: Bubblewrap abstracts away the complexities of packaging a PWA for Android, making the process more straightforward and efficient.
- Cross-Platform Compatibility: Bubblewrap supports multiple platforms, including Windows, macOS, and Linux, allowing developers to work on their preferred operating system.
- Automated Build Process: Bubblewrap automates the build process, reducing the time and effort required to create and update Android packages.
- Customization Options: Bubblewrap provides various configuration options, allowing developers to tailor the app's appearance and behavior to their specific needs.
Cons
- Dependency on Google Play Services: Bubblewrap relies on Google Play Services, which may not be available on all Android devices, potentially limiting the app's reach.
- Limited Functionality: While Bubblewrap simplifies the packaging process, it may not provide the same level of control and customization as manual Android app development.
- Potential Learning Curve: Developers who are new to PWAs or the Android platform may need to invest time in understanding Bubblewrap's capabilities and how to use it effectively.
- Potential Compatibility Issues: As with any tool that interacts with the Android ecosystem, there may be occasional compatibility issues with newer Android versions or device configurations.
Code Examples
Not applicable, as Bubblewrap is a command-line tool and not a code library.
Getting Started
To get started with Bubblewrap, follow these steps:
- Install Node.js and npm (the Node.js package manager) on your system.
- Install the Bubblewrap CLI tool globally using npm:
npm install -g @bubblewrap/cli
- Create a new Bubblewrap project:
This will generate abubblewrap init
bubblewrap.json
configuration file in your project directory. - Customize the
bubblewrap.json
file to match your PWA's settings, such as the app name, version, and icons. - Build the Android App Bundle or APK:
This will create the Android package file in thebubblewrap build
build
directory. - (Optional) Publish the Android package to the Google Play Store using the Google Play Console.
For more detailed instructions and advanced usage, refer to the Bubblewrap documentation.
Competitor Comparisons
WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
Pros of winget-cli
- Comprehensive Package Management: winget-cli provides a comprehensive package management solution for Windows, allowing users to install, update, and remove a wide range of applications from a centralized repository.
- Integration with Windows: As a Microsoft-developed tool, winget-cli is deeply integrated with the Windows operating system, providing a seamless user experience.
- Extensive Package Catalog: The winget-cli repository offers a vast collection of pre-configured packages, making it easy for users to find and install the software they need.
Cons of winget-cli
- Limited Cross-Platform Support: winget-cli is primarily designed for Windows and may not be as widely adopted or supported on other operating systems.
- Dependency on Microsoft Ecosystem: The reliance on the Microsoft ecosystem could be a drawback for users who prefer a more open and platform-agnostic approach to software management.
- Potential Vendor Lock-in: The tight integration with the Windows platform may lead to a degree of vendor lock-in, limiting the flexibility for users who require more cross-platform compatibility.
Code Comparison
Here's a brief code comparison between a few lines of code from the GoogleChromeLabs/bubblewrap
and microsoft/winget-cli
repositories:
GoogleChromeLabs/bubblewrap
def _get_package_info(self):
"""Retrieves package information from the Android Manifest."""
package_name = self.manifest.get('package')
version_name = self.manifest.get('versionName')
version_code = self.manifest.get('versionCode')
return package_name, version_name, version_code
microsoft/winget-cli
public static async Task<int> ExecuteCommandAsync(string[] args, CancellationToken cancellationToken)
{
var app = new App();
var commandLineParser = new CommandLineParser(app);
var result = await commandLineParser.ParseAsync(args, cancellationToken);
if (result.HasErrors)
{
return (int)Constants.ErrorCode.InvalidArguments;
}
return await app.ExecuteAsync(result, cancellationToken);
}
An installation and update framework for Windows desktop apps
Pros of Squirrel/Squirrel.Windows
- Automatic Updates: Squirrel.Windows provides a seamless and automatic update mechanism, allowing users to receive the latest version of the application without manual intervention.
- Cross-Platform Compatibility: While Squirrel.Windows is primarily focused on Windows, it can also be used to create installers for macOS and Linux platforms, making it a versatile solution.
- Simplicity: Squirrel.Windows has a relatively straightforward setup process and a user-friendly API, making it accessible for developers.
Cons of Squirrel/Squirrel.Windows
- Limited Customization: Compared to Bubblewrap, Squirrel.Windows may offer less flexibility in terms of customizing the installer and the application's packaging.
- Dependency on .NET Framework: Squirrel.Windows requires the .NET Framework to be installed on the target system, which may not be suitable for all deployment scenarios.
- Potential Performance Impact: The automatic update mechanism in Squirrel.Windows may have a slight performance impact on the application, especially for larger updates.
Code Comparison
Bubblewrap (GoogleChromeLabs/bubblewrap):
const bubblewrap = require('@google/bubblewrap');
bubblewrap.build({
dir: 'path/to/your/app',
name: 'My App',
packageId: 'com.example.myapp',
version: '1.0.0',
// Other configuration options
});
Squirrel.Windows (Squirrel/Squirrel.Windows):
using Squirrel;
using (var mgr = new UpdateManager("https://example.com/releases"))
{
await mgr.UpdateApp();
// Other Squirrel.Windows functionality
}
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Pros of Electron
- Electron provides a comprehensive framework for building desktop applications, allowing developers to leverage web technologies like HTML, CSS, and JavaScript.
- The Electron ecosystem is well-established, with a large and active community, extensive documentation, and a wide range of third-party libraries and tools.
- Electron enables cross-platform development, allowing developers to create applications that can run on Windows, macOS, and Linux.
Cons of Electron
- Electron applications can be resource-intensive, as they bundle a full Chromium instance and Node.js runtime, which can lead to increased memory usage and slower startup times.
- The size of Electron-based applications can be larger compared to native desktop applications, as they include the entire Chromium and Node.js frameworks.
- Electron may not be the best choice for lightweight or simple desktop applications, as the overhead of the framework may outweigh the benefits.
Code Comparison
Electron:
const { app, BrowserWindow } = require('electron');
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
});
win.loadFile('index.html');
}
app.whenReady().then(createWindow);
Bubblewrap:
class MyActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_my)
// Bubblewrap-specific code
val webView = findViewById<WebView>(R.id.webview)
webView.loadUrl("https://example.com")
}
}
The snapd and snap tools enable systems to work with .snap files.
Pros of Snapd
- Snapd is a cross-platform package manager, supporting multiple Linux distributions and architectures, while Bubblewrap is primarily focused on Android and Chrome OS.
- Snapd provides a robust sandboxing mechanism, ensuring better security and isolation of applications.
- Snapd has a larger ecosystem of available packages, with a wide range of applications and utilities.
Cons of Snapd
- Snapd can be more complex to configure and manage compared to Bubblewrap, which has a simpler and more streamlined approach.
- Snapd may have a higher resource footprint, as it requires a dedicated daemon running on the system.
Code Comparison
Bubblewrap:
def create_app_bundle(self, app_dir, output_file):
"""Create an Android App Bundle from the given app directory."""
bundle_tool = self.get_bundle_tool()
cmd = [bundle_tool, 'build-bundle', '--mode=app-bundle', app_dir, output_file]
self.run_command(cmd)
Snapd:
func (s *Overlord) Ensure() error {
s.ensureMu.Lock()
defer s.ensureMu.Unlock()
if s.ensureTimer == nil {
s.ensureTimer = time.NewTimer(0)
}
select {
case <-s.ensureTimer.C:
s.ensureTimer.Reset(s.ensureInterval)
default:
}
return s.ensureOnce()
}
Linux application sandboxing and distribution framework
Pros of Flatpak
- Sandboxing: Flatpak provides a robust sandboxing mechanism, ensuring that applications are isolated from the host system and from each other, improving security and stability.
- Cross-distribution compatibility: Flatpak applications can run on various Linux distributions, making it easier to develop and distribute software across different platforms.
- Automatic updates: Flatpak applications can be automatically updated, simplifying the update process for users.
Cons of Flatpak
- Increased disk space: Flatpak applications may require more disk space due to the inclusion of their own dependencies and libraries.
- Potential performance impact: The sandboxing and isolation mechanisms used by Flatpak may introduce a slight performance overhead compared to native applications.
- Limited access to system resources: Flatpak applications may have limited access to certain system resources, which could be a limitation for some use cases.
Code Comparison
Flatpak:
from gi.repository import Flatpak
from gi.repository import GLib
# Install a Flatpak application
installation = Flatpak.Installation.new_user()
ref = Flatpak.Ref.parse("app/org.example.MyApp/x86_64/stable")
installation.install(ref, Flatpak.InstallFlags.NONE, None, None, None)
Bubblewrap:
import subprocess
# Create a Bubblewrap sandbox
subprocess.run(["bwrap",
"--unshare-all",
"--share-net",
"--ro-bind", "/", "/",
"--bind", "/tmp", "/tmp",
"/usr/bin/env", "bash"], check=True)
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Bubblewrap
Bubblewrap is a set of tools and libraries designed to help developers to create, build and update projects for Android Applications that launch Progressive Web App (PWA) using Trusted Web Activity (TWA).
Requirements
- Node.js 14.15.0 or above
Getting Started
- To get started with building an application using Bubblewrap, check the Trusted Web Activity Quick Start Guide or the bubblewrap/cli documentation.
Bubblewrap Components
- bubblewrap/core: a javascript library for generating, building and updating TWA projects.
- bubblewrap/cli: a command-line version of Bubblewrap.
- bubblewrap/validator: library to validate the correctness and compare Trusted Web Activity projects against the quality criteria.
Community
We welcome anyone who wants to contribute with issues, feedback, feature requests or just generally discuss Bubblewrap. Alternatively developers can contribute to the conversation by joining the public monthly office hours, which hosted on every first Thursday at 5PM, London time. Check when the next office hours is going to happen via this calendar and join the meeting via this link.
Getting started with GUI tools
- If you are just getting started with APK generation from PWA, You might want to check PWABuilder. This tool is powered by Bubblewrap and uses the same underlying core.
Contributing
See CONTRIBUTING for more.
License
See LICENSE for more.
Disclaimer
This is not an officially supported Google product.
Top Related Projects
WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
An installation and update framework for Windows desktop apps
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
The snapd and snap tools enable systems to work with .snap files.
Linux application sandboxing and distribution framework
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot