I try to use Android Material components library: https://github.com/material-components/material-components-android
For getting material date picker. After I add it to my gradle: implementation 'com.google.android.material:material:1.1.0-alpha09' and build project, I get error message:
Android resource linking failed
warn: removing resource
.../values.xml:3332: error: style attribute 'android:attr/dialogCornerRadius' not found.
.../values-v28.xml:15: error: resource android:attr/dialogCornerRadius not found.
.../values-v28.xml:19: error: resource android:attr/dialogCornerRadius not found.
.../values.xml:6855: error: resource android:attr/fontVariationSettings not found.
.../values.xml:6855: error: resource android:attr/ttcIndex not found.
.../values.xml:7134: error: resource android:attr/lineHeight not found.
.../values.xml:7139: error: resource android:attr/lineHeight not found.
.../values.xml:7354: error: resource android:attr/textFontWeight not found.
error: failed linking references.
As I know there are AndroidX and Support Library conflicts.
The library documentation states that migration to AndroidX is required.
How can I use this library without migration or maybe someone knows similar material date picker libraries?
You can find another material date picker library here. In order to resolve linking errors you can try following steps:
1) In gradle.properties file add the following code:
android.useAndroidX=true
android.enableJetifier=true
2) In app level build.gradle add the following code in buildTypes:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
3) set compileSdkVersion and buildToolsVersion to 28.
The answer is inside the documentation.
If you don't want to switch over to the new androidx and com.google.android.material packages yet, you can use Material Components via the com.android.support:design:28.0.0 dependency.
Note: You should not use the com.android.support and com.google.android.material dependencies in your app at the same time.
You can find another library but keep in mind that other libraries like firebase or google play services today require the androidx migration. Sooner or later it will be the standard.
Related
I am using a third party library ( cosmos calendar) and it have android.support dependency while i am using androidx for all my project .this caused a conflict, and this error on the gridLayout dependecy :
AAPT: error: duplicate value for resource 'attr/orientation' with config ''.
i remove gridlayout or the cosmos calendar dependency ,the project builds but can't build using both dependencies. how can i workaround this conflict ?
I ended up importing the whole cosmoCalendar library from github'since it is an open source project) migrating and refactoring it to work with AndroidX then packed it in a .aar file and add it as dependency in my project , everything then worked fine .
I want to add this google play location services in android
implementation 'com.google.android.gms:play-services-location:17.0.0'
and my support:appcompat library is
implementation 'com.android.support:appcompat-v7:27.1.1'
targetSdkVersion is 27
compileSdkVersion is 27
when try to build getting error
Android resource linking failed
D:\AndroidStudioProject\GpsLocationApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2015: error: resource android:attr/fontVariationSettings not found.
D:\AndroidStudioProject\GpsLocationApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2015: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Google Play services and Firebase migrated to AndroidX in the latest release.
It means that you are using both, support libraries and androidx libraries.
You can:
migrate to androidx as described below
downgrade your google play services dependencies (but it is not a real solution because you have to migrate before or after)
You can check the official release notes:
Warning: This release is a MAJOR version update and breaking change.
The latest update to Google Play services and Firebase includes the following changes:
Migration from Android Support Libraries to Jetpack (AndroidX) Libraries. Libraries will not work unless you make the following changes in your app:
Upgrade com.android.tools.build:gradle to v3.2.1 or later.
Upgrade compileSdkVersion to 28 or later.
Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.
Also about the specific error described in the answer:
The error is:
AAPT: error: resource android:attr/fontVariationSettings not found.
AAPT: error: resource android:attr/ttcIndex not found
Change the compileSdkVersion to:
compileSdkVersion 28
fontVariationSettings and ttcIndex were added in api level 28.
I had faced following error when I update versions in Gradle:
C:\Users\03142\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\7e646e2ca904450b985ca981ac3ba677\res\values\values.xml
Error:(251, 5) error: duplicate value for resource 'attr/mode' with config ''.
Error:(251, 5) error: resource previously defined here.
How to Resolved it?
You have defined same resources for multiple times. Like you are using any module for your app but you initialled them multiple times in gradle file.
When I add the core-ktx dependency to my app's build.gradle file, my gradle builds fail with the error message AAPT2 error: check logs for details
It furthermore tells that there are two attributes missing in values.xml. This file is located under the .gradle folder inside my user directory.
when I add android.enableAAPT2=false to my project properties, the build fails due to that option being deprecated so I want to avoid that.
The error descriptions of the two resource not found errors are the following:
error: resource android:attr/fontVariationSettings not found.
Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found., sources=[C:\Users\Marc.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\b6d4f8d4d33639ae469eaec181e24176\res\values\values.xml], original message=, tool name=Optional.of(AAPT)}
When I add different ktx libraries everything is just fine. It builds properly and I can even import androidx.collections! How can I add the core-ktx library without any errors?
You are using 'AndroidX' which is only available if you set your compileSdkVersion 'android-P' and targetSdkVersion 28. Then in AndroidStudio go to Refactor -> Refactor to AndroidX and everything should work fine now :).
I'm updating my project to API level 25 (Android 7.1.1).
I've updated the build.gradle file:
gradle plugin version
support library versions
targetSdkVersion
compileSdkVersion
When I sync the project, I get the following error:
Error:(2752, 34) No resource found that matches the given name (at android:src with value #drawable/abc_ic_menu_moreoverflow_mtrl_alpha).
The error mentions the root of the problem as android:src.
The abc_ic_menu_moreoverflow_mtrl_alpha is not used in my project. Perhaps it is being used in some library ... ??
What is the meaning of this, and how do I resolve this issue?
Does this require updating some other components such as the build tools or the Google repository?
I'm using Android Studio 2.3.2 and Gradle 3.3 if that helps.
This resource has renamed. Change this
abc_ic_menu_moreoverflow_mtrl_alpha
TO
abc_ic_menu_overflow_material Solve the issue.