AAPT: error in android on integrating third party library - android

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"/>

Related

Duplicate value for resource 'attr/animationMode' with config 'DEFAULT' problem

when i added kotlin sdk in my java project i faced this problem:
Execution failed for task ':app:mergeDebugResources'
C:\Users\esmae\.gradle\caches\transforms-3\968226e282565914e6944dd746d7f052\transformed\material-1.6.1\res\values\values.xml:7098:4: Duplicate value for resource 'attr/animationMode' with config 'DEFAULT' and product ''. Resource was previously defined here: C:\Users\esmae\.gradle\caches\transforms-3\968226e282565914e6944dd746d7f052\transformed\material-1.6.1\res\values\values.xml:6408:4: .
value.xml
<declare-styleable name="SnackbarLayout">
<attr name="android:maxWidth"/>
<attr name="elevation"/>
<attr format="dimension" name="maxActionInlineWidth"/>
<!-- Sets the enter and exit animations for a Snackbar. -->
<attr format="enum" name="animationMode">
<!-- Mode that corresponds to the slide in and out animations. -->
<enum name="slide" value="0"/>
<!-- Mode that corresponds to the fade in and out animations. -->
<enum name="fade" value="1"/>
</attr>
</declare-styleable>
app built when i renamed or removed animationMode attribute but i have error when making snackbar. any idea whats the problem?
i tried with different gradle version
delete cashes an restart
clean project
but nothing happen

Binding libaums AAR in a Xamarin Android project

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.

Android v7 gridlayout library, impossible to build the project

I have a big project with few dependencies and I want to add the v7 gridlayout support library too, but after that, i cant build my project anymore.
Adding the library in build.gradle like this (I use Android Studio 1.5.1) :
compile 'com.android.support:gridlayout-v7:21.0.0'
Sync project working, but after that i cant find android.support.v7.widget.GridLayout and when i try to build my project I have the following error :
C:\Users\jgully\AndroidStudioProjects\swingmobile\SwingMobileEngine\res\values\colors.xml
> Error:(2) Attribute "orientation" has already been defined
Error:Execution failed for task ':SwingMobileEngine:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\jgull\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1
So I suspect a attribute declared twice in two different dependecies but i dont know how i can fix that.
I have find a similiar problem here with viewpagerindicator: Error:Attribute "android:orientation" has already been defined
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="blue_light">#2D9DC8</color>
<color name="blue_dark">#314d61</color>
<color name="white">#FFFFFF</color>
<color name="green_light">#308A24</color>
<color name="black">#000000</color>
<color name="black_light">#333</color>
<color name="grey_light">#A1A1A1</color>
<color name="red">#C20031</color>
<color name="green_dark">#496948</color>
<color name="grey">#363636</color>
<color name="grey_dark">#424242</color>
<color name="grey_dark_alpha_50">#88424242</color>
<color name="vpi__background_holo_dark">#ff000000</color>
<color name="vpi__background_holo_light">#fff3f3f3</color>
<color name="vpi__bright_foreground_holo_dark">#color/vpi__background_holo_light</color>
<color name="vpi__bright_foreground_holo_light">#color/vpi__background_holo_dark</color>
<color name="vpi__bright_foreground_disabled_holo_dark">#ff4c4c4c</color>
<color name="vpi__bright_foreground_disabled_holo_light">#ffb2b2b2</color>
<color name="vpi__bright_foreground_inverse_holo_dark">
#color/vpi__bright_foreground_holo_light
</color>
<color name="vpi__bright_foreground_inverse_holo_light">
#color/vpi__bright_foreground_holo_dark
</color>
<!-- To override values in legacy projects (if needed) -->
<color name="dialog_default_text_color">#ffffff</color>
<color name="dialog_default_background_color">#000000</color>
<!-- end of to override values in legacy projects (if needed) -->
<!-- Listview gray divider -->
<drawable name="listview_graydivider">#CCCCCC</drawable>
<!-- Gradient values (Default is SWB) -->
<color name="default_dialog_gradient_firstcolor">#868686</color>
<!-- FFA938 -->
<color name="default_dialog_gradient_secondcolor">#a5a5a5</color>
<!-- FFAF47 -->
<color name="default_dialog_gradient_thirdcolor">#5b5b5b</color>
<!-- D4831A -->
<color name="default_dialog_gradient_fourthcolor">#727272</color>
<!-- F29729 -->
<color name="default_dialog_gradient_dark_firstcolor">#222222</color>
<!-- A97025 -->
<color name="default_dialog_gradient_dark_secondcolor">#2b2b2b</color>
<!-- A9732E -->
<color name="default_dialog_gradient_dark_thirdcolor">#181818</color>
<!-- B55711 -->
<color name="default_dialog_gradient_dark_fourthcolor">#1e1e1e</color>
<!-- 9F6314 -->
All dependecies of the project
Zxing
pdfview
com.android.support:support-v4:21.0.0
itextpdf-5.3.2
com.android.support:appcompat-v7:21.0.3
com.google.android.gms:play-services:6.5.87
com.android.support:multidex:1.0.1
com.crashlytics.sdk.android:crashlytics:2.5.2
note : im not the author of the begin of this project and i dont know where some lib is used

How do you pass the gravity attribute via xml for a custom view?

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"/>

Issues when referencing android library project with user defined attributes

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"

Categories

Resources