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
Related
My app, which was working before, suddenly started crashing in my LaunchActivity with: Please configure your build for VectorDrawableCompat. This is happening with Gradle 7.0.2, which doesn't make sense since other posts regarding this issue are from 3 years ago and recommend updating to gradle 2.0+ (which is much older) and also using the latest android support library (which is a non-issue now with androidx). They also recommend setting vectorDrawables.useSupportLibrary = true which has already been the case in my app. So those posts weren't relevant to my issue.
minSdkVersion 21
targetSdkVersion 31
vectorDrawables.useSupportLibrary = true
classpath 'com.android.tools.build:gradle:7.0.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
Oddly this started happening on my master after I switched to a different branch and then returned to my master branch after a month. However, the master branch shouldn't have changed at all and it must have been working before, because I cut a production release from it that previous month, and the production release wasn't crashing.
Caused by: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.
at androidx.appcompat.widget.ResourceManagerInternal.checkVectorDrawableSetup(ResourceManagerInternal.java:495)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:140)
at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:480)
at androidx.appcompat.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:93)
at androidx.appcompat.app.AppCompatDelegateImpl.attachToWindow(AppCompatDelegateImpl.java:797)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureWindow(AppCompatDelegateImpl.java:773)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreate(AppCompatDelegateImpl.java:501)
at androidx.appcompat.app.AppCompatActivity$2.onContextAvailable(AppCompatActivity.java:131)
at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable(ContextAwareHelper.java:99)
at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:297)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:273)
at com.somewearlabs.sw.ui.LaunchActivity.onCreate(LaunchActivity.kt:14)
at android.app.Activity.performCreate(Activity.java:7963)
at android.app.Activity.performCreate(Activity.java:7952)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
I finally fixed the issue. When I was inspecting the crash in Android Studio, clicking on the file/line number link (eg. "ResourceManagerInternal.java:495") opened up two options for the class, one in appcompat library version 1.2.0 and also 1.3.0. There must have been two versions used in my dependencies, even though in the build.gradle files for all of my projects explicitly stated androidx.appcompat:appcompat:1.2.0. Using a breakpoint showed that the line in 1.3.0 was getting called when launching the app.
Then I did File > Invalidate Caches and Restart.
I thought that ensuring that only one version of appcompat being used in the project might fix things, so I switched all the build.gradle files from using androidx.appcompat:appcompat 1.2.0 to 1.3.0. After resyncing/building, the crash went away. I don't know why this crash started happening in the first place - if anyone could shed some light on this - but I needed to update the appcompat dependency anyway so it worked out.
I'm starting to get errors when I am executing a test for a release variant which was always working fine. The code has always been executed in a Docker container so we can ensure that the build will always be clean.
Today for some reason with no changes at all to the code, I am starting to see errors on the test run:
Execution failed for task:
am:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/.gradle/caches/transforms-2/files-2.1/ff28653768e2ccb1135467db3600af3a/core-1.7.0-alpha02/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
I've made some research about the error, but I only find errors related to another resource, but nothing about lStar. So far about, I have found that lStar is code added to Android 31 (Android 12) in particular, which makes no sense to me why it should start working on Android 12 if my compileSdkVersion value is 28.
<declare-styleable name="ColorStateListItem">
<!-- Base color for this state. -->
<attr name="android:color"/>
<!-- Alpha multiplier applied to the base color. -->
<attr format="float" name="alpha"/>
<attr name="android:alpha"/>
<!-- Perceptual luminance applied to the base color. From 0 to 100. -->
<attr format="float" name="lStar"/>
<attr name="android:lStar"/>
</declare-styleable>
What could be the cause of this error even though nothing has been changed?
I've found the issue and I was able to fix it.
The issue was that one of the external libraries the app depends on has a dependency on androidx.core:core-ktx:+ which meant that was always compiling with the latest version. My app is still working on SDK 28, but the latest version of androidx.core:core-ktx has the minimal SDK of 31, which resulted in this conflict.
I changed the line androidx.core:core-ktx:+ to androidx.core:core-ktx:1.6.0 in the build.gradle, and it worked for me.
What could be the cause of this error even though nothing has been changed?
As we can see in https://developer.android.com/jetpack/androidx/releases/core#1.7.0-alpha02, Core and Core-ktx Version 1.7.0-alpha02 was released on September 1, 2021.
If you used like androidx.core:core-ktx:+, it would find the last version.
So, on the September 1, 2021, it may be 1.7.0-alpha01 that was not adding the attribute "android:lStar" which need the Android 31 compile SDK. It's a bug.
How can we fix it?
use a specific version, use androidx.core:core-ktx:${version} instead of androidx.core:core-ktx:+
upgrade the compile SDK to Android 31
Are you using the netinfo library? You need to refresh this library if you are using it.
After updating or uninstalling and reinstalling the netinfo library it will work.
I had used this and it works for me.
android {
configurations.all {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
}
}
}
check you added the correct version of
implementation 'com.google.android.material:material:1.3.0'
in dependencies
I used appcompat lib as:
implementation("androidx.appcompat:appcompat:1.3.1")
implementation("androidx.appcompat:appcompat-resources:1.3.1")
Kotlin version as 1.6.0
And it works for me
This is the first time I've run across an error like this, and it indicates to me that I understand significantly less about Android Studio / Gradle than I thought.
When I run a gradle sync, I receive the following error:
/Users/username/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/65cf0a0160015e9f883c383ac0bd600d/res/values-v26/values-v26.xml
Error:(9, 5) error: resource android:attr/colorError not found.
There are a few other errors thrown, but they're more or less the same.
Part 1) Pulling apart the URL with .gradle/caches/... part of the URL, I can see that I'm trying to build from a version 27 resource (...appcompat-v7-27.1.1.aar...), but within that build there is a values-v26.xml file. That's the first part that is confusing me. Shouldn't they both say the same thing?
Secondly, in my app/build.grade, I have specified that I want to use API version 26:
compileSdkVersion 26
defaultConfig {
applicationId "com.adrichmobile"
minSdkVersion 26
targetSdkVersion 26
....
compile 'com.android.support:appcompat-v7:26.1.0'
Part 2) Why would I be trying to pull from version 27 in the cache? (After clearing the cache, I get the same thing)
It turns out my problem was a common one (with a recent update of react-native), but I was originally searching for things that didn't lead me to this conclusion.
In the end, I had to force my subprojects to build with the tools and SDK, as they hadn't been updated for this release. Looks like this is affecting many react-native projects.
More details can be found here: https://github.com/react-community/react-native-image-picker/issues/882#issuecomment-405255785
I think this issue because cached files.
I recommend Clean project and clear Android Studio cache by menu File`”Invalidate Caches and Restart…”`
And reboot computer so make Gradle sync again
Download the project of Google IO 2018 (iosched), try to compile it in Android Studio 3.3 Canary 7, also the probe in 3.2 RC1. But I get the following error:
error: resource style/TextAppearance.MaterialComponents.BottomNavigationView.Colored (aka com.google.samples.apps.iosched:style/TextAppearance.MaterialComponents.BottomNavigationView.Colored) not found.
Checking the file style. xml, it is observed that fails to find the style TextAppearance.MaterialComponents.BottomNavigationView.Colored.
<style name="TextAppearance.IOSched.BottomNavigationView" parent="#style/TextAppearance.MaterialComponents.BottomNavigationView.Colored">
<item name="android:fontFamily">#font/google_sans</item>
<item name="android:textColor">#color/bottom_nav_item</item>
</style>
Also check that the Google Material components dependency if implemented.
implementation "com.google.android.material:material:$rootProject.materialVersion"
I can't understand why it might be making this mistake.
you can see here
https://github.com/google/iosched/issues/285#issuecomment-416114763
you can use the Android Studio Stable 3.2
use the last dependencies.
in the file iosched/gradle.properties,mofiy
androidGradlePluginVersion = '3.2.0'
materialVersion = '1.0.0'
kotlinVersion = '1.2.51'
in the file iosched/mobile/src/main/res/values/styles.xml
change
#style/TextAppearance.MaterialComponents.BottomNavigationView.Colored
to
#style/Widget.MaterialComponents.BottomNavigationView.Colored
I have managed to make it compile by installing android studio 3.2.0 beta 4.
as seen in the following image
with Android Studio 3.1.4 it builds, unless updating the outdated dependencies. there also is on open issue: https://github.com/google/iosched/issues/285
and it does complain much when building with ./gradlew build
once I've manually updated those beta01 versions to rc01 I also get that:
error: resource style/TextAppearance.MaterialComponents.BottomNavigationView.Colored (aka com.google.samples.apps.iosched:style/TextAppearance.MaterialComponents.BottomNavigationView.Colored) not found.
which basically means, that material-components-android is missing or outdated. to resolve this, you could simply copy the absent style from GitHub and manually add it into styles.xml or simply do not update that outdated library versions, until there is a final release of all those release candidates, which are not yet considered as "stable".
the bottom line may be, that it builds against materialVersion = '1.0.0-beta01' (which might contain that style), but not against materialVersion = '1.0.0-rc01' (which may lack that style).
maybe consider using a stable version of Android Studio, alike 3.1.4 - instead of using the canary channel and then complain it won't work; maybe you even build unknowingly against the rc01 version, because this is exactly the issue which I get when updating that library to rc01 - and the title of this question also boldly states RC01.
Recently I have Updated my Android Studio from 2.2.3 to 2.3.0 project was running fine in 2.2.3 but after updating project dependency classpath from 2.2.3 to 2.3.0 getting lots of Missing Translations error from string.xml.
Can anyone tell me why it is happening and How to Resolve these Errors ?
Have many methods to fix this:
First method:
Add to build.gradle:
android {
lintOptions {
disable 'MissingTranslation'
}
}
Second method:
It's the ignore attribute of the tools namespace in your strings file, as follows:
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation" >
<!-- your strings here; no need now for the translatable attribute -->
</resources>
Third method:
In your ADT go to window->Preferences->Android->Lint Error Checking
Find there Missing Translation and change its Severity to Warning.
Reference link:
http://www.fasteque.com/missingtranslation-issue-for-release-builds/
Hope it helpful for you.
I was facing the exact same issue. Based on my observation, this problem was introduced with Gradle plugin version 2.3.0. It occurs when there is a module in your project that supports more languages than your app or other modules. You could start editing the translations of such modules but that makes them less maintainable.
If you disable the Lint checks using any of the suggestions here or for similar questions you also ignore actual translation errors in your app where a translation is missing for a language you are supporting. You need to be very careful maintaining your strings after that.
There is one more, also suboptimal, option: change the plugin version back to the last one not showing these symptoms in your build.gradle.
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
There is however a way to make this work without losing vital warnings/errors and without reverting to old tool versions. You can find it in Google's documentation and also in this answer.
android {
defaultConfig {
...
resConfigs "en", "fr"
}
}
This removes not needed resources and the warnings and errors along with them. I have updated my code and it builds fine now.
There is another issue that was introduced with the new Gradle plugin version: If you get false positives, i.e. errors complaining about missing translations for a string you have marked non-translatable, check if the string name exists in another module. In that case rename or provide the translations and the error disappears.