googlesamples/android-instant-apps

Name: android-instant-apps

Owner: Google Samples

Description: Samples for Android Instant Apps

Created: 2017-05-17 18:27:07.0

Updated: 2018-01-18 17:23:14.0

Pushed: 2017-12-14 17:08:45.0

Homepage: https://d.android.com/topic/instant-apps

Size: 549

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Android Instant Apps - Sample code collection

The samples in this repository demonstrate building and using APIs related to Android Instant Apps.

Getting started

Shared instructions on the samples are collected in this file. For sample specific instructions, enter a sample's directory and follow the corresponding README file.

Available samples

analytics -> Usage of Firebase Analytics

configuration-apk -> Introduces Configuration APKs

cookie-api -> Usage of the Cookie API

hello-java -> Hello World written in the Java Programming Language.

hello-kotlin -> Hello World written in Kotlin.

hello-feature-module -> Hello World with feature modules

install-api -> Introduces Install API

multi-feature-module -> More complex feature module sample

flavors -> product flavors in an Instant App

Running an Instant App sample
From Android Studio
  1. Select the instant feature module run configuration
  2. Run the selected configuration

Some samples provide multiple entry points. In this case you can choose which URL to use before starting the Instant App.

From the command line (Android O+)
Find the build output
  1. Run a gradle build ./gradlew assembleDebug.
  2. Locate the zip file containing the instant app. 2.1 This is usually located at ./instant/build/outputs/debug/instant-debug.zip 2.2 Some samples contain flavors. In these cases the output path is different. These build output paths will be specified in the sample in question.
Run the Instant App

From the sample's root directory, execute

nstant/build/outputs/apk/debug # navigate to build dir
p instantapp-debug.zip # extract apks
install-multiple -r -t --instantapp *.apk # install apks

unch entry point; you'll have to replace $(SAMPLE_ENTRY_POINT)
shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d $(SAMPLE_ENTRY_POINT)

 # takes you back to the root directory
Code minification & obfuscation

Each sample's minified build type has code minification enabled. In case API surfaces are being exposed to other modules, these surfaces are being explicitly excluded from the obfuscation process through a proguard configuration file. Take a look in a module's build.gradle file to see what is being done for that module.

Usage

From Android Studio

From the command line

Note: For samples containing flavors the paths & variant names will be slightly different.

Troubleshooting

Refer to the troubleshooting section of the Android Instant Apps documentation.

If you find an issue with a sample, please file a new issue.

In case you have questions on Instant Apps, refer to StackOverflow.

License
right 2017 Google Inc.

nsed to the Apache Software Foundation (ASF) under one or more contributor
nse agreements. See the NOTICE file distributed with this work for
tional information regarding copyright ownership. The ASF licenses this
 to you under the Apache License, Version 2.0 (the "License"); you may not
this file except in compliance with the License. You may obtain a copy of
License at

://www.apache.org/licenses/LICENSE-2.0

ss required by applicable law or agreed to in writing, software
ributed under the License is distributed on an "AS IS" BASIS, WITHOUT
ANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
nse for the specific language governing permissions and limitations under
License.

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.