今天打算用 command line 指令./gradlew assembleRelease

打包各 flavors 的 apk 時,出錯如下

======================

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

FAILURE: Build failed with an exception.


文章標籤

顏澤偉 發表在 痞客邦 留言(0) 人氣()

開發一套已有大量使用者的 APP 時通常都要小心一點

為了程式的穩定性與品質

我們都會建立各種環境來把關

像是 dev 開發環境,sit 整合測試環境,uat 情境測試環境,prod 正式環境… 之類的

雖然每個公司的環境不一樣,但卻是大同小異的

文章標籤

顏澤偉 發表在 痞客邦 留言(0) 人氣()

Google 一直有個限制

apk 不能大於 100MB

基於解決這個限制

Google 提供了 APK Expansion Files 的方式來外掛資源檔

所以我們就可以把 res 裡面的東西額外分離出來

文章標籤

顏澤偉 發表在 痞客邦 留言(0) 人氣()

今天因為更改了 文件名稱的大小寫

造成了無法 add file 的困境

原因是 Git 是大小寫不敏感的

所以造成以下錯誤,不論是 資料夾路徑、檔案名稱 都會遇到

Will not add file alias …… already exists in index

文章標籤

顏澤偉 發表在 痞客邦 留言(0) 人氣()

compile 在 2018年底已經不再支援了

所以升級 Gradle 成了必然

而升級到 Gradle 3 以上的朋友第一個遇到的問題應該就是下面這個

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
 

文章標籤

顏澤偉 發表在 痞客邦 留言(0) 人氣()

今天剛拿到新電腦

在建置環境的過程中遇到了一些問題

這次裝的 Android Studio 版本為 3.3.2

在我高高興興載下專案要 build 的時候

文章標籤

顏澤偉 發表在 痞客邦 留言(0) 人氣()

在嘗試使用 MVVM 架構時,使用 DataBinding 遇到了此問題 part2

一 Build 就會出錯,錯誤訊息如下

Found data binding errors.
****/ data binding error ****msg:Cannot find the getter for attribute 'android:background' with value type int on android.support.constraint.ConstraintLayout. file:XXX ****\ data binding error ****

我們很明顯的可以從訊息看出 background 的值 type 是 int

顏澤偉 發表在 痞客邦 留言(0) 人氣()

在嘗試使用 MVVM 架構時,使用 DataBinding 遇到了此問題

只要我進入目標 Activity 就會 Crush,出現下列錯誤

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxxxxx.AroundCircleActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class layout
       

而出錯的地方是 setContentView

文章標籤

顏澤偉 發表在 痞客邦 留言(0) 人氣()

今天在試著引入 Butterknife 10.1.0 後發生的問題

錯誤訊息如下:

Manifest merger failed : 
Attribute application@appComponentFactory 
value=(android.support.v4.app.CoreComponentFactory) 
from [com.android.support:support-compat:28.0.0] 
AndroidManifest.xml:22:18-91 is also present 
at [androidx.core:core:1.0.0] 
AndroidManifest.xml:22:18-86 
value=(androidx.core.app.CoreComponentFactory).

Suggestion: 
add 'tools:replace="android:appComponentFactory"' 
to <application> element 
at AndroidManifest.xml:5:5-23:19 to override.

 

此錯誤訊息告訴我們 Manifest 合併時失敗

其實是 support v28 和 androidx 無法同時存在的關係

文章標籤

顏澤偉 發表在 痞客邦 留言(0) 人氣()

Meterial Design 裡面有一個 SnackBar 的元件

此元件可以說是 Toast 的進階版本

都是用來呈現簡短的訊息的元件

由於 Toast 不符合 Meterial Design 的設計風格

所以才有 SnackBar 的出現

文章標籤

顏澤偉 發表在 痞客邦 留言(0) 人氣()