I have created a library that uses Android CardView.
The library is available as aar file.
When I add the aar file to the project, it gives the following error, on syncing. I still have not used it in the project
attribute for 'cardElevation' not found in com.sampleapp
How do I resolve this namespace issue? So anyone using the library does not have to add cardview to their gradle.
library xml file using cardview
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/networkCard"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardUseCompatPadding="true"
app:cardCornerRadius="@dimen/cardCornerRadius"
app:cardElevation="6dp"
app:cardPreventCornerOverlap="true"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/card_background"
android:clipToPadding="false">
<ImageView
android:id="@+id/source_type_icon"
style="@style/ServiceConnectUIComponentsTheme"
android:layout_alignParentTop="true"
android:src="@drawable/ic_linkedin3x"
android:tint="@android:color/white"
/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/connect_to_source_rational"
style="@style/ServiceConnectUIComponentsTheme"
android:layout_centerInParent="true"
android:text="Your LinkedIn account allows us to check your professional info, employment & education history"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="@dimen/connect_buttons_extra_margin"
android:layout_marginStart="@dimen/connect_buttons_extra_margin"
android:layout_marginEnd="@dimen/connect_buttons_extra_margin"
android:layout_marginRight="@dimen/connect_buttons_extra_margin"
android:layout_marginTop="@dimen/connect_button_margin"
android:layout_marginBottom="@dimen/circle_indicator_connect_button_margin"
>
<Button
android:id="@+id/access_source"
android:text="Connect LinkedIn"
style="@style/Widget.AppCompat.Button.Colored"
android:background="@drawable/connect_data_button_drawable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="10dp"
android:textAllCaps="false"
/>
<com.UIUtils.HorizontalDottedProgress
android:id="@+id/connectDataProgress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
></com.UIUtils.HorizontalDottedProgress>
</FrameLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
The sampleapp/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.sampleapp"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta1'
testCompile 'junit:junit:4.12'
compile project(':UI-release')
}
Thanks
sorry, this answer is late am just putting it others might find it useful in their project. Any library you used building your library or aar you have to add that library in any project you use the library you build. let me put it like this.
for instance, I compiled a library that uses card view, I have to add the card view library to any project I want to use my library.