GithubHelp home page GithubHelp logo

anthrax3 / android-instant-apps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlearchive/android-instant-apps

0.0 1.0 0.0 549 KB

Samples for Android Instant Apps

Home Page: https://d.android.com/topic/instant-apps

License: Apache License 2.0

Java 80.97% Shell 0.45% Kotlin 18.44% IDL 0.13%

android-instant-apps's Introduction

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

cd instant/build/outputs/apk/debug # navigate to build dir
unzip instantapp-debug.zip # extract apks
adb install-multiple -r -t --instantapp *.apk # install apks

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

cd - # 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

  • Open Build Variants
  • Change each variant to a "minified" variant
  • Run the "instant" configuration of the sample

From the command line

  • Assemble a minified build ./gradlew assembleMinified
  • Navigate to instant/build/outputs/apk/*/minified
  • Run the instant app as described in the above section

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

Copyright 2017 Google Inc.

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

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

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

android-instant-apps's People

Contributors

donaldchai avatar keyboardsurfer avatar telpirion avatar tjohns avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.