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?
Related
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
I tried upgrading my app for supporting API 29, and it works when I just upgrade the compileSdkVersion and targetSdkVersion to 29. However, as soon as I change my buildTools Version to 29.0.2, I get Unresolved reference errors for my files that I know are right (The errors are in one of my user files, not an external library). I know that it is right because when I pull the same code (and branch) on my mac, it works perfectly with the 29.0.2 buildToolsVersion.
I tried a bunch of things based on other stackoverflow posts like checking my gradle version, kotlin plugins, etc.
As an example:
Android Studio 3.1: Erroneous unresolved references in editor
(Note that the difference between mine and the one shown in the link above is that there is no red highlights for any of those unresolved errors and the file does not have any red squiggly underline. I would not know that there was any error in the file without looking at the build output.)
Things I tried (that does not work):
Clean project and rebuild
Invalidating cache and restart
deleting .idea folder
Resyncing gradle files
Reinstalling android studio and cloning repo again
Placing "apply plugin: kotlin-android-extensions" in various places
Within my build.gradle, I have:
buildscript {
ext.versions = [
.
.
.
buildGradle : "3.5.0"
kotlin : "1.3.31"
kotlinGradlePlugin : "1.3.50"
kotlinReflect : "1.3.50"
kotlinStdLib : "1.3.50"
.
.
.
]
}
In my common.gradle, I have:
apply plugin: 'kotlin-android'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
.
.
.
}
}
Also note that unfortunately this project is not open-source, so I can't show too much of the code or the project. But it is a hybrid project (contains both kotlin and java code).
Java Version: 1.8
Kotlin JVM version: 1.6
Any suggestions on what I could try would be appreciated cause I am really stuck now (and could not find any difference in configs between mac and this one).
As an answer to myself, not exactly sure why this was happening, but I suspect it has something to do with one of the files being kotlin and the other one being java. I was trying to import java file into kotlin file as dependency, and this caused the unresolved errors. Not sure why it was not causing the same error with other machines and not sure why it was struggling only with this file, when I have other kotlin files that also import java files. My solution was to convert that java file to kotlin and everything worked fine after that.
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
Why do we get this error in Android Studio 3.0 RC1?
com.android.dx.cf.code.SimException:
default or static interface method used without --min-sdk-version >= 24
According to the android docs, the feature "Default and static interface methods" is compatible with Any min-sdk version.
I tracked this down to a java-library that calls Comparator.naturalOrder() - which has been added in API level 24.
So I would not expect any error-message at all for this code in a java-library.
When I use the code in my own android-app or lib java code, I see the correct lint message: "Call requires API level 24)"
Is the error-message wrong or am I missing something?
I just found out that it works as expected when I activate the D8 dexer which is planned to be the default for Android Studio 3.1
In the project gradle.properties, add:
android.enableD8=true
Now the code compiles as expected and I still get the expected linter messages.
If the java-library that you're talking about was guava, you can try to upgrade it to the latest android-specific build
implementation 'com.google.guava:guava:23.0-android'
This fixed for me
From guava v24 we have two alternative versions: Android or JRE. So, in this case you need to include the dependency as:
compile 'com.google.guava:guava:24.1-android'
Find all the details within the repo: https://github.com/google/guava
If this error occurs due to Guava, then the solution, as per the official documentation from Google is:
https://github.com/google/guava
Change the dependency to (version is current as of this writing):
api 'com.google.guava:guava:27.0-android'
This fixed the issue for me.
I'm having issues with current Android project I'm working on, It has OpenCV Library imported as Module and set as dependency. After updating Android Studio from 0.8.14 to 1.0, and trying to sync Gradle I'm getting following error:
Error:Library projects cannot set applicationId. applicationId is set
to 'org.opencv' in default config.
I'd like to post my project structure and grade file, but I can't upload images yet.
Try commenting applicationID out of your library module's build.gradle file. Like this:
defaultConfig {
// applicationId "com.library.package"
minSdkVersion 14
targetSdkVersion 21
}
I'm still new at Android Studio, and am by no means an expert, but I got the same error after upgrading and this seems to fix it.
I tried to use comment, but instead to fix it, it generate new error (SOLVED).
With "applicationId 'lecho.lib.hellocharts'" enabled:
Library projects cannot set applicationId. applicationId is set to 'lecho.lib.hellocharts' in default config
With "applicationId 'lecho.lib.hellocharts'" disabled (as comment):
A problem occurred configuring project ':hellocharts-library'.
Exception thrown while executing model rule: org.gradle.api.publish.plugins.PublishingPlugin$Rules#addConfiguredPublicationsToProjectPublicationRegistry(org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectPublicationRegistry, org.gradle.api.publish.PublishingExtension, org.gradle.api.internal.project.ProjectIdentifier)
java.lang.NullPointerException (no error message)
I found solution.