V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ufo22940268
V2EX  ›  问与答

[android]没什么比 instant run 更酷的东西了

  •  1
     
  •   ufo22940268 · 2015-11-24 09:07:06 +08:00 · 4136 次点击
    这是一个创建于 3078 天前的主题,其中的信息可能已经有所发展或是发生改变。

    发错节点了,应该发到 android 上的

    https://www.youtube.com/watch?v=AefJXhCxrK8

    发现效果很好,原来编译需要 30s 的项目现在 2s 就能搞定了。

    现在存在的问题

    Here are also some known issues that we are working on:

    • Apps that are using legacy multi-dex (with minSdkVersion < 21), with a main dex file near the 65K method limit may not build. This would require reworking the app to make room in the main dex list by reducing the number of classes required in the main dex file.

    • We have tested Instant Run on many devices, but it ’ s impossible to try it on every single device model. Please let us know if Instant Run doesn ’ t work on your device.
      We have seen some intermittent issues where the IDE loses connection with the app which will trigger a full rebuild.

    • We have not yet tested this feature with 3rd party Gradle plugins, especially those that have not been updated to use the new transforms API. If you run into issues, please let us know.

    • Data-binding is broken in this build; we will restore this shortly.

    对我来说唯一不在生产项目上用的理由就是 data-binding 了,不过估计很快就能修复了。

    第 1 条附言  ·  2015-11-24 12:20:00 +08:00
    今天中午又测试了下,发现 data-binding 可以用了
    12 条回复    2015-11-24 14:29:22 +08:00
    ufo22940268
        1
    ufo22940268  
    OP
       2015-11-24 09:11:14 +08:00
    wintersun
        2
    wintersun  
       2015-11-24 09:30:35 +08:00
    的確很酷,但是很擔心要多强大的機器才能流暢跑動?
    像我這種前後臺一起開發的,好怕怕啊
    ufo22940268
        3
    ufo22940268  
    OP
       2015-11-24 09:37:03 +08:00
    @wintersun instant run 的实现机制好像是不需要重新 push 整个 apk , push 变化的部分,然后就能看到最新的修改,并不是 instant build 。所以 build 还是手动的。对机能要求应该不会高。

    我也是前后端一起开发,一点都不担心机能的问题,因为原来 android 对机能的要求就已经够苛刻了。
    zhangchioulin
        4
    zhangchioulin  
       2015-11-24 09:49:59 +08:00
    作为 iOSer 我只希望 Xcode 的 bug 能少点,稳定点
    ctftemp
        5
    ctftemp  
       2015-11-24 10:26:56 +08:00
    cool
    hronro
        6
    hronro  
       2015-11-24 10:33:47 +08:00
    react native 倒是也是这种边改代码就能边看到效果。
    Makoshan
        7
    Makoshan  
       2015-11-24 11:50:51 +08:00
    http://v2ex.com/t/238456 lz 贴新闻,不自己试试, 我这边编译 data-binding 没有问题。
    ufo22940268
        8
    ufo22940268  
    OP
       2015-11-24 12:00:58 +08:00
    @Makoshan 你说的是 data-binding 格式的 xml 也能做到 instant run 吗?
    我试过,我这边是不可以的。编译能够通过,但是没法 instant run
    Makoshan
        9
    Makoshan  
       2015-11-24 12:07:56 +08:00   ❤️ 1
    @ufo22940268 Data-binding is broken 的问题应该已经修复, Instant run 要升级 Gradle 的版本,先 push 到手机, run 的图标多了一个⚡️的符号,代码有变化再次 run 直接重启 Activity 。
    ufo22940268
        10
    ufo22940268  
    OP
       2015-11-24 12:19:24 +08:00
    @Makoshan 赞,现在又可以了
    baitouwei
        11
    baitouwei  
       2015-11-24 12:48:07 +08:00
    升级后发现 MultiDex 好像有问题。升级到 `classpath 'com.android.tools.build:gradle:2.0.0-alpha1'` App 会崩溃,报 verifyerror 错误,回退后就正常了
    zhouquanbest
        12
    zhouquanbest  
       2015-11-24 14:29:22 +08:00
    Kotlin 不能用 MultiDex 有问题
    还好我这次机智的单独安装

    试用了下 Instant Run 明显没有收费的好 但毕竟是 Google 爹出的 只能先雪藏了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   953 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:07 · PVG 04:07 · LAX 13:07 · JFK 16:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.