I have imported two libraries in my Android Studio project through gradle. One is support library v7 which is a necessary component to handle action bar in my app for different platforms. Another is the one I intent to use for UI components called MaterialDesign.
Problem is that both libraries have defined an attribute in their values.xml called rippleColor and gradle identifies the conflict.
How can I tell gradle to exclude one definition and accept the other?
Manifest Merging in android developers hub seem to do that over the entire xml file whereas my problem is only one specific attribute in that file.
Is there any way that I can get around this problem?
P.S. my gradle dependencies are as follows:
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'org.xwalk:xwalk_core_library:15.44.384.13'
compile 'com.github.navasmdc:MaterialDesign:1.5#aar'
Write below code in your grade file. It might help:
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.code.gson:gson:2.2.2'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile fileTree(dir: 'libs', include: '*.jar')
compile fileTree(include: ['*.jar'], dir: 'libs')
}
Related
When I add TabLayout inside my xml file it shows this error.
I also have these dependencies.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
}
See Code here
Add this dependency in gradle
compile 'com.android.support:design:23.1.0'
You can try to build it or change preview Android version in here Preview Android Version
I implemented an Android application using support.v7.app.AppcompatActivity. This application doesn't compile: when I hold my mouse cursor above the super key it shows the following error:
Cannot access android.support.v4.app.BaseFragmentActivityHoneycomb
I've a same problem.
And my resolution is:
Replace project dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
}
with
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-annotations:24.0.0'
}
It works for me,good luck.
It seems a compile issue. Try to check File -> project structure ->project -> set Gradle version and Android plugn version,then rebuild the project.
I found out the hidden issue by the operation.
I want to build my app while flashing custom ROM on the device. I'm trying to find proper way to include project dependencies in the Android.mk. My dependencies look like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.timehop.stickyheadersrecyclerview:library:0.4.2#aar'
How to put it into the makefile? As static libraries? Or maybe as extra packages? Waiting for your help!
I am new to Roboelectric testing.
I am trying to follow this post to test fragments. I am using following as dependency
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile "org.robolectric:robolectric:3.0"
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:support-v4:22.1.0'
compile 'com.google.android.gms:play-services:7.5.0'
}
But this import is giving me compilation issues, and I am not able to resolve the symbol SupportFragmentTestUtil to start with. Kindly guide me what I am missing??
org.robolectric.shadows.support.v4.SupportFragmentTestUtil
You need to add the dependency for v4 shadows support. Add this in your dependency file.
testCompile "org.robolectric:shadows-support-v4:3.0"
Earlier this week Android Studio started randomly deleting dependencies from my build.gradle file whenever I create a new file.
Is there a particular order that's expected?
My dependencies section looks like this:
dependencies {
compile project(':ParallaxScroll')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:4.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:support-v13:19.+'
compile 'com.android.support:appcompat-v7:19.+'
compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
compile group: 'com.squareup.retrofit', name: 'retrofit', version: '1.4.1'
compile 'com.github.gabrielemariotti.cards:library:1.5.0'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.crashlytics.android:crashlytics:1.+'
}
When I create a new activity in the project it ends up looking like this (this happens every time):
dependencies {
compile project(':ParallaxScroll')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
compile group: 'com.squareup.retrofit', name: 'retrofit', version: '1.4.1'
compile 'com.google.android.gms:play-services:4.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:support-v13:19.+'
compile 'com.android.support:appcompat-v7:19.+'
}
It took a little while to figure out what was happening.
Which of the two compile formats I'm using is correct? Is this potentially causing issues? It wasn't an issue until this week.
I can of course restore my dependencies but this doesn't explain why AS is deleting things all the time.
I'm also concerned about both support libraries being included. As far as I know I'm using only v4 stuff. Is using both bad practice?
This is a bug that will be fixed in 0.5.9. You can track it here:
https://code.google.com/p/android/issues/detail?id=60749
In the meantime, as a workaround, just create new activities by hand, or save off the contents of the build file before creating them through the wizard.