代码改变世界

Apkplug 开发常见问题解答

2016-05-25 20:36  shaobin0604  阅读(2009)  评论(0编辑  收藏  举报

Android M (6.0) generatePackageInfo 偶现错误

出现这个现象之后会导致 BundleActivator.start() 方法不会被调用

6.0 方法签名

public static PackageInfo generatePackageInfo(PackageParser.Package p,
            int gids[], int flags, long firstInstallTime, long lastUpdateTime,
            Set<String> grantedPermissions, PackageUserState state, int userId) {

日志中出现异常的调用是

10-25 15:31:35.579 4046-4046/com.wlqq W/System.err: java.lang.NoSuchMethodException: generatePackageInfo [class android.content.pm.PackageParser$Package, class [I, int, long, long, class android.util.ArraySet, class android.content.pm.PackageUserState, int]

6.0.1 的 PackageParser http://androidxref.com/6.0.1_r10/xref/frameworks/base/core/java/android/content/pm/PackageParser.java
5.1.1 的 PackageParser http://androidxref.com/5.1.1_r6/xref/frameworks/base/core/java/android/content/pm/PackageParser.java

Apkplug v3.9 完整日志

10-27 20:28:11.259 24724-24724/com.wlqq W/System.err: java.lang.NoSuchMethodException: generatePackageInfo [class android.content.pm.PackageParser$Package, class [I, int, long, long, class android.util.ArraySet, class android.content.pm.PackageUserState, int]
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at java.lang.Class.getMethod(Class.java:624)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at java.lang.Class.getDeclaredMethod(Class.java:586)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.Z.b(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.eg.s(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.eg.t(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.bs.aO(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.bs.ba(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.bs.aK(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.bD.getBaseContext(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.bD.<init>(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.bs.aY(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.bq.getAndroidContext(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at org.tengxin.cl.run(Unknown Source)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at android.os.Looper.loop(Looper.java:148)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5466)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-27 20:28:11.259 24724-24724/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-27 20:28:11.259 24724-24724/com.wlqq E/PackageInfo: ApplicationInfo is null
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err: Unable to read ApplicationInfo
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err: java.lang.NullPointerException: Attempt to read from field 'android.content.pm.ApplicationInfo android.content.pm.PackageInfo.applicationInfo' on a null object reference
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at org.tengxin.eg.t(Unknown Source)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at org.tengxin.bs.aO(Unknown Source)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at org.tengxin.bs.ba(Unknown Source)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at org.tengxin.bs.aK(Unknown Source)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at org.tengxin.bD.getBaseContext(Unknown Source)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at org.tengxin.bD.<init>(Unknown Source)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at org.tengxin.bs.aY(Unknown Source)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at org.tengxin.bq.getAndroidContext(Unknown Source)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at org.tengxin.cl.run(Unknown Source)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at android.os.Looper.loop(Looper.java:148)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5466)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-27 20:28:11.260 24724-24724/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Apkplug v3.2 完整日志

10-25 15:31:35.579 4046-4046/com.wlqq W/System.err: java.lang.NoSuchMethodException: generatePackageInfo [class android.content.pm.PackageParser$Package, class [I, int, long, long, class android.util.ArraySet, class android.content.pm.PackageUserState, int]
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at java.lang.Class.getMethod(Class.java:624)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at java.lang.Class.getDeclaredMethod(Class.java:586)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at org.tengxin.ag.b(Unknown Source)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at org.tengxin.dx.t(Unknown Source)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at org.tengxin.dx.u(Unknown Source)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at org.tengxin.bf.aQ(Unknown Source)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at org.tengxin.bf.aR(Unknown Source)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at org.tengxin.c.a(Unknown Source)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at org.tengxin.e.execStartActivity(Unknown Source)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at android.app.Activity.startActivityForResult(Activity.java:3930)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at android.app.Activity.startActivityForResult(Activity.java:3890)
10-25 15:31:35.587 4046-4046/com.wlqq W/System.err:     at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:820)
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err:     at com.wlqq.plugin.wallet.sdk.WalletHelper$1$3.run(WalletHelper.java:255)
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err:     at android.os.Looper.loop(Looper.java:148)
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5466)
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-25 15:31:35.588 4046-4046/com.wlqq E/PackageInfo: ApplicationInfo is null
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err: Unable to read ApplicationInfo
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err: java.lang.NullPointerException: Attempt to read from field 'android.content.pm.ApplicationInfo android.content.pm.PackageInfo.applicationInfo' on a null object reference
10-25 15:31:35.588 4046-4046/com.wlqq W/System.err:     at org.tengxin.dx.u(Unknown Source)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at org.tengxin.bf.aQ(Unknown Source)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at org.tengxin.bf.aR(Unknown Source)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at org.tengxin.c.a(Unknown Source)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at org.tengxin.e.execStartActivity(Unknown Source)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.app.Activity.startActivityForResult(Activity.java:3930)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.app.Activity.startActivityForResult(Activity.java:3890)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:820)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at com.wlqq.plugin.wallet.sdk.WalletHelper$1$3.run(WalletHelper.java:255)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.os.Looper.loop(Looper.java:148)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5466)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err: java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.content.pm.ApplicationInfo.className' on a null object reference
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at org.tengxin.bf.aR(Unknown Source)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at org.tengxin.c.a(Unknown Source)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at org.tengxin.e.execStartActivity(Unknown Source)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.app.Activity.startActivityForResult(Activity.java:3930)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.app.Activity.startActivityForResult(Activity.java:3890)
10-25 15:31:35.589 4046-4046/com.wlqq W/System.err:     at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:820)
10-25 15:31:35.590 4046-4046/com.wlqq W/System.err:     at com.wlqq.plugin.wallet.sdk.WalletHelper$1$3.run(WalletHelper.java:255)
10-25 15:31:35.590 4046-4046/com.wlqq W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
10-25 15:31:35.590 4046-4046/com.wlqq W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-25 15:31:35.590 4046-4046/com.wlqq W/System.err:     at android.os.Looper.loop(Looper.java:148)
10-25 15:31:35.590 4046-4046/com.wlqq W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5466)
10-25 15:31:35.590 4046-4046/com.wlqq W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
10-25 15:31:35.590 4046-4046/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-25 15:31:35.590 4046-4046/com.wlqq W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-25 15:31:35.590 4046-4046/com.wlqq D/Tracker: track event wallet_launch-error_activity with values {Exception=java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.content.pm.ApplicationInfo.className' on a null object reference}
10-25 15:31:35.590 4046-4094/com.wlqq I/TDLog: onEvent being called! eventId: wallet_launch, eventLabel: error_activity, eventMap: mapSize: 1

Resources#getIdentifier

关于在插件中使用如下方法

int getIdentifier (String name, 
                String defType, 
                String defPackage)

v3.2

defPackage 无论传什么包名,都只会在插件中寻找资源

v3.9

defPackage 只有传插件包名宿主包名,才会在插件中寻找资源

SDK 版本升级

v3.9 降级到 v3.2 ,启动会 crash

1 java.lang.RuntimeException:Unable to create application com.wuliuqq.client.app.AdminClientApplication: com.tencent.tinker.loader.TinkerRuntimeException: Tinker Exception:onCreate method not found
2 android.app.ActivityThread.handleBindApplication(ActivityThread.java:4480)
3 ......
4 Caused by:
5 java.lang.NoClassDefFoundError:org.tengxin.dI
6 org.tengxin.bQ.a(Unknown Source)
7 org.tengxin.bQ.<init>(Unknown Source)
8 org.tengxin.bQ.<init>(Unknown Source)
9 org.tengxin.bu.start(Unknown Source)
10 org.apkplug.app.FrameworkFactory.start(Unknown Source)
11 org.apkplug.app.FrameworkFactory.start(Unknown Source)
12 org.apkplug.app.FrameworkFactory.start(Unknown Source)
13 com.wlqq.plugin.sdk.PluginManager.init(PluginManager.java:125)
14 com.wuliuqq.client.plugins.PluginManagerInitService.initPluginManagerSync(PluginManagerInitService.java:82)
15 com.wuliuqq.client.app.DiesApplication.initApkPlug(DiesApplication.java:266)
16 com.wuliuqq.client.app.DiesApplication.onCreateMain(DiesApplication.java:249)
17 com.wuliuqq.client.app.DiesApplicationLike.onCreate(DiesApplicationLike.java:78)
18 com.wuliuqq.client.app.DiesApplication.onCreate(DiesApplication.java:190)
19 com.wuliuqq.client.app.DiesApplicationLike.onCreate(DiesApplicationLike.java:73)
20 java.lang.reflect.Method.invokeNative(Native Method)
21 java.lang.reflect.Method.invoke(Method.java:525)
22 com.tencent.tinker.loader.app.TinkerApplication.delegateMethod(TinkerApplication.java:181)
23 com.tencent.tinker.loader.app.TinkerApplication.onCreate(TinkerApplication.java:192)
24 android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
25 android.app.ActivityThread.handleBindApplication(ActivityThread.java:4477)
26 android.app.ActivityThread.access$1300(ActivityThread.java:144)
27 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1319)
28 android.os.Handler.dispatchMessage(Handler.java:99)
29 android.os.Looper.loop(Looper.java:137)
30 android.app.ActivityThread.main(ActivityThread.java:5136)
31 java.lang.reflect.Method.invokeNative(Native Method)
32 java.lang.reflect.Method.invoke(Method.java:525)
33 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
34 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
35 dalvik.system.NativeStart.main(Native Method)

Service 使用注意事项

插件中 bind 插件中的 Service ,在代理模式下,不能使用 Context#getApplication() 获取的 Context ,而需要使用 Activity 之类的 Context

插件中的 PopupWindow 不能使用动画

插件 Application#onCreate 可能会出现没有调用的情况

  • apkplug 版本 v3.2.0

线上统计数据大概 20% 存在这种情况,因此建议不要把重要的初始化逻辑放在里面

乐蛙 ROM Android 4.1 在后台线程中初始化 Universal Image Loader 会出现异常

06-13 11:28:13.676 5460-5863/com.wlqq W/System.err: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at android.os.Handler.<init>(Handler.java:121)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at android.app.Application.<init>(Application.java:81)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at java.lang.Class.newInstanceImpl(Native Method)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at java.lang.Class.newInstance(Class.java:1319)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at android.app.Instrumentation.newApplication(Instrumentation.java:982)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at android.app.Instrumentation.newApplication(Instrumentation.java:967)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at org.tengxin.bf.aR(Unknown Source)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at org.tengxin.bp.getApplicationContext(Unknown Source)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at com.nostra13.universalimageloader.core.ImageLoaderConfiguration$Builder.<init>(ImageLoaderConfiguration.java:191)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at com.wlqq.plugin.wallet.PluginActivator.initImageLoader(PluginActivator.java:60)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at com.wlqq.plugin.wallet.PluginActivator.init(PluginActivator.java:55)
06-13 11:28:13.686 5460-5863/com.wlqq W/System.err:     at com.wlqq.plugin.wallet.PluginActivator.start(PluginActivator.java:31)

插件与宿主间通讯是否可以使用 ResultReceiver 做为通用的 Callback 机制?

不可以。调用 intent.getParcelableExtra 获取 ResultReceiver 会出现以下异常

06-01 10:17:15.270 19102-19102/com.hcb.driver W/TDLog: UncaughtException in Thread main
                                                       java.lang.RuntimeException: Error receiving broadcast Intent { act=install_plugin flg=0x10 pkg=com.hcb.driver (has extras) } in com.wlqq.plugin.sdk.PluginManager$InstallerService@448a9a9
                                                           at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:893)
                                                           at android.os.Handler.handleCallback(Handler.java:739)
                                                           at android.os.Handler.dispatchMessage(Handler.java:95)
                                                           at android.os.Looper.loop(Looper.java:148)
                                                           at android.app.ActivityThread.main(ActivityThread.java:5432)
                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:735)
                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
                                                        Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: plugin.store.WalletServiceManager$1
                                                           at android.os.Parcel.readParcelableCreator(Parcel.java:2432)
                                                           at android.os.Parcel.readParcelable(Parcel.java:2358)
                                                           at android.os.Parcel.readValue(Parcel.java:2264)
                                                           at android.os.Parcel.readArrayMapInternal(Parcel.java:2614)
                                                           at android.os.BaseBundle.unparcel(BaseBundle.java:221)
                                                           at android.os.Bundle.getParcelable(Bundle.java:786)
                                                           at android.content.Intent.getParcelableExtra(Intent.java:5381)
                                                           at com.wlqq.plugin.sdk.PluginManager$InstallerService.onReceive(PluginManager.java:1204)

插件与宿主间通讯是否可以使用 Local Broadcast ?

不可以。但可以使用普通的 Broadcast

是否可以使用 overridePendingTransition 设置 Activity 切换动画?

不能使用, 使用该方法可能会导致 Activity 界面卡死

如何配置 proguard 混淆?

宿主

-dontwarn org.apkplug.app.**
-dontwarn org.apkplug.Bundle.**
-dontwarn org.osgi.framework.**
-dontwarn org.osgi.service.**

-keep class org.apkplug.app.** { *; }
-keep class org.apkplug.Bundle.** { *; }
-keep class org.osgi.framework.** { *; }
-keep class org.osgi.service.** { *; }

-keep class org.tengxin**
-keep class org.apkplug.mxdstream** {
    <fields>;
    <methods>;
}
-keepclassmembers class * extends android.content.ContentResolver {
    <methods>;
}
-keepclassmembers class * extends android.app.INotificationManager {
    <fields>;
    <methods>;
}
-keep class android.app.ITransientNotification {
    <fields>;
    <methods>;
}
-keep class android.service.notification** {
    <fields>;
    <methods>;
}
-keep class android.app.INotificationManager {
    <fields>;
    <methods>;
}
-keep class android.content.pm**
-keep class android.os**
-keepclassmembers class * extends android.content.pm.PackageManager {
    <methods>;
}
-keep class android.content.res.MiuiResources
-keep class android.app.ApplicationPackageManager
-keepclassmembers class * extends android.app.ApplicationPackageManager {
    <methods>;
}

-dontwarn org.tengxin.sv.**
-dontwarn com.msg.**
-dontwarn com.apkplug.CloudService.**
-dontwarn com.apkplug.base.**
-dontwarn com.apkplug.Ads**
-dontwarn com.apkplug.AdsPlug**
-dontwarn com.apkplug.Analytics**
-dontwarn com.apkplug.Feedback**
-dontwarn com.apkplug.Analytics.Bean**
-dontwarn org.openudid**

-keep class org.tengxin.sv** { *; }
-keep class org.osgi** { *; }

-keep class com.msg**{ *; }
-keep class com.apkplug.CloudService**{ *; }
-keep class com.apkplug.base** { *; }

-keep class com.apkplug.Ads** { *; }
-keep class com.apkplug.AdsPlug** { *; }

-keep class com.apkplug.Analytics** { *; }
-keep class com.apkplug.Feedback** { *; }

-keep class com.apkplug.Analytics.Bean** { *; }

-keep class org.openudid** { *; }

插件

-libraryjars android-support-v4.jar
-libraryjars osgi.jar

-keep class * implements org.osgi.** { *; }
-keep class * implements org.apkplug.Bundle.** { *; }
-keep class org.apkplug.mxdstream** {
    <fields>;
    <methods>;
}

宿主如何调用插件 Activity 并获取结果?

调用 startActivityForResult 方法,不要使用 Intent.FLAG_ACTIVITY_NEW_TASK

插件中如何集成微信支付?

宿主

  1. 需要 release 签名
  2. AndroidManifest.xml 中声明 ${宿主应用的包名}.wxapi.WXPayEntryActivity ,设置 android:exported="true"

插件

  1. 创建类 ${宿主应用的包名}.wxapi.WXPayEntryActivity ,在里面处理微信支付回调
  2. plugin.xml 中配置导出该 Activity

参考

Apkplug 参考文档