I am getting the following error when I build my app targeting API 23
AAPT: error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
and a list of error like :
/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:3217: error: resource android:attr/textFontWeight not found.
The app builds on API level 29 but I need it to work on API 23 precisely so changing the API version is not an option.
is there any way I could use an old layout maybe ? the app does not need to be pretty at all, it just needs to work.
edit :
I added the following line :
implementation 'com.google.android.material:material:1.2.1'
to build.grade (:app) in hope that the library would provide the resources but it did not work
but I might have added it wrong
android:style/TextAppearance.Material.Widget.Button.Borderless.Colored was added in API 24, so when building for devices with 23 you are getting this error. solution will be to implement MaterialComponents library, which will allow you to use newer styles/widgets on older devices. look for View which is causing your problem and replace it with above library or set compat style
Related
Was trying to include androidx.biometric:biometric:1.0.0-alpha03 as one of my android project dependencies, but gradle sync throws this error:
Error: Resource type cannot be an empty string (at
'strokeColor' with value '?android:/attr/colorAccent').
The file raising the red flag is:
app/build/intermediates/data-binding-layout-out/debug/drawable-v23/fingerprint_dialog_error_to_fp.xml,
Some other info that could be relevant:
compileSDK: 28
minSDK: 21
targetSDK: 28
Please note that I have not done any other migration to androidx, and I am still using an old gradle plugin and gradle itself.
Any help is really appreciated.
UPDATE
It seems like android:/attr/colorAccent should have been android:attr/colorAccent instead? Is that it?
I've used xwalk project in mine for a while now.
However, during the last round of library version upgrades, gradle doesn't like xwalk any more. Simply including it into my project
compile 'org.xwalk:xwalk_core_library:19.49.514.5'
will produce the following error on my dimens.xml:
error: resource android:attr/fontStyle not found.
error: resource android:attr/font not found.
error: resource android:attr/fontWeight not found.
dimens.xml:
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
The conflicting attributes are actually referenced in app/build/intermediates/incremental/mergeDeployDebugResources/merged.dir/values/values.xml.
Initially I paid this no attention because I needed to develop some new functionality, but now it's time to publish and I need to make my "publish" flavor working again. The ONLY difference between gradle compiling or not being inclusion of xwalk into my project.
To make matters worse, I also upgraded Android Studio to version 3 and now I'm stuck not being able to revert my repository to something before the breaking change so that I could hunt for the issue.
I googled this a lot but it seems I'm the only one messing this up, so I'd appreciate any pointers on what I might be doing wrong.
Reverting xwalk version to an older one does not help. I'm currently using the latest version which still works on Android 4.0 (project requirement).
How can I fix this?
Edit: stupid me!!!
I didn't revert to OLD ENOUGH version of xwalk. reverting to 15.44.384.13 removes the problem.
The issue is that the attributes in question are only supported from API 16 forward and I must also work with 14 --> Even upping minSdkVersion to 16 doesn't solve the issue.
Edit2: disabling aapt2 does not help: the same errors are reported with aapt1.
Downgrading build tools from 26.0.2 to 25.0.2 does not help.
Edit3: Increasing compileSdkVersion & targetSdkVersion to 26 solves the problem. I have 22 normally because of Marshmallow permissions system. Note that it MUST be at least 26. Even 25 still produces the error.
I am allowed to leave it at 22 in the libraries I'm using, but not the main app project using xwalk.
Open build.gradle and put this at the end of the file:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
Running "cordova build android" - unable to find attribute android:fontVariationSettings and android:ttcIndex
I have some general questions about the use of support libraries but I can't find good resources to answer them.
Context :
The app I'm working on has a minimum SDK target set to 9. I'm working with support libraries v4 and v7 that I import with gradle using
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
I also declare the version of sdk to compile against and the minimum SDK version with
minSdkVersion 9
compileSdkVersion 22
Now this will compile and build an apk without error. But when I change the compileSDKVersion to 19, I will get a lot of errors such as
Error:(2) Error retrieving parent for item: No resource found that
matches the given name 'android:TextAppearance.Material.Inverse'.
telling me that the SDK I'm compiling with does not contain some resources used by the compatibility libraries, I should instead use previous compatibility libraries.
Questions:
What is the minimum SDK version I can compile against using both v4 and v7 (or what is the minimal SDK version supported by both v4 and v7) ? Is there a way to see all the versions available in the Android Support Repository ?
Is it risky to set the minimum SDK version to 9 and the compileSDKVersion to 22 and use elements provided by the Support library targetting API 22? I mean: may I get runtime exception due to missing classes/resources ?
Is there a way to configure Gradle to show some potential incompatibilities ? I know sometimes I get a compiling error when using methods present in higher API than the minimum one. But does it generalize to xml as well (such as themes or resources) ?
I know that I get compiling errors when a (support) library references a resource that is not present in the compiled SDK. Is there a way to get similar warnings/errors for the minimum SDK as well ?
Sorry if the questions are too vague, let me know if you need some precisions ! If you know interesting resources that might answer part of a question, don't hesitate to share here ;)
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
It happens because the support libraries v22 require API 22.
You can't compile with API 19.
What is the minimum SDK version I can compile against using both v4 and v7 (or what is the minimal SDK version supported by both v4 and v7)
Usually the minSdk is in the name of the library.
It is api4 for the v4 and api7 for the appcompat.
Is there a way to see all the versions available in the Android Support Repository ?
You can check it inside the folder androidsdk\extras\android\m2repository\com\android\support opening the aar file for example.
Is it risky to set the minimum SDK version to 9 and the compileSDKVersion to 22 and use elements provided by the Support library targetting API 22? I mean: may I get runtime exception due to missing classes/resources ?
No if you are using the support libraries v22.
I know that I get compiling errors when a (support) library references a resource that is not present in the compiled SDK. Is there a way to get similar warnings/errors for the minimum SDK as well ?
No for my experience.
There is a general rule.
The library major version number is the minimun compile sdk version.
It means:
support libraries v21.x.x -> requires API 21
support libraries v22.x.x -> requires API 22
support libraries v23.x.x -> requires API 23
I have set my app's min Sdk version to jelly bean. (created for kit kat)
after that this error occurred.
Android Studio : No resource found that matches the given name: attr 'android:actionModeShareDrawable'
how can I solve this ?
From Error
No resource found that matches the given name: attr 'android:actionModeShareDrawable'
The issue is about compling application with lower target.
AppCompat v21 builds themes that require the new APIs provided in API 21 (Android 5.0). To compile your application with AppCompat, you must also compile against API 21. The recommended setup for compiling/building with API 21 is a compileSdkVersion of 21 and a buildToolsVersion of 21.0.1 (which is the highest at this time - you always want to use the latest build tools).
Make sure the value for target (which tells the target android version) in project.properties file of both your project folder and appcompat_v7 folder is same
: inside 'your_project'/project.properties
target=android-21
android.library.reference.1=../appcompat_v7
and
: inside appcompat_v7/project.properties
target=android-21
android.library=true
and after this don't forget to clean your project .
Hope it helps!
We have an Android app that is using ActionBarSherlock and has the following Manifest configuration:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15"/>
Lately we encountered crashes because we hat the following code line in the app:
String type = ...
if (type.isEmpty()) {
...
}
because the isEmpty() method is not available in Android 2.2.x (out minSdkVersion 8 we still support).
So we want to find that problem in development, while compiling the app an not when running on the device. Configuring Android version 2.2.x as SDK by setting
<sdk>
<platform>8</platform>
</sdk>
in the maven build configuration leads to the problem that the build fails because of ActionBarSherlock:
[INFO] ../target/unpack/apklibs/com.actionbarsherlock_library_apklib_4.1.0/res/values-v14/abs__styles.xml:4: error:
Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar'.
So my question: Is there a way to compile with the correct SDK that makes sure everything in the code is compatible with the devices specified in minSdkVersion AND use ActionBarSherlock?
If you're using ActionBarSherlock you have to compile with a later SDK. But you can use Lint to check for these invalid API calls at build time.