What I am trying to do: I am trying to integrate this library
What I have done so far:
I added cradle dependency implementation
'com.github.devlight:infinitecycleviewpager:1.0.2'
I have cleaned , synched and built the project
I added the xml as below
<com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager
android:id="#+id/swipableViewId"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:icvp_interpolator="..."
app:icvp_center_page_scale_offset="30dp"
app:icvp_max_page_scale="0.8"
app:icvp_medium_scaled="true"
app:icvp_min_page_scale="0.5"
app:icvp_min_page_scale_offset="5dp"
app:icvp_scroll_duration="500"/>
On building the project I get error: AAPT: error: '...' is incompatible with attribute icvp_interpolator (attr) reference.
I checked if the reference of icvp_min_page_scale is created. Looks
like the reference is there
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr format="dimension" name="icvp_center_page_scale_offset"/>
<attr format="reference" name="icvp_interpolator"/>
<attr format="float" name="icvp_max_page_scale"/>
<attr format="boolean" name="icvp_medium_scaled"/>
<attr format="float" name="icvp_min_page_scale"/>
<attr format="dimension" name="icvp_min_page_scale_offset"/>
<attr format="integer" name="icvp_scroll_duration"/>
<declare-styleable name="HorizontalInfiniteCycleViewPager"><attr name="icvp_min_page_scale_offset"/><attr name="icvp_center_page_scale_offset"/><attr name="icvp_min_page_scale"/><attr name="icvp_max_page_scale"/><attr name="icvp_medium_scaled"/><attr name="icvp_scroll_duration"/><attr name="icvp_interpolator"/></declare-styleable>
<declare-styleable name="VerticalInfiniteCycleViewPager"><attr name="icvp_min_page_scale_offset"/><attr name="icvp_center_page_scale_offset"/><attr name="icvp_min_page_scale"/><attr name="icvp_max_page_scale"/><attr name="icvp_medium_scaled"/><attr name="icvp_scroll_duration"/><attr name="icvp_interpolator"/></declare-styleable>
<string name="app_name">InfinityCycleViewPager</string>
</resources>
Question: How to resolve this. Is there any setting in android studio we need to make or in project settings
Remove
app:icvp_interpolator="..."
<com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager
android:id="#+id/swipableViewId"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:icvp_center_page_scale_offset="30dp"
app:icvp_max_page_scale="0.8"
app:icvp_medium_scaled="true"
app:icvp_min_page_scale="0.5"
app:icvp_min_page_scale_offset="5dp"
app:icvp_scroll_duration="500"/>
or add default anim #android:anim/accelerate_decelerate_interpolator
<com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager
android:id="#+id/swipableViewId"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:icvp_center_page_scale_offset="30dp"
app:icvp_interpolator="#android:anim/accelerate_decelerate_interpolator"
app:icvp_max_page_scale="0.8"
app:icvp_medium_scaled="true"
app:icvp_min_page_scale="0.5"
app:icvp_min_page_scale_offset="5dp"
app:icvp_scroll_duration="500"/>
So I updated my Android Studio to v3.2. When I tried compiling the project, build fails.
Below is the error:
Android resource compilation failed
Output: C:\Users\Ashish\AndroidStudioProjects\StartUp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:900: error: <item> inner element must either be a resource reference or empty.
Command: C:\Users\Ashish\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\7f1fbe9171e916e5044000cd76b749c8\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\Ashish\AndroidStudioProjects\StartUp\app\build\intermediates\res\merged\debug \
C:\Users\Ashish\AndroidStudioProjects\StartUp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
Please do tell if there is any more information required. Any help will be appreciated.
I was facing this issue today after updating gradle from 3.1.4 to 3.2.0. I don't know why, but the build started to throw that exception. i deleted the build folder, and deleted the gradle caches folder but nothing worked, so i looked at the merged values.xml and turns out that my ids.xml was defining a wrong id that was being merged to the values.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="downloading_package" type="id">Baixando pacote de sincronizaĆ§Ć£o</item>
</resources>
And apparently this was working before the update... for my case i deleted the ids.xml file (it was useless in the project)
I wish i could know why before the update everything was working
the <item> in values.xml at line 900 ...might be of resource-type id.
the correct syntax would be (just as the error message tells):
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="id_name" />
</resources>
see the documentation.
For me I had the layout width and layout height in the layout view and the LinearLayout view for databinding. This threw a duplicate error.
I fixed this by removing the layout_width and layout_height attributes in <layout>.
I'm just finishing this issue a few minutes ago, try to modify or delete id.xml, if you think you don't have it, try to find in another module in your app. I change my value resource from <item name="header_view" type="id">header_view</item> to <item name="header_view" type="id"/> and it worked for me.
just change your attr name which is present in resource -> values -> attr
<attr name="fontFamilys">
<enum name="roboto" value="0" />
<enum name="roboto_condensed" value="1" />
<enum name="roboto_slab" value="2" />
</attr>
for example if you are getting error related to fontFamily just change the the name build the application error will not come
i also meet the problem,you just need to find where the values in,and update it from <item type="id" name="id_name" >id_name</item> to <item type="id" name="id_name" />,now it's ok.
I got that problem when I'd quotation within <string> tag
<string name="vj_dialogue">I'm waiting</string>
when I escaped it with backslash '' . The problem was gone
<string name="vj_dialogue">I\'m waiting</string>
This could also happen if you mistakenly happened to not escape some value (apostrophe with backslash or ampersand with & or something else I am not aware of) under res/values/strings.xml file
to bring it in context here is an example ->
incorrect :
<string name="update_now">Let's Update now</string>
correct :
<string name="update_now">Let\'s Update now</string>
in your build gradle(Project:name) do it like that
classpath 'com.android.tools.build:gradle:3.+'
then rebuild your project .. after that it will show message to update your gradle from 4.6 to 4.10
In my case
<?xml version="1.0" encoding="utf-8"?>
is repeated twice in the XML. Make sure it should be one per a file at the top of the XML.
This is what worked for me:
In my build.gradle file > dependencies, I was implementing a newer version of appcompat library
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:21.0.3'
implementation 'com.android.support:appcompat-v7:21.0.3'
implementation 'androidx.appcompat:appcompat:1.0.2'}
After commenting //implementation 'androidx.appcompat:appcompat:1.0.2' It worked fine. I would suggest, even if it's a different library, Please check the version you are using.
In your xml file, you may forget to add /> to brace your attribute.
I did a binding of libaums AAR in my Xamarin Android solution in Visual Studio.
I used libaums-0.5.0.aar from here.
At compile time I got 2 errors that I solved by adding those directives to my Metadata.xml file:
<attr path="/api/package[#name='com.github.mjdev.libaums.fs.fat32']/class[#name='FatDirectory']/method[#name='createDirectory']" name="managedReturn">IUsbFile</attr>
<attr path="/api/package[#name='com.github.mjdev.libaums.fs.fat32']/class[#name='FatDirectory']/method[#name='createFile']" name="managedReturn">IUsbFile</attr>
Then I tried to implement the example found on the libaums github to get the mass storage devices:
UsbMassStorageDevice[] devices = UsbMassStorageDevice.GetMassStorageDevices(Global.MyActivity.ApplicationContext);
foreach (UsbMassStorageDevice device in devices)
{
// before interacting with a device you need to call init()!
device.Init();
// Only uses the first partition on the device
IFileSystem currentFs = device.Partitions[0].FileSystem;
Console.WriteLine("Capacity: " + currentFs.Capacity);
Console.WriteLine("Occupied Space: " + currentFs.OccupiedSpace);
Console.WriteLine("Free Space: " + currentFs.FreeSpace);
Console.WriteLine("Chunk size: " + currentFs.ChunkSize);
}
But at run time I have an exception on currentFs.Capacity which says:
no non-static method "Lcom/github/mjdev/libaums/fs/fat32/Fat32FileSystem;getCapacity()J"
Any ideas?
How did you manage to get that aar compiled with your metadata set? I had to add the folowing to metadata.xml to get it compiled:
<metadata>
<attr path="/api/package[#name='com.github.mjdev.libaums.fs.fat32']/class[#name='FatDirectory']/method[#name='createDirectory' and count(parameter)=1 and parameter[1][#type='java.lang.String']]" name="visibility">public override</attr>
<attr path="/api/package[#name='com.github.mjdev.libaums.fs.fat32']/class[#name='FatDirectory']/method[#name='createDirectory' and count(parameter)=1 and parameter[1][#type='java.lang.String']]" name="final">true</attr>
<attr path="/api/package[#name='com.github.mjdev.libaums.fs.fat32']/class[#name='FatDirectory']/method[#name='createDirectory' and count(parameter)=1 and parameter[1][#type='java.lang.String']]" name="managedReturn">IUsbFile</attr>
<attr path="/api/package[#name='com.github.mjdev.libaums.fs.fat32']/class[#name='FatDirectory']/method[#name='createFile' and count(parameter)=1 and parameter[1][#type='java.lang.String']]" name="visibility">public override</attr>
<attr path="/api/package[#name='com.github.mjdev.libaums.fs.fat32']/class[#name='FatDirectory']/method[#name='createFile' and count(parameter)=1 and parameter[1][#type='java.lang.String']]" name="final">true</attr>
<attr path="/api/package[#name='com.github.mjdev.libaums.fs.fat32']/class[#name='FatDirectory']/method[#name='createFile' and count(parameter)=1 and parameter[1][#type='java.lang.String']]" name="managedReturn">IUsbFile</attr>
</metadata>
Why? For example, without this, after transpiling the method CreateDirectory(string) has the signature public virtual unsafe global::Com.Github.Mjdev.Libaums.FS.Fat32.FatFile CreateFile (string p0). But it has to be public override unsafe IUsbFile CreateFile (string p0). Changing final to true appears to remove the virtual modifyer (seems to be a bug?).
Concerning your exception, have you tried to use a newer library? Here you can download the 0.5.5 version.
I'm trying to figure out how to pass android:gravity via xml for a custom view.
The solution posted here (https://stackoverflow.com/a/3441986/413254) says to add the android:gravity attribute to the other attr's.
When I do this, I end up with a warning saying:
/Users/greg/dev/company/mobile/my_app/app/src/main/res/values/colors.xml
Error:Attribute "android:gravity" has already been defined
Error:Execution failed for task ':app:processStagingDebugResources'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/greg/dev/android-sdk/sdk/build-tools/21.0.2/aapt package -f --no-crunch -I /Users/greg/dev/android-sdk/sdk/platforms/android-21/android.jar -M
/Users/greg/dev/company/mobile/myapp/app/build/intermediates/manifests/full/staging/debug/AndroidManifest.xml
-S /Users/greg/dev/company/mobile/myapp/app/build/intermediates/res/staging/debug
-A /Users/greg/dev/company/mobile/myapp/app/build/intermediates/assets/staging/debug
-m -J /Users/greg/dev/company/mobile/myapp/app/build/generated/source/r/staging/debug
-F /Users/greg/dev/company/mobile/myapp/app/build/intermediates/res/resources-staging-debug.ap_
--debug-mode --custom-package com.company.vendorreviews -0 apk --output-text-symbols /Users/greg/dev/company/mobile/myapp/app/build/intermediates/symbols/staging/debug
Error Code:
1 Output:
/Users/greg/dev/company/mobile/myapp/app/build/intermediates/res/staging/debug/values/values.xml:165:
error: Attribute "android:gravity" has already been defined
My colors.xml file?
Line 165 of values.xml is
<declare-styleable name="StackedTextView">
<attr format="integer" name="android:gravity"/>
<attr format="string" name="line1"/>
<attr format="string" name="line2"/>
<attr format="dimension" name="line1_textSize"/>
<attr format="dimension" name="line2_textSize"/>
</declare-styleable>
There are multiple occurrences of android:gravity in multiple groups. Theme, FlowLayout (library I include), LinearLayoutCompat, etc.
Edit: Updated error message.
by writing:
<attr format="integer" name="android:gravity"/>
you are intruducing the new attribute android:gravity with integer format, of course android:gravity is already defined in the system, so you need to change it into:
<attr name="android:gravity"/>
The issue is:
I have a project A. It runs well.
Then I config A as a library project. And new a project B to use it.
Then the issue comes like followings:
\res\layout\taskslist.xml:18: error: No resource identifier found for attribute 'content' in package 'com.XXX'
The attribute named 'content' is defined in XML used by MultiDirectionSlidingDrawer in project A:
<resources>
<declare-styleable name="MultiDirectionSlidingDrawer">
<attr name="content" format="reference" />
</declare-styleable>
</resources>
And the taskslist.xml looks like:
<com.XXX.util.MultiDirectionSlidingDrawer
xmlns:my="http://schemas.android.com/apk/res/com.XXX"
...
my:content="#id/content">
<include
android:id="#+id/content"
layout="#layout/menuwithll" />
<ImageView
android:id="#+id/handle"
... />
</com.XXX.util.MultiDirectionSlidingDrawer>
Actually I look into R.java in project A. There is an attr named "content" likes:
public static final class attr {
public static int content=0x7f010002;
}
Anyone know this issue? Thanks in advance!!!
BTW. I have tried clean project. And config project B both in "Android" and "Java build path".
For later one's who also has this issue. It's really simple to resolve by add following code in you layout file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:my="http://schemas.android.com/apk/res-auto"