Android appcompat lib + design lib = build error - android

this is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "xxx"
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:cardview-v7:22.0.+'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:design:22.2.0'
}
After add this library
compile 'com.android.support:design:22.2.0'
I can't build the app because I have this error:
/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/res/values/values.xml
Error:(2) Attribute "rippleColor" has already been defined
Is possible to use togheter this libs?
Thanks!
Luis
p.s. I need (for now) the design lib for the FloatingActionButton (fab).

Looks like the attribute rippleColor is being used more than once (Dependencies and your own application).
Check your xmls for an attribute with the name "rippleColor" and see if it is being used multiple times. Rename it to something else if it is.
Remove this line if you have an attr file in the project:
<attr name="rippleColor" format="color" />

Related

Android RatingBar Style Small showing error in Android studio

I am using RatingBar in android and want to reduce the size of it , so I added
style="?android:attr/ratingBarStyleSmall"
as Ratting Bar Style attribute. It is working fine but it is showing error in code
below is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion " 22.0.1"
defaultConfig {
applicationId "com.app.xxxx"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(path: ':vitamio')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
}
Please help what I am doing wrong..
Thanks In Advance..
Use this instead style="?attr/ratingBarStyleSmall"

Logcat warning :Consider using Resources.getDrawable(int, Theme) or Context.getDrawable(int)

I found this error when i want to input data but i didn't use any drawables in my code. And I am just using a simple EditText to read the data. I have referred to many other solutions in this forum but it is not work for help.
Drawable android:drawable/text_cursor_material has unresolved theme attributes! Consider using Resources.getDrawable(int, Theme) or Context.getDrawable(int).
java.lang.RuntimeException
at android.content.res.Resources.getDrawable(Resources.java:740)
at android.support.v7.widget.TintResources.superGetDrawable(TintResources.java:48)
at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:374)
at android.support.v7.widget.TintResources.getDrawable(TintResources.java:44)
at android.widget.Editor$InsertionHandleView.getHotspotX(Editor.java:3772)
at android.widget.Editor$HandleView.updateDrawable(Editor.java:3399)
Edited (The build.gradle)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.user.myapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
// multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.2.0'
compile files('libs/org.apache.http.legacy.jar')
compile 'com.android.support:support-v4:23.2.0'
}
Summarizing this issue
Use ContextCompat.getDrawable(Context, int) instead of getResources().getDrawable(int) (which is deprecated).
Use 0.8.5.7 or higher if available but not 0.8.5.6 of material-dialogs.

Attribute "nameHere" has already been defined

this is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.androidbelieve.materialnavigationdrawer"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
jcenter()
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.0.+'
compile 'com.github.navasmdc:MaterialDesign:1.5#aar'
compile 'com.baoyz.swipemenulistview:library:1.1.0'
compile 'info.hoang8f:fbutton:1.0.5'
compile 'com.android.support:design:22.2.1'
}
But when I build the project I get the following error:
Attribute "rippleColor" has already been defined.
I tried to add/remove diferent libraries but no result.
Both the design support library (com.android.support:design:22.2.1) and the MaterialDesign library (com.github.navasmdc:MaterialDesign:1.5#aar) define a rippleColor attribute.
Given that appcompat and the design support library both provide nearly all Material design components, you probably don't need the third party library and can remove it to fix this error.

Can't compile because supposedly there are duplicate libraries in gradle

Here is my build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.chattr.chattr"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:+'
compile 'com.parse.bolts:bolts-android:1.+'
for some reason, I cannot compile my app for a release version, or any other version for that matter. In other posts, people say that I have a duplicate library being compiled but I cannot see the duplicate anywhere here. Any help would be appreciated
I am assuming you are using the Parse API.
You need to modify your dependencies in gradle file to make
sure that only Parse and sinch will be included .
dependencies {
compile fileTree(dir: 'libs', include: ['Parse-*.jar','sinch*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.parse.bolts:bolts-android:1.+'
}
If you have duplicate library being compiled,maybe it's because your dependent library has contained the jar which is 'com.android.support:appcompat-v7:+' or
'com.parse.bolts:bolts-android:1.+'.
you should check settings.grade,look at something like this "include ':library', ':samples'".check whether the library contains the jar.
hope it's useful to you

Android Studio support v4

I know this question was asked several times, but none of the answers helped me so far...
All I did was generating a preferences screen with Android Studio and now it tells me that NavUtils cannot be found. Even though my build.gradle looks right (I guess):
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.brobox.getyourshitdone"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'
compile 'com.android.support:support-v4:20.0.+'
compile files('libs/android-support-v4.jar')
}
I hope someone can help :/
Edit:
Just created a new project on my laptop and generated the SettingsActivity again. This is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.brobox.getyourshitdone"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v13:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
}
Still got the same error <.<
You have to remove this line implementation files('libs/android-support-v4.jar') and you have to remove this file.
The support library should only be added by gradle. And you have done that in this line implementation 'com.android.support:support-v4:20.0.+'.
YourtargetSdkVersion and your compileSdkVersion are also weird. Those values are not supported with the L developer preview.
compileSdkversionshould be 'android-L', targetSdkVersion should be 'L'.
Press this button, and clean rebuild project.
And add to dependencies :
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'
}
Well some time passed and now it works! I don't know what solved it exactly but I did the following:
I updated to Android Studio 0.8.12 manually, because that was the only way to update it
In a new project I tried to manually add a SettingsActivity and therefore added support-v4 to my repositories
Thanks for all your help on this silly question...

Categories

Resources