After adding new library (.aar) file to android I am getting an error:
Attribute provider#androidx.core.content.FileProvider#authorities value=(gov.pulsocare.mobile.test.provider) from [aiocare_sdk_2.aar] AndroidManifest.xml:48:13-60
is also present at [higosdk-0.0.11.aar] AndroidManifest.xml:30:13-64 value=(gov.pulsocare.mobile.test.fileprovider).
Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:46:9-54:20 to override.
And second error:
Attribute meta-data#android.support.FILE_PROVIDER_PATHS#resource value=(#xml/provider_paths) from [aiocare_sdk_2.aar] AndroidManifest.xml:53:17-55
is also present at [higosdk-0.0.11.aar] AndroidManifest.xml:35:17-50 value=(#xml/filepaths).
Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.
I tried adding tools:replace="android:resource" as described but im not really android dev and I dont really know what to do ( adding this tag dosen't help and I'm not really sure where to add it since I dont have any meta-data tag)
Any comments describing what to try/do will be appreciated
Related
In the Android documentation for BottomSheetBehavior, it says I can use the following attribute in XML:
BottomSheetBehavior_Layout_behavior_hideable
I tried this:
android:BottomSheetBehavior_Layout_behavior_hideable="true"
But that gave me the following error:
Unknown attribute android:BottomSheetBehavior_Layout_behavior_hideable
That error is discussed at Unknown attribute android:layout_width, layout_height, id, gravity, layout_gravity, padding but none of those solutions worked for me because they were about syncing project files. Mine are synced. Nobody questioned the validity of the attribute name, which is what I think is my problem here.
Then I tried this:
app:BottomSheetBehavior_Layout_behavior_hideable="true"
But that gave me the following error:
Unexpected namespace prefix "app" found for tag
That error is discussed at Unexpected namespace prefix "app" found for tag RelativeLayout - Android? but none of those solutions worked for me, and--more central to my question--there the attribute seems to be written like this:
app:behavior_hideable="true"
Is app:behavior_hideable the correct way to write BottomSheetBehavior_Layout_behavior_hideable? What is the name of the mechanism that performs this translation? Where is its documentation?
There are a couple of components to the answer.
In the constructor for a BottomSheetBehavior, xml attributes are read out as follows Source:
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomSheetBehavior_Layout);
setHideable(a.getBoolean(R.styleable.BottomSheetBehavior_Layout_behavior_hideable, false));
These attributes are typically defined in an attrs.xml file. Here's the attrs.xml for the BottomSheetBehavior.
So what's happening here is a LayoutInflater is calling the constructor, and xml attributes are accessed via R.styleable.[name_of_style]_[name_of_attribute]. When you want to apply the style in xml, you simply use the name of the attribute. In the case, the name of the style is "BottomSheetBehavior_Layout", and the name of the attribute is "behavior_hideable". Similarly, you could also use "behavior_skipCollapsed" and "behavior_fitToContents".
For more information on styling, the official docs are here: https://developer.android.com/training/custom-views/create-view#customattr
I cannot fix this error even after trying the mentioned techniques in other posts. I don't have crashlytics in my application. It's rather simple.
The issue persists even after cleaning the build and invalidating caches.
The following code is present in the values.xml file with a curly red line under the resources keyword.
<resources
xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2"
xmlns:ns2="http://schemas.android.com/tools"
xmlns:ns3="http://www.w3.org/2000/xmlns/">
...
I know this question was asked a few times but I'm not able to fix the error in my application.
The declaration of ns3 is invalid because the namespace URI http://www.w3.org/2000/xmlns/ is reserved.
See section 3 of the XML Namespaces 1.1 specification at http://www.w3.org/TR/xml-names11/
The prefix xmlns is used only to declare namespace bindings and is by
definition bound to the namespace name http://www.w3.org/2000/xmlns/.
It must not be declared or undeclared. Other prefixes must not be
bound to this namespace name, and it must not be declared as the
default namespace. Element names must not have the prefix xmlns.
Since I switched to SDK v4 I notice this in LogCat :
W/GAV3﹕ Thread[main,5,main]: int configuration name not recognized: ga_dispatchPeriod
W/GAV3﹕ Thread[main,5,main]: string configuration name not recognized: ga_appVersion
All the other parameters are good but those really seem to be ignored. Any ideas ?
Thanks.
Apologies for confusing setup. Are you specifying the ga_dispatchPeriod and ga_appVersion values in the global configuration? If not, can you move them to the global configuration? This link specifies how to setup global configuration.
Note that global configuration is different from tracker configuration which is documented here.
If this does not fix your issue, can you paste the complete xml file? and how you are setting it up?
Thanks!
WoW Why is this so over engineered? I use a single xml file for both app tracking specific configs AND global configs and I just add that meta tag in the manifest to point to that single xml file like so
<meta-data android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="#xml/app_global_tracker"/>
And in my code i just do Tracker t = analytics.newTracker(R.xml.app_tracker);
and thats all
In the old versions of admob SDK, you had to manually add a attrs.xml file where the admob attributes where defined (adUnitId,adSize etc..) But it is not necessary anymore in the current version of the SDK. The only thing you need to do in your XML layout file is to declare the admob namespace with xmlns.
So my question is: how did they manage to do that? I'm just curious about how they declared or defined these attributes; and I could actually use this "trick" to use with my customs views that have their own attributes in the future.
Thanks :)
At a high level, AdMob is calling AttributeSet.getAttributeValue(String namespace, String name) and similar methods. It passes in the namespace ("http://schemas.android.com/apk/lib/com.google.ads") that it expects. This doesn't need to be a valid url - it should just be a unique one that doesn't conflict with other namespaces.
I am using a Java class to import data to my app from a .csv file. I found some examples online, and this is what they seem to do. However, it's showing the error: Error parsing XML: unbound prefix. The research I've done on this indicates that it is usually a spelling error. If it is, I can't find it. Here is the section where I am having the problem.
<provider android:name="com.ATS_Boxes.ContentProvider.class"
android:authorities="ContentProvider"></provider>
You appear to be trying to declare a provider in an Android resource file - that isn't possible. You can only declare providers in your project's manifest file (AndroidManifest.xml, in the root directory of your project).
Also, although I'm not sure if it makes any difference, the first line in the xml code you provided as comment reads:
<!--?xml version="1.0" encoding="utf-8"?-->
That looks like it's commented out. Normally it should look like:
<?xml version="1.0" encoding="utf-8"?>
post the entire XML file.
My guess is that you do not have the 'android' namespace declared so its puking when it's parsing the attributes android:name and android:authorities