Android studio - Failed to resolve (gradle) Uber library - android

In my Android application, I want to add Uber facility to users so that I looked the following library. So that I added the compile 'com.uber.sdk:rides-android:0.1.0' in my main module's (Main application) build.gradle file. It gives me following error when sync the gradele
Failed to resolve: com.uber.sdk:rides-android:0.1.0
I have some other libraries referenced to the application.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.qapp"
minSdkVersion 14
targetSdkVersion 21
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile project(':payPalDemo1')
compile project(':uberLibrary')
compile project(':bSLibrary')
compile project(':pullToRefresh')
compile project(':androidmapsutils')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/cardio.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/UserFormValidation.jar')
}
Please help me to resolve this exception.

Try to add this in your gradle file
repositories{
maven { url "https://jitpack.io" }
}

In the portion of your build.gradle file that you have included you only have the mavenCentral() repository specified within the buildScript block. In order to make that repository accessible outside of that context you should include a block such as the following to the root level of your build.gradle:
repositories {
mavenCentral()
}
In addition, you have not actually included the line compile 'com.uber.sdk:rides-android:0.1.0' in the file copied in your question.
Ultimately, your build.gradle should include the following:
repositories {
mavenCentral()
}
dependencies {
compile 'com.uber.sdk:rides-android:0.1.0'
}

this SDK is designed to work with Android SDK 16. so minSdkVersion should be 16 or greater

Related

Gradle Fails to resolve material-dialogs dependency in Android Studio

I am trying to build my Android App I imported from a Git repository. This same app builds correctly in another environment, but in my environment I get the following error:
Error:(41, 13) Failed to resolve: com.afollestad:material-dialogs:0.7.7.0
My build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 22
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "my.app.id"
minSdkVersion 16
targetSdkVersion 22
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.afollestad:material-dialogs:0.7.7.0'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'com.github.navasmdc:MaterialDesign:1.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.1.0'
compile 'com.squareup.okhttp:okhttp:2.1.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'joda-time:joda-time:2.3'
compile 'com.joanzapata.pdfview:android-pdfview:1.0.4#aar'
compile 'com.andreabaccega:android-form-edittext:1.2.1#aar'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
}
I also tried different versions (0.7.7.0, 0.7.6.0, 0.7.5.5), but nothing changes. How can I address my issue?
On jCenter there are only two version available 0.7.9.0 and 0.7.9.1. These versions are not available in Maven Central, so check in your project build.gradle that you are using jcenter().
BTW these versions are not updated, the last version released in GitHub is 0.8.5.1.
To use the last version in your project use the following instructions:
Repository
First, add the following to your app's build.gradle file:
repositories {
maven { url "https://jitpack.io" }
}
Core
The core module contains all the major classes of this library,
including MaterialDialog and AlertDialogWrapper. You can create basic,
list, single/multi choice, progress, input, etc. dialogs with core.
dependencies {
// ... other dependencies here
compile('com.github.afollestad.material-dialogs:core:0.8.5.1#aar') {
transitive = true
}
}
The problem is that you use targetSdkVersion 22. If you update targetSdkVersion to 23 and use this latest library version in denendency the problem'll go away:
repositories {
jcenter()
}
dependencies {
compile('com.github.afollestad.material-dialogs:core:0.8.5.1#aar') {
transitive = true
}
}
But if you want to use 22 SDK you should use such dependencies:
repositories {
maven { url "https://jitpack.io" }
}
compile ('com.github.afollestad:material-dialogs:53103863a6') {
transitive = true
}
This is the last version which supports 22 SDK - v. 0.6.4.4. But there is some problem with using old version number in dependency name (maybe because library author migrated to jCenter) and you can use first 10 digits of commit's hash related to this version instead.
or you can use this:
compile 'com.afollestad.material-dialogs:core:0.9.1.0'
instead of
compile 'com.afollestad:material-dialogs:0.7.7.0'

Adding Simperium Module to Project gives Gradle DSL method not found: 'gitVersion()' error

I get an error after adding a Simperium Module Application code to my application. It gives me Gradle sync failed: Gradle DSL method not found: 'gitVersion()' error. How can I fix it?
build.gradle code here:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "sdn.com.sd"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-annotations:23.0.1'
compile 'com.android.support:support-v13:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile project(':SDUtils')
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.1.0'
compile project(':SDAnalytics')
compile project(':SDEditor')
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
compile files('libs/gcm.jar')
compile project(':SDNetworking')
compile project(':PassCode')
compile files('libs/eventbus-3.0.0-beta1.jar')
compile project(':Simperium')
}
Gradle Sync message output:
Error:(13, 0) Gradle DSL method not found: 'gitVersion()'
Possible causes:<ul><li>The project 'SD' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>
Thanks in advance for your helps.
You are adding a module in your project (as you've explained in your comment)
you can have the look of the Simperium module project at this link. github.com/Simperium/simperium-android I had simply added this project as a module in my application
Gradle is trying to process the build.gradle inside the Simperium module.
https://github.com/Simperium/simperium-android/blob/develop/build.gradle
Inside this file there are some functions defined in the root/build.gradle of the Simperium-project.
def gitHash() {..}
def gitDescribe() {..}
def gitVersion(){..}
You have to copy these functions inside your top-level build.gradle file.
root
|--app
|----build.gradle
|--build.gradle <- here
|--settings.gradle

How to fix this gradle app:dexDebug error while importing twitter SDK?

Referring question here.
Problem is that i am including something which is repeated.
Can somebody help me figure which one is causing problem?
And this error started arising when i added twitter sdk.
build.gradle
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.sony.login_signup"
minSdkVersion 15
targetSdkVersion 23
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:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.shamanland:facebook-like-button:0.1.8'
compile 'com.google.android.gms:play-services:+'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.github.curioustechizen.android-ago:library:1.3.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile('com.twitter.sdk.android:twitter:1.9.0#aar') {
transitive = true;
}
}
If you do:
gradle -q dependencies
It should output a tree of all gradle dependencies and their dependencies. If you trace the dependency tree you will find which ones are using support-v4 and their versions, to tell you where the problem is.
EDIT:
This should be run on a command line / terminal. Gradle is just another program...
https://docs.gradle.org/current/userguide/tutorial_gradle_command_line.html
To do this, make sure that "gradle" is in your environment PATH (this is different depending on if you're Windows or Mac, but if you search you will find it).
Then run the command from the folder where your "build.gradle" and "settings.gradle" files are located (your project "root" folder typically).

Failed to resolve: com.google.code.gson:gson.2.2.2

I import project from eclipse to android studio, and got above message after Sync project with gradle files. I am new with android studio, don't know how to solve this error.
Following is the Gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.s5.selfiemonkey1"
minSdkVersion 14
targetSdkVersion 14
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.code.gson:gson:2.2.2'
compile files('libs/AF-Android-SDK.jar')
compile files('libs/AndroidSwipeLayout-v1.1.8.jar')
compile files('libs/FlurryAnalytics-5.3.0.jar')
compile files('libs/android-viewbadger.jar')
compile files('libs/commons-codec-1.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/okhttp-2.5.0.jar')
compile files('libs/okio-1.6.0.jar')
compile files('libs/parcelgen.jar')
compile files('libs/scribe-1.1.2.jar')
}
Build Gradle from Project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
Please advice. Thanks in advance.
Since GSon is in mavenCentral , you have to add mavenCentral() in buidscripts phase.
Gson's latest version is currently 2.3.1 https://github.com/google/gson/releases
Try with compile 'com.google.code.gson:gson:2.3.1'
you have to add the Gson library in the dependency using project structure, now to update the gradle, for the add the .jar file to your build.gradle file like
dependencies {
compile files('libs/gson-2.2.4.jar')
}
if it dosent works try changing it to
dependencies{
compile 'com.google.code.gson:gson:2.2.+'
}
make sure you are also connected to the internet so that jars will be downloaded online through maven repo.

Android aar dependencies

I am new to Gradle build system, I have a library project which includes dependencies like Retrofit, okhttp etc.
I compiled my project and created an aar file. I created a dummy project and added my library aar as a dependency.
Now if I don't add Retrofit and okhttp as dependency in my dummy app's build.gradle file, my app crashes with class not found exception.
My Question is : Since the library aar file already includes Retrofit and okhttp as dependency then why do I need to add them explicitly in dummy app's build.gradle file too? Is there a workaround.
Here is my library build.gradle
apply plugin: 'com.android.library'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.+'
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
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.+'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.android.support:cardview-v7:21.+'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
}
I was able to resolve this by adding the aar file to a local maven repository. Somehow just adding aar in libs folder and including it as a dependency does not fixes the problem.
If you encounter similar problem just modify your library project build.gradle with these additions
apply plugin: 'maven'
version = "1.0"
group = "com.example.lib"
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.github.dcendents:android-maven-plugin:1.0'
}
}
repositories {
mavenLocal()
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://${System.env.HOME}/.m2/repository/")
}
}
}
Run the task in the terminal provided in the Android studio itself as ./gradlew uploadArchives
Then in your app module's build.gradle file, add the library as dependency
compile ('com.example.app:ExampleLibrary:1.0#aar') {
transitive = true;
}

Categories

Resources