解决 aka com.chaozh.iReader:style/Theme.AppCompat.Light.NoActionBar) not found.
我们项目本来是可以编译通过的,但是自从接入了DoraemonKit 之后,就编译不通过。
报错如下:
error: resource style/Theme.AppCompat.NoActionBar (aka com.chaozh.iReader:style/Theme.AppCompat.NoActionBar) not found.
error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.chaozh.iReader:style/Theme.AppCompat.Light.NoActionBar) not found.
error: resource style/Widget.AppCompat.Light.ActionBar.Solid (aka com.chaozh.iReader:style/Widget.AppCompat.Light.ActionBar.Solid) not found.
AGPBI: {"kind":"error","text":"error: style attribute \u0027attr/titleTextStyle (aka com.chaozh.iReader:attr/titleTextStyle)\u0027 not found.","sources":[{"file":"F:\\git\\iReader_vivo\\iReader\\src\\main\\res\\values\\style_overwrite.xml","position":{"startLine":12,"startColumn":4,"startOffset":565,"endLine":14,"endColumn":12,"endOffset":762}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: style attribute \u0027attr/contentInsetStart (aka com.chaozh.iReader:attr/contentInsetStart)\u0027 not found.","sources":[{"file":"F:\\git\\iReader_vivo\\iReader\\src\\main\\res\\values\\style_overwrite.xml","position":{"startLine":12,"startColumn":4,"startOffset":565,"endLine":14,"endColumn":12,"endOffset":762}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: style attribute \u0027attr/contentInsetEnd (aka com.chaozh.iReader:attr/contentInsetEnd)\u0027 not found.","sources":[{"file":"F:\\git\\iReader_vivo\\iReader\\src\\main\\res\\values\\style_overwrite.xml","position":{"startLine":12,"startColumn":4,"startOffset":565,"endLine":14,"endColumn":12,"endOffset":762}}],"original":"","tool":"AAPT"}
error: resource style/TextAppearance.AppCompat.Widget.ActionBar.Title (aka com.chaozh.iReader:style/TextAppearance.AppCompat.Widget.ActionBar.Title) not found.
error: resource style/Widget.AppCompat.ActionMode (aka com.chaozh.iReader:style/Widget.AppCompat.ActionMode) not found.
AGPBI: {"kind":"error","text":"error: style attribute \u0027attr/background (aka com.chaozh.iReader:attr/background)\u0027 not found.","sources":[{"file":"F:\\git\\iReader_vivo\\iReader\\src\\main\\res\\values\\style_overwrite.xml","position":{"startLine":68,"startColumn":4,"startOffset":3885,"endLine":70,"endColumn":12,"endOffset":4105}}],"original":"","tool":"AAPT"}
error: resource style/Base.DialogWindowTitle.AppCompat (aka com.chaozh.iReader:style/Base.DialogWindowTitle.AppCompat) not found.
error: resource style/Base.DialogWindowTitleBackground.AppCompat (aka com.chaozh.iReader:style/Base.DialogWindowTitleBackground.AppCompat) not found.
error: resource style/Widget.AppCompat.Light.ActionButton.Overflow (aka com.chaozh.iReader:style/Widget.AppCompat.Light.ActionButton.Overflow) not found.
error: resource style/TextAppearance.AppCompat.Title (aka com.chaozh.iReader:style/TextAppearance.AppCompat.Title) not found.
error: resource style/ThemeOverlay.AppCompat.Dialog.Alert (aka com.chaozh.iReader:style/ThemeOverlay.AppCompat.Dialog.Alert) not found.
error: resource style/TextAppearance.Widget.AppCompat.Toolbar.Title (aka com.chaozh.iReader:style/TextAppearance.Widget.AppCompat.Toolbar.Title) not found.
error: resource style/Widget.AppCompat.Toolbar (aka com.chaozh.iReader:style/Widget.AppCompat.Toolbar) not found.
AGPBI: {"kind":"error","text":"error: style attribute \u0027attr/contentInsetStart (aka com.chaozh.iReader:attr/contentInsetStart)\u0027 not found.","sources":[{"file":"F:\\git\\iReader_vivo\\iReader\\src\\main\\res\\values\\style.xml","position":{"startLine":312,"startColumn":4,"startOffset":15493,"endLine":317,"endColumn":12,"endOffset":15751}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: style attribute \u0027attr/contentInsetEnd (aka com.chaozh.iReader:attr/contentInsetEnd)\u0027 not found.","sources":[{"file":"F:\\git\\iReader_vivo\\iReader\\src\\main\\res\\values\\style.xml","position":{"startLine":312,"startColumn":4,"startOffset":15493,"endLine":317,"endColumn":12,"endOffset":15751}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: style attribute \u0027attr/contentInsetStartWithNavigation (aka com.chaozh.iReader:attr/contentInsetStartWithNavigation)\u0027 not found.","sources":[{"file":"F:\\git\\iReader_vivo\\iReader\\src\\main\\res\\values\\style.xml","position":{"startLine":312,"startColumn":4,"startOffset":15493,"endLine":317,"endColumn":12,"endOffset":15751}}],"original":"","tool":"AAPT"}
:iReader:processVivoDebugResources FAILED
:iReader:processVivoDebugResources spend 791ms
最后查的原因是:使用了aspectj 插件。
apply plugin: 'android-aspectjx'
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4'
去掉之后就可以了。但是几天前我还可以编译通过。不知道为什么。花了两天的时间,一点一点的注释代码去排查。
没有办法,走到了知识盲区里面。
后来发现,有问题的时候,依赖的是appcompat.jar,没有问题的时候依赖的是appcompat.aar。Jar 里面肯定没有style 样式文件,只有Aar 里面才有。截图如下:
有问题的:

没问题的:

但是为什么会这样,还是和沪江的插件有关系,用com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4 有问题,用com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.5 就好了。
一个查看依赖的方法:
他会告诉你,依赖的是aar 还是jar
