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!
Related
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')
}
I added Parse-1.9.1.jar to my libs folder and compiled it in my build.gradle file in my app folder. But when i try to initialise parseFacebookUtil, it is not recognised. I dont know why.Below is my build.gradlr. Please help me find out what am missing, thanks
dependencies {
compile fileTree(dir: 'libs', include: 'ParseCrashReporting-*.jar')
compile 'com.android.support:appcompat-v7:22.+'
compile fileTree('src/main/libs')
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/picasso-2.4.0.jar')
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
compile files('libs/Parse-1.9.1.jar')
compile files('libs/ParseFacebookUtilsV4-1.9.1.jar')
}
Where you have
compile files('libs/ParseFacebookUtilsV4-1.9.1.jar')
Try
compile fileTree(dir: 'libs', include: 'ParseFacebookUtilsV4-*.jar')
instead. Dunno why it would work, but I had the same problem and that solved it for me. If that doesn't help, does the gradle sync/build properly without the ParseFacebook.... line?
I have a project with two dependency projects in the libraries folder. Both are libraries which i wrote.
Error:Execution failed for task ':app:proguardgmobileRelease'.
java.io.IOException: The same input jar [/Users/Jon/android-app-manager/app/libs/**] is specified twice.
The main project dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.google.code.gson:gson:2.3'
compile 'commons-io:commons-io:2.0.1'
compile 'org.roboguice:roboguice:3.0.1'
provided 'org.roboguice:roboblender:3.0.1'
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile project(':android-commons')
compile project(':ormlitewrapper')
compile('com.crashlytics.sdk.android:crashlytics:2.2.2#aar') {
transitive = true;
}
}
The android-commons project dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.google.code.gson:gson:2.3'
compile 'commons-io:commons-io:2.0.1'
compile 'com.google.android.gms:play-services-base:6.5.87'
}
The OrmLiteWrapper project dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile project(':android-commons')
}
The main project compiles the 2 sub project and ormLiteWrapper compiles the android-commons as well. I was unable to remove the dependency and don't know where I can find the solution for the cyclic dependency. Should it be defined in one place and referenced in the other?
The issue only creates a conflict when generating a release APK.
Don't use -libraryjars or -injar or -oujar in your proguard file
I'm trying to add Gson library into my gradle, but it isn't finding the library. I've tried almost all the versions and nothing works.
My dependencies is following:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
// Volley
compile 'com.mcxiaoke.volley:library:1.0.6#aar'
// Gson
compile 'com.google.code.gson:gson:2.3'
}
Any solution, please?
Try this and sync the project and be sure internet is connected.
compile 'com.google.code.gson:gson:2.3.1'
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.