Android resource linking failed ( error: failed linking references.) - android

After i add GDPR code to my app in (MainActivity.java) seccion , After i try to rebuild project i get this error :
Android resource linking failed
C:\Users\jalal\Desktop\codecanyon-20549858-fast-cleaner-battery-saver-with-admob-ads\Main File\Fast Cleaner & Battery Saver\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
C:\Users\jalal\Desktop\codecanyon-20549858-fast-cleaner-battery-saver-with-admob-ads\Main File\Fast Cleaner & Battery Saver\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
C:\Users\jalal\Desktop\codecanyon-20549858-fast-cleaner-battery-saver-with-admob-ads\Main File\Fast Cleaner & Battery Saver\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
error: failed linking references.
I already checked her and i don't found any solution , Thank you

Look at the error reported:
values-v26.xml:7: error: resource android:attr/colorError not found
This one (and the next few) are all because these android attributes were only added in API 26 (that's why they're referenced from values-v26). You need to update your compileSdkVersion to at least 26, although I'd highly recommend updating to the newest API 28.
Edit your app level's build.gradle file:
android {
compileSdkVersion 28
...
}

Related

Prepare Android App for Previous SDK Versions

I have built an Android App using Android Studio and I've been doing testing with a tablet running Android version 5.1.1 (API 22). Once the development was finished I tried using the APK to install the same app to an S7 running Android 8.0.0 (API 26). The app crashed while running on the S7, but runs flawlessly on the tablet. The target SDK version for the app I built is API 29 and the minimum SDK version is API 22.
I can change the compile SDK version from 29 to 28 and I don't get any build errors. However, changing it to 27 gives me the following errors:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
C:\Users\xxxxx\.gradle\caches\transforms-2\files-2.1\9073307f5eb1fdd8dc5b08ac4a3a252e\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
C:\Users\xxxxx\Desktop\appDev\app_green\myApp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.
C:\Users\xxxxx\.gradle\caches\transforms-2\files-2.1\11ac981ad78c9fd8730f98006e1b2a23\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\xxxxx\.gradle\caches\transforms-2\files-2.1\11ac981ad78c9fd8730f98006e1b2a23\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.
I figured if I decreased the API level one by one and fixed any errors that popped up, I'd eventually end up with an app that would work on all the desired APIs. Is this a correct assumption?
How do I go about fixing errors like this one that fail to link Gradle resources? This one seems to be an error with a dialog box that I used to get user input.
All solutions to these errors that I find are "change API version," but what if I need this API version?
Edit:
At the request of those attempting to help me solve this issue I am posting the crash log from the S7.
Process: com.myApp, PID: 15167
android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/myApp/files/export_a_c.csv exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
at android.net.Uri.checkFileUriExposed(Uri.java:2356)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:944)
at android.content.Intent.prepareToLeaveProcess(Intent.java:10480)
at android.content.Intent.prepareToLeaveProcess(Intent.java:10486)
at android.content.Intent.prepareToLeaveProcess(Intent.java:10465)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1616)
at android.app.Activity.startActivityForResult(Activity.java:4564)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:767)
at android.app.Activity.startActivityForResult(Activity.java:4522)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:754)
at com.example.myApp.SecondActivity$onCreate$3$3.onClick(SecondActivity.kt:218)
at android.view.View.performClick(View.java:6897)
at android.widget.TextView.performClick(TextView.java:12693)
at android.view.View$PerformClick.run(View.java:26101)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
The error occurs when I try to create/write to a csv file. The intent is to create this file automatically and then prompt the user to share it via email.
Edit 2:
So I've fixed the crash issue while running on the S7. How do I ensure that the app will run for each API? Must I downgrade my S7's software to the APIs I want to test?
You will need to setup a File provider in the app. https://developer.android.com/training/secure-file-sharing/setup-sharing
Remove declaration for compile.sdk from your manifest and build.gradle.
You should keep the min and build SDK version declarations only.

Removing resource com.myapp.application:string/com_facebook_loginview_logged_in_using_facebook_f1gender without required default value

From one day to another I'm getting this error in my project:
Android resource linking failed
warn: removing resource com.myapp.application:string/com_facebook_loginview_logged_in_using_facebook_f1gender without required default value.
C:\Users\adamv\.gradle\caches\transforms-1\files-1.1\jetified-facebook-login-5.0.0.aar\93f0acb2a4de491348f33e5cac2f3dd4\res\drawable\com_facebook_button_login_background.xml:26: error: resource color/com_facebook_button_background_color_focused_disabled (aka com.myapp.application:color/com_facebook_button_background_color_focused_disabled) not found.
C:\Users\adamv\.gradle\caches\transforms-1\files-1.1\jetified-facebook-login-5.0.0.aar\93f0acb2a4de491348f33e5cac2f3dd4\res\drawable\com_facebook_button_login_background.xml:38: error: resource color/com_facebook_button_background_color_focused (aka com.myapp.application:color/com_facebook_button_background_color_focused) not found.
C:\Users\adamv\.gradle\caches\transforms-1\files-1.1\jetified-facebook-login-5.0.0.aar\93f0acb2a4de491348f33e5cac2f3dd4\res\drawable\com_facebook_button_login_background.xml:39: error: resource color/com_facebook_button_border_color_focused (aka com.myapp.application:color/com_facebook_button_border_color_focused) not found.
C:\a_projects\myapp-android\app\src\main\res\layout\activity_login.xml:75: error: resource drawable/com_facebook_button_icon_white (aka com.myapp.application:drawable/com_facebook_button_icon_white) not found.
C:\a_projects\myapp-android\app\src\main\res\layout\activity_register.xml:113: error: resource drawable/com_facebook_button_icon_white (aka com.myapp.application:drawable/com_facebook_button_icon_white) not found.
C:\a_projects\myapp-android\app\src\main\res\layout\activity_settings.xml:181: error: resource drawable/com_facebook_button_icon_white (aka com.myapp.application:drawable/com_facebook_button_icon_white) not found.
error: failed linking file resources.
I did nothing with the code. It is failing to build from one day to another.
In my gradle I use the following facebook libs:
implementation 'com.facebook.android:facebook-login:5.0.0'
implementation 'com.facebook.android:facebook-share:[5,6)'
These facebook libs were worked. I have another app where I use these, and that wan builds falwlessly.
Please, help if you can.
See Prince's answer here. If that does not work, you can manually set the colors.
<color name="com_facebook_button_background_color_focused_disabled">#3C5A99</color>
<color name="com_facebook_button_background_color_focused">#3C5A99</color>
<color name="com_facebook_button_border_color_focused">#3C5A99</color>

How to fix linking error on Android project

My compiler just showed this error. I have no idea what happened.
I'm testing a project which runs with firebase. On its request, I just went to project structure to change my minsdk to 26, but after I changed it, it provides these errors.
Since this is my first Android project, I have no idea what has happened.
Can somebody give me a hand and help me get through it?
Android resource linking failed
C:\Users\user\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
C:\Users\user\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
C:\Users\user\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1894: error: resource drawable/edit_text_background_dark_round (aka com.example.myapplication:drawable/edit_text_background_dark_round) not found.
C:\Users\user\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1897: error: resource drawable/ic_down_arrow (aka com.example.myapplication:drawable/ic_down_arrow) not found.
C:\Users\user\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v21\values-v21.xml:282: error: resource drawable/edit_text_background_dark_round (aka com.example.myapplication:drawable/edit_text_background_dark_round) not found.
C:\Users\user\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v21\values-v21.xml:285: error: resource drawable/ic_down_arrow (aka com.example.myapplication:drawable/ic_down_arrow) not found.
C:\Users\user\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2786: error: resource android:attr/fontVariationSettings not found.
C:\Users\user\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2787: error: resource android:attr/ttcIndex not found.
error: failed linking references.
check XML files cause "android:attr/dialogCornerRadius not found"
means that 'dialogCornerRadius' is not defined , you can replace it
with value like "2dp" or initialise it in ' dimens.xml' check this
link to create 'dimen' file
How to use dimens.xml in Android?

Android Motionlayout: Android resource linking failed

I keep getting build errors after a refactor to motionlayout 2.0.0-beta1 (I know it's not the newest version - beta2 produces same errors).
Here's the stacktrace:
AAPT: /Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6514: error: resource attr/flow_horizontalSeparator (aka com.example:attr/flow_horizontalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6514: error: resource attr/flow_verticalSeparator (aka com.example:attr/flow_verticalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6515: error: resource attr/flow_horizontalSeparator (aka com.example:attr/flow_horizontalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6515: error: resource attr/flow_verticalSeparator (aka com.example:attr/flow_verticalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6517: error: resource attr/flow_horizontalSeparator (aka com.example:attr/flow_horizontalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6517: error: resource attr/flow_verticalSeparator (aka com.example:attr/flow_verticalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6517: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6860: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6861: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6876: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6877: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6877: error: resource attr/waveDecay (aka com.example:attr/waveDecay) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:7288: error: resource attr/motionPathRotate (aka com.example:attr/motionPathRotate) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:7290: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:7549: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:8270: error: resource attr/duration (aka com.example:attr/duration) not found.
error: failed linking references.
There's no indication as to what file produces the error and to my knowledge I don't use any of these attributes anywhere in my project.
This problem is related to Android Studio 3.6 and ConstraintLayout versions earlier than 2.0.0-beta3 - I've reported the issue here. This is fixed in ConstraintLayout 2.0.0-beta3.
Android Studio 3.5 doesn't produce this error.
To make it work in AS 3.6 beta, upgrade to ConstraintLayout 2.0.0-beta3 or later.
If even upgrading ConstraintLayout doesn't help, try to add format attribute to your attr declaration in your attrs.xml file.
<resources>
<attr name="yourAttrName" format="string" />
</resources>
Choose proper format for your attribute.
upgrading to constraintlayout:2.0.0-beta4, worked for me ,
or later version. This happens after you upgrade android studio to 3.6
I upgraded gradle version to com.android.tools.build:gradle:3.6.0 then faced this issues, just downgrade gradle version to com.android.tools.build:gradle:3.5.3 and problem resolved
You would have to do two things:
Update your android studio.
add Latest dependency implementation
'androidx.constraintlayout:constraintlayout:2.0.0-rc1'

Getting resource issue duplication related issue?

The error message is the following: android 'attr/value' with config ''
Here is the version setup:
compileSdkVersion = 27
buildToolsVersion = "27.0.3"
minSdkVersion = 21
targetSdkVersion = 27`
The error message specifies the name of loading-dots library, which has really less resources which doesn't interfere with the other resources.
The question is now how to parse this error message properly to a normal human understandable language to be able to find where the issue comes from.
What does mean?
- "attr/value"
- "with config ''"
Here is the complete log message
:app:generateDebugResources
AGPBI: {"kind":"error","text":"error: duplicate value for resource \u0027attr/value\u0027 with config \u0027\u0027.","sources":[{"file":"/Users/karate/.gradle/caches/transforms-1/files-1.1/loading-dots-1.0.2.aar/53c3c73936c7c0b67d125304a8d501c0/res/values/values.xml","position":{"startLine":3,"startColumn":4,"startOffset":619,"endColumn":60,"endOffset":675}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource previously defined here.","sources":[{"file":"/Users/karate/.gradle/caches/transforms-1/files-1.1/loading-dots-1.0.2.aar/53c3c73936c7c0b67d125304a8d501c0/res/values/values.xml","position":{"startLine":3,"startColumn":4,"startOffset":619,"endColumn":60,"endOffset":675}}],"original":"","tool":"AAPT"}
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED
The library has an issue, it clashes with a system xml attribute. That's why you are getting the error. Moreover, the repo you've linked to is backwards as it doesn't have a values.xml try to change the compile version to a lower figure. Maybe
compile 'com.eyalbira.loadingdots:loading-dots:1.0.0'

Categories

Resources