问题
I have trying since long to identify the issue but unfortunately not able to
If I do
android.enableAapt2=true
The code works fine, but removing the same(Which should compulsorily be) there is a error thrown saying
\incremental\mergeDevDebugResources\merged.dir\values\values.xml:5887: error: style attribute 'attr/@attr/minTextSize' not found.
Here are the details of the versions I am using
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
classpath 'com.google.gms:google-services:4.0.1'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
In Gradle.Propeties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
Support Library version
compile 'com.android.support:appcompat-v7:28.0.0'
error outputpath
\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0-alpha3.aar\33e6fcc6d3eea5b57de6d7aedf3f55c0\res\values\values.xml
回答1:
Well, in my case it happened when i upgraded build tools, to resolve this issue, you should have two attr files like in this image:
Add these lines in both of attr.xml files:
<style name="SquareTextView">
<item name="minTextSize">5dp</item>
</style>
<declare-styleable name="SquareTextView"><attr format="dimension" name="minTextSize"/></declare-styleable>
This resolved the issue i was facing. Hope it helps someone.
回答2:
The issue is with some of the gradles added in project.
Actually the libraries internally have defined the attribute minTextSize
Due to latest updates and compatibility the attr
was not found.
To identify I have defined same attr as
<attr name="minTextSize" format="integer">16</attr>
in attrs.xml
in my app module.
Compiling the same thrown error of duplicate value and path and from that path I have found the library which needs to be updated.
Updating to the latest of all library version have solved the issue.
回答3:
If you don't have attrs.xml, then create one. After that add this snippet.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SquareTextView">
<item name="minTextSize">5dp</item>
</style>
<declare-styleable name="SquareTextView">
<attr format="dimension" name="minTextSize"/>
</declare-styleable>
</resources>
来源:https://stackoverflow.com/questions/52698540/style-attribute-attr-attr-mintextsize-not-found