(4.6.11.2)Android LayoutCast 初探

今天无意间看见了一个神器,顿时让我血气蓬勃! 废话不多说,先上网址:https://github.com/mmin18/LayoutCast

 

把代码和资源文件的改动直接同步到手机上,应用不需要重启。省去了编译运行漫长的等待,比较适合真机调试的时候使用。

 

GIF GIF 

先看看视频:

优酷: http://v.youku.com/v_show/id_XMTMwNTUzOTQ3Mg

  

 

Benchmark

Here is how it compared to Gradle and Facebook Buck:

BENCHMARK

The test machine is a 2015 MBP with a 2014 MotoX.

The test project's apk is about 14.3MB, which contains 380k lines of java code and 86k lines of xml files.

About Facebook Buck

Facebook Buck http://github.com/facebook/buck also build very fast. In some cases it's faster than LayoutCast due to it's multi-process build.

The biggest problem is Buck requires you change a lot of code, and restruct your project in small modules. It's quiet painful to make it work on existing project, especially big ones. I tried to use Buck on the test project, which took me a week just to make it run.

What I needs is a build tool that is easy to setup, fast as Buck, and provide a Run button in AndroidStudio. So I created LayoutCast.

LayoutCast only support Mac (for now) ; Cast Java code only support ART runtime (Android 5.0)

目前仅支持Mac系统及Android5.0系统

 

好了,看完之后是不是倍感兴奋呢,下面 博主带一波节奏:

 主要事情说三遍: 需要Python环境  需要Python环境   需要Python环境

先下载:https://github.com/mmin18/LayoutCast/raw/master/ide/IDEAPlugin/IDEAPlugin.jar 

然后打开AndroidStudio的Setting页面,选择Plugins ,Install plugin from disk...

 

安装完成后,会提示重启AndroidStudio来安装插件。

重启后,会发现TOOLBAR多了一个图标,这就是咱们LayoutCast的Run键了。

 

接下来,在你的项目下的build.gradle下添加

dependencies {
    compile 'com.github.mmin18.layoutcast:library:1.+@aar'
    ...
}

Application 中注册

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        if (BuildConfig.DEBUG) {
            LayoutCast.init(this);
        }
    }
}


在AndroidManifest.xml里加入

复制代码
<application
    android:name=".MyApplication"
    .../> 

<activity android:name="com.github.mmin18.layoutcast.ResetActivity" /> 
<!--权限-->
<uses-permission android:name="android.permission.INTERNET" />
复制代码

然后直接Run项目在Android5.0手机系统下,项目在手机上跑起来后,就可以适时调整了啦~

每次修改代码后,点击,手机端回黑屏,显示 Cast DEX in 2 second...  如图

电脑端则会显示

SUCCESS

之后 新的代码就可以跑在手机上了,不需要重新编译App 安装App ,每次只需要1秒哟,速度与激情~

  

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值