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

刚从坑里爬出来,严格来说,Nuwa目前是不支持ART的 #50

Closed
xxxyanchenxxx opened this issue Jan 25, 2016 · 9 comments
Closed

Comments

@xxxyanchenxxx
Copy link

在ART会编译成native代码。
但是如果只发布部分代码的话,编译时是没办法进行内存地址定位的。
ART模式下也会分为解释执行与ART native模式执行,如果只是走解释执行,就还是按照原来dalvik的模式走的,用的符号引用,没问题,但一旦ART模式,比如你用handler调用你的补丁文件,内存地址就飞了,必定报错。

解决方式:从理论上来说,只发布部分class是不行的,整个dex必须都要作为patch...

可能作者的这套还没经过多少实际应用吧,其实还有很多的坑在里面,这套机制的局限性还有很多。
比如Application,provider等里面千万不能引用其他的class,android:process的处理等

另外windows下的cygwin中使用貌似也不行

  • What went wrong:
    Execution failed for task ':app:nuwaClassBeforeDexDebug'.
@peive
Copy link

peive commented Jan 25, 2016

你们有实际应用了吗,我们私聊吧,QQ 1483060508

@WPCWEG
Copy link

WPCWEG commented Jan 26, 2016

What went wrong: Execution failed for task ':app:nuwaClassBeforeDexDebug'
这个错误你追溯一下Gradle编译到详细过程你就会知道,铁定是数组越界错误。

@xxxyanchenxxx
Copy link
Author

@DoubleAngle 如何解决?

@WPCWEG
Copy link

WPCWEG commented Jan 27, 2016

@xxxyanchenxxx 是NuwaGradle 里面的NuwaPlugin.groovy里面的代码问题。
原因一:NuwaPlugin.groovy中 反斜杠转义导致数组越界。
原因二:还没找到,我时而编译成功,时而编译失败,都是报数组越界。

@WPCWEG
Copy link

WPCWEG commented Jan 29, 2016

@xxxyanchenxxx 而且nuwa只支持 4.0以上,并不是作者所描述的2.3~6.0,作者使用的BaseDexClassLoader这个4.0才有的API,导致4.0以下的手机用Nuwa就必定崩溃,特此提醒。

@xxxyanchenxxx
Copy link
Author

@DoubleAngle 我把debug与release都开启了混淆,可以编译过了。(Windows下)
我在linux下时,不需要开启debug混淆能编译过。

作者写的这个毕竟没有任何实践,算是Demo成品吧,坑确实比较多。

这样说其实就目前仅能支持4.0-4.4。
要支持5.0+上的ART就自己写脚本来制作补丁吧,别用作者的"-P NuwaDir"来制作补丁。

并且一定要小心补丁加载之前的就已经载入的文件,不要进行混淆。
同时那些文件尽量较少对其他文件的引用。

@landryshuai
Copy link

@xxxyanchenxxx 你的意思是,应用通过classloader加载进来的代码,必定是解释模式?所以存在你说的内存地址飞了的情况?还是说有什么其他的原因?那如果这样,multi-dex岂不是也没用了?
而且我也不是很明白你所说的Application和Provider不能引用其他类的原因。如果在加载patch之前,调用了相关类当然会不能修复。否则是引用相关类应该没有问题的吧。不知道我理解错误没有。忘指正。

@appdev
Copy link

appdev commented Mar 1, 2016

三星note3 6.0上测试是可以的。

@xxxyanchenxxx
Copy link
Author

@landryshuai 内存飞指的是只有部分文件被转换成oat时有问题。application这个文件要排除在hot fix之外,那么它引用的其他文件也要排除。

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

5 participants