GridLayout compatibility - android

I am working on an application for which I need to make GridLayout compatible. So I am following the steps given in this link. I have downloaded zip folder and also have made it library. Everything is working fine till implementation. When I am trying to change main.xml as described as in the given link , I am getting . The error code is as follow.
<com.gridlayout.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gridlayout="http://schemas.android.com/apk/res/com.CompatGrid.MakeCompatible"
android:layout_width="match_parent"
android:layout_height="match_parent"
gridlayout:alignmentMode="alignBounds"
gridlayout:columnCount="4"
gridlayout:columnOrderPreserved="false"
gridlayout:useDefaultMargins="true" >
My package name is "com.CompatGrid" and my Activity is "MakeCompatible". Error is in 3rd , 4th, 5th and 6th line.
Errors are something like that.
error:No resource identifier found for attribute 'alignmentMode' in package 'MakeCompatible'.
error:No resource identifier found for attribute 'columnCount' in package 'MakeCompatible'.
error:No resource identifier found for attribute 'columnOrderPreserved' in package 'MakeCompatible'.
error:No resource identifier found for attribute 'useDefaultMargins' in package 'MakeCompatible'.
I have done as the instructions are given.

After reading again and again I found out my error. It was in 2nd line.
xmlns:gridlayout="http://schemas.android.com/apk/res/com.CompatGrid.MakeCompatible"
I edit it to
xmlns:gridlayout="http://schemas.android.com/apk/res/com.CompatGrid"
My mistake was I had to use the package name , not the main Activity Class name in the main.xml.

Related

How to fix "No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')"

I am getting the following error when I build my Android App project in Visual studio 2015.
No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')
These lines are located under:
obj\Debug\android\manifest\AndroidManifest.xml
There is 3 entires of it inside the AndroidManifest file.
I have downloaded the google play service from the SDK Manager.
Should I reference anything to my solution?
I already has Xamarin.GooglePlayServices.Base, Xamarin.GooglePlayServices.Basement, Xamarin.GooglePlayServices.Maps Referenced.
Thanks.
you have create integer.xml file inside value folder and define your Integer to that place it will solve your problem.
Try doing and a clean all and check that ALL the content under the obj has been deleted and then perform a build all.
If that does not work:
I would try removing the ~GooglePlayServices~ nugets/references and re-add just the Xamarin.GooglePlayServices.Mapsnuget which will bring in the ~Basement and ~Base libraries.
You should end up with a generated manifest that only has one reference to google_play_services_version and that resource should be picked up from Debug/android/XXX/YYYYYY/ZZZZZ/R.java:
i.e.
public static final int google_play_services_version=0x7f070000;
I added several new packages. One of the package is the reason of the error. I have to check one by one and caught the one causing error. Removing that package is all I need to do to resolve the error.

Faced with Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'

I am stuck with a problem, I have created a basic hello world app following official website! now when I try running the app I see error as
error:
Error retrieving parent for item: No resource found that matches the given name '
Theme.AppCompat.Light.DarkActionBar'.
Resourse: styles.xml
path: /Test_1/res/values-v14
Location : line 8
Type: Android AAPT Problem
I tried adding v7 library by [Project ->Properties->Android] and click on "Add" but I do not see any thing in the resulted project Selection pop up. I see error in (appcompat-v7 ->res->values-large-v14->themes_base.xml
code:
<style name="Theme.Base.AppCompat.DialogWhenLarge"
parent="Theme.Base.AppCompat.DialogWhenLarge.Base" />
<style name="Theme.Base.AppCompat.Light.DialogWhenLarge"
parent="Theme.Base.AppCompat.Light.DialogWhenLarge.Base" />
My target sdk is API 19 and min sdk version is 7, I am not sure how to deal with this. could you please help.
It looks like all Theme.Base.xxxx was renamed to Base.Theme.xxxx
Try to use Base.Theme.AppCompat.DialogWhenLarge

Custom XML error with Android Build Tools (0.4.2) -- No resource identifier found for attribute 'gapWidth' in package 'xxx.xxxx.'

Updated to the latest Android Build tools (0.4.2) and ran into the following when attempting to assemble:
/AndroidApp/App/build/res/all/flavor/debug/layout/fragment.xml:84:
error: No resource identifier found for attribute 'gapWidth' in package 'com.viewpagerindicator'
RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/build/res/com.viewpagerindicator"
android:layout_width="match_parent"
android:layout_height="match_parent" >
Since flavors may use a different packagename, instead of specifying the package name in the custom namespace, use: 'http://schemas.android.com/apk/res-auto'.
Update your custom XML link paths to use build instead of apk.
Was, in the fragment.xml file
xmlns:app="http://schemas.android.com/apk/res/com.viewpagerindicator"
Now, to this:
xmlns:app="http://schemas.android.com/build/res/com.viewpagerindicator"

Android R14 SDK - Error: No resource found that matches the given name (at 'background' with value...)

I searched a lot of time for a fix, but don't find an answer.
Since I've updated the Android SDK to R14 (Android 4.0), I get the Error "Error: No resource found that matches the given name (at 'background with value '#layout/card_top').
The Part in my xml-file is this:
<LinearLayout
android:id="#+id/card_top_bkg"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="#layout/card_top"
android:layout_weight="2">
The "card_top.xml" file is in an separate library-folder and not in the same filder as the base project. If i put the card_top.xml file directly under layout/card_top.xml in the base project folder, it works.
Knows anyone how to get it working with leaving the xml-file in the library-folder?
Maybe the problem is solved in r15, it's just a bug fix release:
http://developer.android.com/sdk/tools-notes.html#
http://developer.android.com/sdk/eclipse-adt.html#

A xmlns:android, how does that actually work?

Consider the following perfectly well formed layout file on android:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, PurpleActivity"/>
</LinearLayout>
I looked at this and got curious about that ULR: http://schemas.android.com/apk/res/android. So, I tried to enter it into my web browser's address bar and also tried to fetch it via CURL, but both methods showed that it doesn't actually exist. I looked for something akin to an apk/res/android directory in the android-sdk folder on my local machine, but that searched turned up nothing as well. So, I figured since this resource didn't actually exist, maybe that I could change the xmlns:android line to whatever I wanted. I went ahead and changed it to
http://schemas.android.com/apk/res/androidASDFASDFASDFASDFLKJSDFLEIE
and then tried to recompile my project. I got this result:
-resource-src:
[echo] Generating R.java / Manifest.java from the resources...
[aapt] (skipping hidden file '/Users/rutski/Desktop/purple/res/layout/.#main.xml')
[aapt] /Users/rutski/Desktop/purple/res/layout/main.xml:2: error: No resource identifier found for attribute 'orientation' in package 'androidASDFASDFASDFASDFLKJSDFLEIE'
[aapt] /Users/rutski/Desktop/purple/res/layout/main.xml:2: error: No resource identifier found for attribute 'layout_width' in package 'androidASDFASDFASDFASDFLKJSDFLEIE'
[aapt] /Users/rutski/Desktop/purple/res/layout/main.xml:2: error: No resource identifier found for attribute 'layout_height' in package 'androidASDFASDFASDFASDFLKJSDFLEIE'
[aapt] /Users/rutski/Desktop/purple/res/layout/main.xml:7: error: No resource identifier found for attribute 'layout_width' in package 'androidASDFASDFASDFASDFLKJSDFLEIE'
[aapt] /Users/rutski/Desktop/purple/res/layout/main.xml:7: error: No resource identifier found for attribute 'layout_height' in package 'androidASDFASDFASDFASDFLKJSDFLEIE'
[aapt] /Users/rutski/Desktop/purple/res/layout/main.xml:7: error: No resource identifier found for attribute 'text' in package 'androidASDFASDFASDFASDFLKJSDFLEIE'
This leaves me confused. If the resource doesn't exist anyway, then what does it matter if I change the xmlns:android value to some other nonexistent resource? And if it does exist, then where is it?
xmlns:android="http://schemas.android.com/apk/res/android" declares an XML namespace prefix. xmlns indicates it's about a namespace declaration. android is the prefix. http://schemas.android.com/apk/res/android is a URI - a string that uniquely identifies which namespace is referred to. The URI can be something abstract (as in this case); it is not necessarily a URL that physically locates something.
In general, you are free to choose the actual prefix. You can most likely replace android with something else and it will still work.
So what that attribute actually means is "We need to work with nodes from the namespace http://schemas.android.com/apk/res/android here, and in this file, we're going to refer to that namespace as android.
If, in several files, you define different namespace prefixes using the same URI, all those files will be referring to the same namespace - because the URI is the same. The prefix can be seen a a shorthand notation for referring to the actual namespace. The prefix can only be used inside the file that defines it.
It's not a resource, it's just a URI. Usually, processes that work with XML files expect a specific XML namespace. When you use your namespace, it's as if you renamed the attributes to something else. And so the tools that work with them don't recognize them anymore.

Categories

Resources