Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiDex & Instant Run could not load class #234

Open
Howie-hxu opened this issue Jul 11, 2016 · 3 comments
Open

MultiDex & Instant Run could not load class #234

Howie-hxu opened this issue Jul 11, 2016 · 3 comments

Comments

@Howie-hxu
Copy link

如果某个app是使用Instant Run的方式来启动,那么在onCreateApplication的时候会发生class not found的error。根据Instant Run的启动方式,它会去构建BootstrapApplication
其中会使用
com.android.tools.fd.runtime.Paths;
com.android.tools.fd.runtime.AppInfo;
而在编译的过程中,
public class AppInfo {
public static String applicationId = "XXXXXX";
public static String applicationClass = "XXXXXX";
}

public final class Paths {
public static String getMainApkDataDirectory(String applicationId) {
return "/data/data/" + applicationId;
}
}

这里会去访问到/data/data/XXXXX/目录下的class dex文件,而不是Plugin构建的那个data目录。
看起来可以通过hook AppInfo的applicationClass和applicationId字段解决问题,但似乎不是最好的办法。

@cmzy
Copy link
Member

cmzy commented Jul 19, 2016

通过native的iohook可以解决。

@cxzadmini
Copy link

这个问题有具体解决方案吗、

@TIIEHenry
Copy link

小白求教

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants