Building and running app via Gradle and Android Studio is slower than via Eclipse

前端 未结 28 1939
太阳男子
太阳男子 2020-11-22 08:21

I have a multi-project (~10 modules) of which building takes about 20-30 seconds each time. When I press Run in Android Studio, I have to wait every time to rebuild the app,

28条回答
  •  -上瘾入骨i
    2020-11-22 08:49

    A trivial change (to a resoruce xml) still took 10 minutes. As @rivare says in his answer, a command line build is mutch faster (took this down to 15 seconds).
    Here are some steps to at least make a trivial build fast from the command line for Windows.

    1. Go to your projects root (where the gradlew.bat is):

      cd c:\android\MaskActivity

    2. execute the build:

      gradlew assembleDebug

    3. uninstall the apk from the phone directly (drag it to uninstall).

    4. When the build is finished, kill the BIG java process using Windows Task Manager.

    OR if you have unix tools on your Windows machine:

    ps
    

    "pid" 's are shown:

    kill -9 
    
    1. Now install your apk:

      adb -d install C:\Android\MaskActivity\app\build\outputs\apk\app-debug.apk

提交回复
热议问题