Giter Site home page Giter Site logo

amigo's Introduction

中文版

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.

amigo's People

Contributors

2dxgujun avatar canaanyjn avatar captain-miao avatar fthegfw avatar hwangjr avatar jackcho avatar peacepassion avatar wkt avatar wwm0609 avatar zhungxd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amigo's Issues

Store optimized dex file to code_cache directory

  1. This location is optimal for storing compiled or optimized code generated by your application at runtime.
  2. The system will delete any files stored in this location both when your specific application is upgraded, and when the entire platform is upgraded.

How to develop this project more effectively

Current develop process:

  1. check out to new branch, commit code;
  2. write local maven repo config code in build.gradle in both gradle plugin and library;
  3. push library to local maven;
  4. cd to plugin directory, and push plugin to local maven;
  5. upgrade plugin version, run the sample app and check the result.

The develop process is tedious.

So, how to develop this project more effectively?

应用被加固,Amigo能否正常运行?

现在**大陆很多应用都使用第三方服务加固应用。如360加固,爱加密。特别是360市场,强制上传应用都必须用360加固。应用加固后,Amigo能否正常运行?

Activity 跳转的时候 ,intent附加Serializable对象报 java.lang.ClassNotFoundException

09-28 19:27:45.752 26154-26154/me.ele.app.amigo E/Parcel: Class not found when unmarshalling: me.ele.demo.Bean
java.lang.ClassNotFoundException: me.ele.demo.Bean
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:309)
at java.lang.Class.forName(Class.java:273)
at android.os.Parcel.readParcelableCreator(Parcel.java:2281)
at android.os.Parcel.readParcelable(Parcel.java:2245)
at android.os.Parcel.readValue(Parcel.java:2152)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.Bundle.getParcelable(Bundle.java:755)
at android.content.Intent.getParcelableExtra(Intent.java:5254)
at me.ele.amigo.AmigoCallback.handleLaunchActivity(AmigoCallback.java:49)
at me.ele.amigo.AmigoCallback.handleMessage(AmigoCallback.java:38)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5294)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Caused by: java.lang.ClassNotFoundException: Didn't find class "me.ele.demo.Bean" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

Unable to start activity ComponentInfo{com.sophpark.upark/me.ele.amigo.release.ApkReleaseActivity}

Process: com.sophpark.upark:amigo, PID: 13066 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sophpark.upark/me.ele.amigo.release.ApkReleaseActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class x at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3254) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) at android.app.ActivityThread.access$1100(ActivityThread.java:222) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7237) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class x at android.view.LayoutInflater.inflate(LayoutInflater.java:551) at android.view.LayoutInflater.inflate(LayoutInflater.java:429) at android.view.LayoutInflater.inflate(LayoutInflater.java:380) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474) at android.app.Activity.setContentView(Activity.java:2387) at me.ele.amigo.release.ApkReleaseActivity.onCreate(SourceFile:31) at android.app.Activity.performCreate(Activity.java:6876) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)  at android.app.ActivityThread.access$1100(ActivityThread.java:222)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:158)  at android.app.ActivityThread.main(ActivityThread.java:7237)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)  Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class x at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) at android.view.LayoutInflater.inflate(LayoutInflater.java:498) at android.view.LayoutInflater.inflate(LayoutInflater.java:429)  at android.view.LayoutInflater.inflate(LayoutInflater.java:380)  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474)  at android.app.Activity.setContentView(Activity.java:2387)  at me.ele.amigo.release.ApkReleaseActivity.onCreate(SourceFile:31)  at android.app.Activity.performCreate(Activity.java:6876)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)  at android.app.ActivityThread.access$1100(ActivityThread.java:222)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:158)  at android.app.ActivityThread.main(ActivityThread.java:7237)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.x" on path: DexPathList[[zip file "/data/app/com.sophpark.upark-1/base.apk"],nativeLibraryDirectories=[/data/app/com.sophpark.upark-1/lib/arm, /data/app/com.sophpark.upark-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.view.LayoutInflater.createView(LayoutInflater.java:595) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689) at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:68) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:706) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:774) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)  at android.view.LayoutInflater.inflate(LayoutInflater.java:498)  at android.view.LayoutInflater.inflate(LayoutInflater.java:429)  at android.view.LayoutInflater.inflate(LayoutInflater.java:380)  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474)  at android.app.Activity.setContentView(Activity.java:2387)  at me.ele.amigo.release.ApkReleaseActivity.onCreate(SourceFile:31)  at android.app.Activity.performCreate(Activity.java:6876)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)  at android.app.ActivityThread.access$1100(ActivityThread.java:222)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:158)  at android.app.ActivityThread.main(ActivityThread.java:7237)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)  Suppressed: java.lang.ClassNotFoundException: android.view.x at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 25 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

amigo_layout更新布局

`

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@mipmap/ic_upgrading"
    android:drawablePadding="@dimen/activity_margin_middle"
    android:textColor="@color/secondary_text"
    android:contentDescription="@string/app_name"/>

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:layout_marginTop="@dimen/activity_margin_middle"
    android:orientation="horizontal">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/secondary_text"
        android:text="请稍后"/>

</LinearLayout>

`

新旧版本apk只是versionCode进行了修改,

使用Amigo的时候Gradle遇到了NullPoint错误

Error:Execution failed for task ':app:processDebugManifest'.

java.lang.NullPointerException (no error message)

Project gradle
dependencies { classpath 'com.android.tools.build:gradle:2.2.0-rc2' classpath 'me.ele:amigo:0.0.8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }
android studio 2.2 RC2
谢谢!

about bspatch

1、current running is Host APK,make bspatch by host apk
2、current running is patch1.apk, if again fix this apk , make bspatch base which? patch1.apk or host apk?
3、need full update , we make bspatch base which?

thanks

怎么生成补丁APK呢?

如果我的APK有10M,但是只需要修复一行代码,我怎么把这个类单独生成补丁APK呢??

Can't get instance before initialized

use demo
1.first click APPLY PATCH APK button goto fix success
2.when click again get this exception (Can't get instance before initialized)

can't multi fix ?

Here is a crash... How to deal?

FATAL EXCEPTION: main
Process: me.ele.amigo.demo, PID: 21719
java.lang.RuntimeException: Unable to create application com.android.tools.fd.runtime.BootstrapApplication: java.lang.IllegalArgumentException: param apkFile cannot be read
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4798)
at android.app.ActivityThread.access$1600(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1430)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by: java.lang.IllegalArgumentException: param apkFile cannot be read
at me.ele.amigo.Amigo.work(Amigo.java:419)
at me.ele.amigo.demo.ApplicationContext.onCreate(ApplicationContext.java:34)
at com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:369)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1015)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4786)
at android.app.ActivityThread.access$1600(ActivityThread.java:165) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1430) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:150) 
at android.app.ActivityThread.main(ActivityThread.java:5546) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684) 

运行出现这个错误是怎么回事?

Unable to create application me.ele.amigo.Amigo: java.lang.RuntimeException: java.lang.ClassNotFoundException: Didn't find class "me.ele.amigo.acd" on path: DexPathList[[zip file "/data/app/******************-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4641)

AndroidManifest.xml未更新?

使用了Amigo,可以成功替换新包,但是好像AndroidManifest.xml未更新?获取的版本号和版本名称还是旧的,新加的Activity也没生效。

补丁apk如果资源有变化,使用RemoteViews显示自定义通知有异常

测试中发现,如果补丁apk修改了资源,显示通知使用RemoteViews会有异常。
不同修改,异常不一样。
异常日志如下:

09-09 11:19:45.002 1036-1036/? E/StatusBar: couldn't inflate view for notification com.mocoo.dfwc/0x66
android.view.InflateException: Binary XML file line #21: Error inflating class android.view.View
at android.view.LayoutInflater.createView(LayoutInflater.java:623)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:655)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
at android.widget.RemoteViews.apply(RemoteViews.java:2432)
at com.android.systemui.statusbar.BaseStatusBar.inflateViews(BaseStatusBar.java:561)
at com.android.systemui.statusbar.BaseStatusBar.addNotificationViews(BaseStatusBar.java:900)
at com.android.systemui.statusbar.phone.PhoneStatusBar.addNotification(PhoneStatusBar.java:1513)
at com.android.systemui.statusbar.CommandQueue$H.handleMessage(CommandQueue.java:362)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5016)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #21: Class not allowed to be inflated android.view.View
at android.view.LayoutInflater.failNotAllowed(LayoutInflater.java:637)
at android.view.LayoutInflater.createView(LayoutInflater.java:586)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:655) 
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:495) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:400) 
at android.widget.RemoteViews.apply(RemoteViews.java:2432) 
at com.android.systemui.statusbar.BaseStatusBar.inflateViews(BaseStatusBar.java:561) 
at com.android.systemui.statusbar.BaseStatusBar.addNotificationViews(BaseStatusBar.java:900) 
at com.android.systemui.statusbar.phone.PhoneStatusBar.addNotification(PhoneStatusBar.java:1513) 
at com.android.systemui.statusbar.CommandQueue$H.handleMessage(CommandQueue.java:362) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5016) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608) 
at dalvik.system.NativeStart.main(Native Method) 

应用如果是多进程架构,有可能主进程已经运行补丁,其他进程没有?

在Amigo的onCreate里面有如下代码:

if (!ProcessUtils.isMainProcess(this) && isPatchApkFirstRun()) {
                Log.e(TAG, "None main process and patch apk is not released yet");
                runOriginalApplication();
                return;
            }

            // only release loaded apk in the main process
            runPatchApk();

按照上述代码,release apk只在主进程。如果是用workLater的话,当应用重新启动时,主进程relase apk, 然后运行补丁程序,而其他程序继续运行原来的程序?是这样吗?

现阶段支持65535吗

1、本身项目大于65535能够完美解决吗?
2、更新前小于65535,更新后大于65535能解决吗?
谢谢!

multi-process workflow

Now, in the Amigo application, if not run by main process, just runOriginalApplication and return.

However, this workflow has an deficiency that we fail to fix those bugs from the code used only in none-main process.

diff apk don't work, throw exception. diif is binary rather than apk so that can't certainly read AndroidManifest.xml, i think....

09-18 08:43:40.384 31783-31783/me.ele.demo W/PackageParser: Unable to read AndroidManifest.xml of /storage/emulated/0/demo.apk
java.io.FileNotFoundException: AndroidManifest.xml
at android.content.res.AssetManager.openXmlAssetNative(Native Method)
at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:488)
at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:456)
at android.content.pm.PackageParser.parsePackage(PackageParser.java:528)
at android.content.pm.PackageManager.getPackageArchiveInfo(PackageManager.java:2629)
at me.ele.amigo.Amigo.isSignatureRight(Amigo.java:455)
at me.ele.amigo.Amigo.work(Amigo.java:430)
at me.ele.demo.MainActivity.applyPatchApk(MainActivity.java:103)
at me.ele.demo.MainActivity$3.onClick(MainActivity.java:59)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)

调用workLater后重启APP并没有开始修复APP

Log
begin merge file installApkPath:/data/app/com.sophpark.upark-1/base.apk patchApkPath:/data/user/0/com.sophpark.upark/files/amigo/amigo_patch.apk
Amigo Log:

10-10 10:01:26.731 13644-13644/? E/Amigo: working checksum: 1585798850
10-10 10:01:27.351 13644-13644/? E/Amigo: load dex process

将apk文件下载到:/data/user/0/com.sophpark.upark/files/amigo/amigo_patch.apk
Activity代码中调用如下代码

boolean patchWorked = Amigo.hasWorked();
        if (!patchWorked) {
            Amigo.workLater(this, file);
            return;
        }
        int workingPatchVersion = Amigo.workingPatchVersion(getApplication());
        if (workingPatchVersion < CommonUtils.getVersionCode(getApplication(), file)) {
            Amigo.workLater(this, file);
        }

在调用Amigo.workLater(this, file);方法后重启App,app并没有修复,如果直接调用Amigo.work(this, patchApkFile);是没有问题的,但是会有几个几秒的黑屏。谢谢!

amigo只能一次热修复么?

我在测试demo的时候,第一次修改完,热修复是可以的,第二次修改完,就没有效果了,不知道原因,求解

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.