Error:Failed to find: com.google.code.gson:gson:2.3 - android

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'

Related

Project dependencies in Android.mk

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!

How can I use appcompat-v7:19.1 in Android Studio

Android Studio 1.3 generate a build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
but I want use com.android.support:appcompat-v7:19.1, when I type this, it tips Failed to resolve: com.android.support:appcompat-v7:19.1
How can I use appcompat-v7 with lower version ?
Add the dependency to {project}/build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.+'
}
Click the Sync Project with Gradle Files button.
I hope it helps you.
For more info please visit:
https://developer.android.com/tools/support-library/features.html
Try using:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.+'
}
Also ensure that you have those libraries installed.

ParseFacebookUtils not recognised on android studio

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?

Facebook SDK v4.0.1 Failing to compile with gradle

I am having trouble using Gradle to build Facebook SDK 4.0.1 in Android Studio 1.2 beta. There is no compile error, but the compiled library is not in my External Libraries. Previously, I successfully had:
compile 'com.facebook.android:facebook-android-sdk:3.22.0'
However,
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
doesn't appear to do anything. From searching, it looks like this version is available on maven. Here is my complete dependency list:
dependencies {
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.parse.bolts:bolts-android:1.2.0'
compile 'com.mixpanel.android:mixpanel-android:4.5.3#aar'
compile 'net.hockeyapp.android:HockeySDK:3.5.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.5.87'
//compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile project(':libraries:downloader_library')
compile project(':libraries:zip_file')
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
testCompile 'junit:junit:4.12'
}
I also have had some difficulties with Google Play Services 7.0.0, hence the comment.
Is there something I am doing wrong, such as a missing dependency or an incorrect assumption?
Solved
It turns out you can't have comments in your dependencies, so removing
//compile 'com.google.android.gms:play-services:7.0.0'
Fixed the issue.

Android proguard same jar specified twice

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

Categories

Resources