alibaba / freeline

A super fast build tool for Android, an alternative to Instant Run
https://www.freelinebuild.com/
BSD 3-Clause "New" or "Revised" License
5.48k stars 623 forks source link

增量时报了support库里的id未找到 #503

Closed msdx closed 7 years ago

msdx commented 7 years ago

日志如下:

haohang@haohang-desktop:/workspace/project/park-here-android$ python freeline.py  
[INFO] preparing for tasks...
[-][connect_device_task] finished. in 0.1s
[-][gradle_aapt_task] failed. in 0.6s
[-][api] failed. in 0s
[-][app] failed. in 0s
[-][merge_dex_task] failed. in 0s
[-][gradle_sync_task] failed. in 0s
[-][clean_cache_task] failed. in 0s
[-][update_stat_task] failed. in 0s
[ERROR] --------------------------------------------------------
[ERROR] Freeline ERROR
[ERROR] --------------------------------------------------------
Freeline trace:: makeFileResources all resource. Time Elapsed: 9.697000 ms 
Freeline trace:: compile values. Time Elapsed: 356.552000 ms 
Freeline trace:: makeFileResources for color and menu. Time Elapsed: 0.946000 ms 

gChangeList = res/layout/activity_login_mobile.xml:res/values/freeline_id_keeper_public.xml:res/values/freeline_id_keeper_ids.xml
-resoucres-md5-cache-path = /workspace/project/park-here-android/app/build/freeline/arsc_cache.dat
warning: overwriting '/home/haohang/.android/build-cache/7aafc7b1720d2fb23b2b4d698a947752e63f9c59/output/assets/apktime' with '/workspace/project/park-here-android/app/build/freeline/freeline-assets/apktime'
/workspace/project/park-here-android/app/build/freeline/app/backup/res/values/freeline_id_keeper_public.xml:1709: error: Public symbol drawable/avd_hide_password_1 declared here is not defined.
/workspace/project/park-here-android/app/build/freeline/app/backup/res/values/freeline_id_keeper_public.xml:1711: error: Public symbol drawable/avd_hide_password_2 declared here is not defined.
/workspace/project/park-here-android/app/build/freeline/app/backup/res/values/freeline_id_keeper_public.xml:1713: error: Public symbol drawable/avd_hide_password_3 declared here is not defined.
/workspace/project/park-here-android/app/build/freeline/app/backup/res/values/freeline_id_keeper_public.xml:1715: error: Public symbol drawable/avd_show_password_1 declared here is not defined.
/workspace/project/park-here-android/app/build/freeline/app/backup/res/values/freeline_id_keeper_public.xml:1717: error: Public symbol drawable/avd_show_password_2 declared here is not defined.
/workspace/project/park-here-android/app/build/freeline/app/backup/res/values/freeline_id_keeper_public.xml:1719: error: Public symbol drawable/avd_show_password_3 declared here is not defined.

[ERROR] --------------------------------------------------------
[ERROR] incremental res build failed.
[ERROR] --------------------------------------------------------
[DEBUG] Prepare tasks time: 0.1s
[DEBUG] Task engine running time: 0.6s
[DEBUG] Total time: 0.7s
[DEBUG] --------------------------------------------------------
haohang@haohang-desktop:/workspace/project/park-here-android$ 

版本如下:

freeline 0.8.2 & 0.8.3 gradle插件 'com.android.tools.build:gradle:2.3.0-alpha3' compileSDK 23 buildTools 25.0.2 allSupportLibrary 25.1.1

一开始正常。后来在重构某个界面的布局之后,就发现每次增量都报这个错误。全量能通过。

lomanyong commented 7 years ago

@msdx 能够提供一个可以复现的 sample 工程吗?

msdx commented 7 years ago

抱歉无法提供,因为是在公司项目中出现的。

lomanyong commented 7 years ago

@msdx 报 NotFound 的这几个是哪个 support 库的?

msdx commented 7 years ago

avd_show_password_3来自于meterial design support library中的输入框的那个隐藏或显示密码的眼睛。

msdx commented 7 years ago

@lomanyong 今天在修改另一个界面时也出现了这个问题。 两个出现此问题的界面的共性:

lomanyong commented 7 years ago

@msdx 不能提供一个只含有这个 support 库,并且有 avd_show_password 这类图片调用的 sample 吗?我这里找不到这些图片...没办法复现你的问题...

或者你只提供代码也可以,只要我这里能够复现出来...包括使用的是哪个版本的 support 库,以及你的 freeline 的版本。

msdx commented 7 years ago

现在赶着项目,这样吧,在后面有空下来的时间我自己写个demo看能不能复现出来,如果可以,再请教你。

msdx commented 7 years ago

今天在改一个没有表单的布局时也报了这个问题,这下我也不知道出现此问题的共性是什么了。。。

lomanyong commented 7 years ago

@msdx 额,只要能够提供一个可以复现的 demo 工程就能够找到解决的办法...

msdx commented 7 years ago

是啊。但是目前出现此问题的是公司的项目。而我又找不到出现此问题的共性,想尝试写个可能复现此问题的demo都不知道从何入手。

lomanyong commented 7 years ago

@msdx 使用包含avd_show_password这个图片的库无法复现吗?

msdx commented 7 years ago

我现在的项目中都不是每次修改就会出现。就只有一些界面修改会出现,但没发现有什么共同点。

lomanyong commented 7 years ago

@msdx 是否含有 vector 图片?

msdx commented 7 years ago

在design库里有avd_hide_password及avd_show_password,但是我搜了一下avd_hide_password_1却只有如下结果:

$ find . -name "*.xml" |xargs grep "avd_hide_password_1" --color=auto
./app/build/freeline/public_keeper.xml:  <public type="drawable" name="avd_hide_password_1" id="0x7f020109" />
./app/build/freeline/app/backup/res/values/freeline_id_keeper_public.xml:  <public type="drawable" name="avd_hide_password_1" id="0x7f020109" />
lomanyong commented 7 years ago

@msdx 是哪个 design 库?我依赖了com.android.support:design:24.2.0没有看到这张图片。

不过基本可以猜测原因是 vector 图片导致的了。

你现在使用的是哪个版本的 freeline?

msdx commented 7 years ago

design25.1.0

msdx commented 7 years ago

现在用的是0.8.3,之前用0.8.2也同样出过这个问题。 avd_hide_password在design中的drawable-v21里。

lomanyong commented 7 years ago

@msdx avd_hide_password 是私有资源,确实没有avd_hide_password_1这样的资源。

但是有相关的定义在:build/intermediates/exploded-aar/com.android.support/design/25.1.0/R.txt

int drawable avd_hide_password 0x7f020053
int drawable avd_hide_password_1 0x7f020068
int drawable avd_hide_password_2 0x7f020069
int drawable avd_hide_password_3 0x7f02006a
int drawable avd_show_password 0x7f020054
int drawable avd_show_password_1 0x7f02006b
int drawable avd_show_password_2 0x7f02006c
int drawable avd_show_password_3 0x7f02006d

~问题出在这里,理论上应该是不能直接引用私有资源的~

drawable/avd_hide_passworddrawable/avd_show_password两个是animated-vector...导致了这个问题...已经复现了。

lomanyong commented 7 years ago

@msdx 这个问题转移到 #539 讨论吧,将在那里同步问题的解决情况。