安卓問題—Timed out while waiting for slave aapt process,
......
Exception in thread "png-cruncher_23" java.lang.RuntimeException: Timed out while waiting for slave aapt process, make sure the aapt execute at E:\Android\AndroidSDK\build-tools\27.0.1\aapt.exe can run successfully (some anti-virus may block it) or try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
at com.android.builder.png.AaptProcess.waitForReady(AaptProcess.java:108)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:120)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "png-cruncher_21" java.lang.RuntimeException: Timed out while waiting for slave aapt process, make sure the aapt execute at E:\Android\AndroidSDK\build-tools\27.0.1\aapt.exe can run successfully (some anti-virus may block it) or try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
at com.android.builder.png.AaptProcess.waitForReady(AaptProcess.java:108)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:120)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
at java.lang.Thread.run(Thread.java:745)
......
在使用Android Studio對專案進行打包成apk檔案時,報出瞭如上的錯誤,根據這個提示,可以看出是因為Timed out while waiting for slave aapt process這個問題,並給出了兩個解決方法:
1.the aapt execute at E:\Android\AndroidSDK\build-tools\27.0.1\aapt.exe can run successfully (some anti-virus may block it)
這種方法就是更新build-tools
2.try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
這種方法就是新建系統環境變數:SLAVE_AAPT_TIMEOUT,並將值設定為大於5即可。
總結:其實在開發過程中,會遇到非常多的問題,其中最主要的解決途徑是通過控制檯的輸出日誌,進行有針對性地解決問題。所以,我們在開發過程中,要學會多檢視日誌。日誌真的很重要,很重要,基本上所有問題都能夠通過日誌來定位解決。