• Stars
    star
    1,365
  • Rank 33,082 (Top 0.7 %)
  • Language
    Java
  • License
    Other
  • Created over 7 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A hotfix library for Android platform, and not just this...

中文版

wiki (deprecated)

changelog

Amigo Service Platform (Amigo backend service is no longer supported)

amigo.png

Amigo is a hotfix library which can fix everything for your Android app

How to use

Download

In your project's build.gradle

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'me.ele:amigo:0.6.8'
    }
}

In your module's build.gradle

apply plugin: 'me.ele.amigo'

android {
...
}

dependencies {
    ...
    compile 'me.ele:amigo-lib:0.6.7'
}

//if you don't want use amigo in dev, set this value to true
//you can define this extension in your mybuild.gradle as to distinguish debug & release build
amigo {
    disable false //default false
    autoDisableInInstantRunMode true // default false
}

Compatibility

  • Supports All Devices From ECLAIR 2.1 to Nougat 7.1
  • Even support next Android version, no matter small or big change. So Cool, Aha ✌️
  • Android 3.0 isn't supported

Customize loading page(optional)

Some time-consuming tasks are handled in a separate process to avoid ANR, you can customize the loading activity by add the follow code into your AndroidManifest.xml:

<meta-data
    android:name="amigo_layout"
    android:value="{your-layout-name}" />

<meta-data
    android:name="amigo_theme"
    android:value="{your-theme-name}" />

<meta-data
    android:name="amigo_orientation"
    android:value="{your-custom-orientation}"/>

Note:

  • These three meta-data is defined in your personal AndroidManifest.xml of app module if necessary
  • orientation's value must be in screenOrientation

Make hotfix work

There are two ways to make hotfix work.

  • if you don't need hotfix work immediately

    you just need to download new apk file, hotfix apk will be loaded as fresh as new when app restarts next time

     Amigo.workLater(context, patchApkFile, callback);
  • work immediately, App will restart immediately

     Amigo.work(context, patchApkFile);

Remove patch

Amigo.clear(context);

note:All patch files would be deleted on the next start up.

Demo

And there is an Demo page in the app demonstrating how to apply patch apk. Run the task ./gradlew runHost preparePatch, and navigate to the demo page.

Development

Amigo gradle plugin

The plugin was put into buildSrc directory, which means the plugin code change will work immediately each time you build.

Amigo lib

The amigo plugin will select the right amigo lib automatically.

Run tests

There are two gradle tasks provided in the app/build.gradle, :app:runHost, :app:preparePatch, which can accelerate development.

  • ./gradlew runHost, launch the host app
  • ./gradlew preparePatch, build and push the patch apk to the device
  • apply the patch apk in the Demo page

Limits

  • have to change the way using a content provider

    • declare a new provider: the authorities string must start with "${youPackageName}.provider"

      <provider
          android:name="me.ele.demo.provider.StudentProvider"
          android:authorities="${youPackageName}.provider.student" />
    • change the uri used to do the query, insert, delete operations:

      // 1. inside your app process, no modifications need:
      Cursor cursor = getContentResolver().query(Uri.parse("content://" + getPackageName() + ".provider.student?id=0"), null, null, null, null);
      // 2. in another process, have to change the authorities uri like the following :
      Cursor cursor = getContentResolver().query(Uri.parse("content://" + targetPackageName + ".provider/student?id=0"), null, null, null, null);
  • Instant Run conflicts with Amigo, so disable Instant Run when used with amigo(Or use autoDisableInInstantRunMode to auto disable amigo in instant run mode)

  • Amigo doesn't support Honeycomb 3.0

    • Android 3.0 is a version with full of bugs, & Google has closed Android 3.0 Honeycomb.
  • RemoteViews's layout change in notification & widgetis not support

    • any resource id in here should be used with java RCompat.getHostIdentifier(Context context, int id)

Retrieve hotfix file

  • make it simple, you just need a fully new apk

  • to save the internet traffic, you may just want to download a diff file bspatch (support whole apk diff & fine-grained diff in apk)is an option for you

Inspired by

Android Patch 方案与持续交付

DroidPlugin

License

  Copyright 2016 ELEME Inc.

  Licensed 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.

More Repositories

1

UETool

Show/edit any view's attributions on the screen.
Java
3,256
star
2

lancet

A lightweight and fast AOP framework for Android App and SDK developers
Java
2,083
star
3

morjs

基于小程序 DSL(微信、支付宝)的,可扩展的多端研发框架,支持一键将微信或支付宝小程序转换为微信、支付宝、百度、字节、QQ、快手、淘宝、钉钉等小程序 或 Web 应用。
TypeScript
1,400
star
4

Stinger

Stinger is a high-efficiency library with great compatibility, for aop in Objective-C, using libffi instead of Objective-C message forwarding. It is 20+ times faster than the Aspects, from message-sending to Aspect-oriented code ends.
Objective-C
988
star
5

corvus

A fast and lightweight Redis Cluster Proxy for Redis 3.0
C
791
star
6

Mess

a gradle plugin for minifying activities, services, receivers, providers and custom view
Groovy
682
star
7

Trojan

Trojan is an efficient mobile terminal lightweight log SDK
Java
390
star
8

dna

dna, dart native access. A lightweight dart to native super channel plugin, You can use it to invoke any native code directly in contextual and chained dart code.
Dart
365
star
9

bigkeeper

Efficiency improvement for iOS&Android modular development.
Ruby
212
star
10

Intimate

Intimate 提供了友好的 API 让 java 反射的使用更加简单平滑。 其最核心的价值在于 Intimate 将在编译期对 apk 内部代码的调用进行反射优化,完全免除反射的效率问题,使得反射调用就像普通调用一样快捷且无任何代价。
Java
202
star
11

duang

自动 CMS 生成工具
JavaScript
199
star
12

tedis

基于TiKV的兼容Redis协议的强一致性NoSQL数据库
Go
181
star
13

eleme.github.io

Eleme Developers Homepage
CSS
116
star
14

Sparrow

Vue
79
star
15

mobilists

mobile team blog
JavaScript
57
star
16

thrift-parser

To parse thrift file to a AST.
JavaScript
53
star
17

meepo

Event sourcing and broadcasting for database.
Python
52
star
18

ruskit

Redis cluster administration toolkit
Python
34
star
19

doctor

Metric based in-memory circuit breaker for python
Python
23
star
20

react-context-global-store

A simple global store based on React context
TypeScript
22
star
21

NVMImageMaker

API for chaining image drawing codes in Objc.
Objective-C
19
star
22

node-thrift-protocol

An implementation of thrift-protocol with node.
JavaScript
18
star
23

easyxml

php xml lib
PHP
17
star
24

SparrowSDK-iOS

Objective-C
16
star
25

NVMAspects

C
15
star
26

thrift-php

Mirror of apache thrift php lib
PHP
10
star
27

thrift-client

A nodejs thrift client
JavaScript
8
star
28

python-jianfan-mirror

mirror of https://code.google.com/p/python-jianfan/
Python
4
star
29

SparrowSDK-Android

4
star
30

thrift-tracker

Go
1
star
31

finite

F-init-E
JavaScript
1
star
32

python-geohash-mirror

mirror of https://code.google.com/p/python-geohash/
Python
1
star