1. 程式人生 > >Error:FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:t

Error:FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:t

今日份遇到的 bug :

Error:注: 某些輸入檔案使用或覆蓋了已過時的 API。
注: 有關詳細資訊, 請使用 -Xlint:deprecation 重新編譯。
注: 某些輸入檔案使用了未經檢查或不安全的操作。
注: 有關詳細資訊, 請使用 -Xlint:unchecked 重新編譯。
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: Failed to find byte code for android/view/View$OnScrollChangeListener

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 35s

經過一番努力之後,bug變成了這樣。。。:

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: Failed to find byte code for android/view/View$OnScrollChangeListener

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 29s

最後還是被我弄好了;

下面給出我簡單暴力的方法,開啟專案的 gradle,如下圖:

將 gradle 降低版本即可,我是改為了 gradle:3.0.1 編譯就好了。如果不知道改為哪個版本,就新建一個專案,看看是什麼版本的,直接改為相應的版本即可。