问题描述:
详细错误信息
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
E:\eclipse\svn_android\app\src\main\res\layout\activity_finished_record.xml:15: AAPT: error: attribute current_month_lunar_text_color (aka com.microhabit:current_month_lunar_text_color) not found.
E:\eclipse\svn_android\app\src\main\res\layout\activity_finished_record.xml:15: AAPT: error: attribute current_month_text_color (aka com.microhabit:current_month_text_color) not found.
E:\eclipse\svn_android\app\src\main\res\layout\activity_finished_record.xml:15: AAPT: error: attribute max_year (aka com.microhabit:max_year) not found.
E:\eclipse\svn_android\app\src\main\res\layout\activity_finished_record.xml:15: AAPT: error: attribute min_year (aka com.microhabit:min_year) not found.
E:\eclipse\svn_android\app\src\main\res\layout\activity_finished_record.xml:15: AAPT: error: attribute month_view (aka com.microhabit:month_view) not found.
E:\eclipse\svn_android\app\src\main\res\layout\activity_finished_record.xml:15: AAPT: error: attribute month_view_show_mode (aka com.microhabit:month_view_show_mode) not found.
我在项目中导入了一个自定义的CalendarView(就是一个自定义日历控件)
<com.haibin.calendarview.CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#fff"
app:current_month_lunar_text_color="#CFCFCF"
app:current_month_text_color="#333333"
app:max_year="2020"
app:year_view_scheme_color="#f17706" />
该控件中有很多自定义属性,运行前什么错误都没提示,但是一往手机上运行时就报错,提示自定义属性找不到。
提示:这个自定义控件,我是通过module形式导入到项目中的。
废话不多说直接上解决办法:
解决办法就是 将导入的module添加到项目中,下面是添加步骤
1.点击 File > Project Structure
2.根据下图中的1.2.3.4顺序依次点击(我这个引入的是module如果你是library或者jar 就在第4步选择对应的就ok)
3.选择要导入的module,如果没有选项,就检查这个module是否引入到项目中了,引入办法可以复制到项目中和app同级目录,也可以通过File > New > Import Module导入
4.最后一定要点 ok 不然都没作用
5.都完成后可以再检查一下看这个module是否已经在依赖中。
在的话,就可以重新运行项目试试了。我的问题到此就解决了
截图不易,解决问题的兄弟,记得来点个赞啊。
转载请标明出处。