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'
Related
This question already has answers here:
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
(26 answers)
Closed 5 years ago.
I am using Android studio 2.3 and Thought for support new android 26 in my app.But I am stuck on error with title message. My gradle file is like below
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.shayari"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
manifestPlaceholders = [onesignal_app_id : "",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services-location:10.2.6'
compile 'com.android.support:support-v4:26.0.0'
compile 'com.google.android.gms:play-services-gcm:10.2.6'
compile 'com.google.android.gms:play-services-ads:10.2.6'
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support:preference-v7:26.0.0'
compile 'com.android.support:design:26.0.0'
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:customtabs:26.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
compile 'com.onesignal:OneSignal:[3.5.3,4.0.0)'
compile 'com.codemybrainsout.rating:ratingdialog:1.0.7'
compile 'com.android.support:support-vector-drawable:26.0.0'
compile 'com.google.android.gms:play-services-auth:10.2.6'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
But I am not able to install support repository with below error..
Error:(39, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.0
Install Repository and sync project<br>Show in File<br>Show in Project Structure dialog
Add this to your project level build.gradle file:
repositories {
maven {
url "https://maven.google.com"
}
}
UPDATE:
In Android studio 3.0 the error is solved.
Or you can add google() to solve it since you will use new the gradle plugin as mentioned here.
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
Before Android studio 3.0:
Check if the support library is installed in your system (check the SDK directory in your system) or check if Android O is installed in the SDK Manager.
Or as this answer stated
Starting from version 26 of support libraries make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
So I have built an Android app where am using Signal R.
I have imported both signalr-client-sdk-android and signalr-client-sdk found at Github repo
The gradle for each file builds successfully but when I am trying to compile the code in whole i get the message below :
After a small research I did I found out that apparently the libs i downloaded from the repo are compiled by using jdk 1.7 while my Android studio setup is using 1.8.
Any ideas how can I resolve this?
Below you can find my Gradle files :
My apps 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'
apply plugin: 'com.google.gms.google-services'
repositories {
maven {
url 'https://maven.fabric.io/public'
}
maven {
url 'https://clojars.org/repo'
}
}
android {
compileSdkVersion 25
buildToolsVersion "23.0.2"
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
defaultConfig {
applicationId "com.pushdr.application"
minSdkVersion 17
targetSdkVersion 17
ndk {
moduleName "ndkVidyoSample"
}
}
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
mavenCentral()
maven {
url 'https://github.com/FireZenk/maven-repo/raw/master/'
}
}
allprojects {
repositories {
mavenCentral()
}
}
buildTypes {
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
armv7a {
ndk {
abiFilter "armeabi-v7a"
}
}
fat ///This build contain multi architecture binary
}
}
dependencies {
//facebook SDK
//Used for Signal R + Chat
//Used for PIN entry
compile project(':pinentry')
//Menu Drawer
compile project(':materialTabs')
//Credit Card Payment Libraries
compile project(':creditcarddesign')
//Audio waves
compile project(':audiowaves')
compile project(':signalr-client-sdk')
compile project(':signalr-client-sdk-android')
compile('com.crashlytics.sdk.android:crashlytics:2.6.4#aar') {
transitive = true;
}
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.roger.gifloadinglibrary:gifloadinglibrary:1.0.0'
compile 'com.wdullaer:materialdatetimepicker:2.5.0'
compile 'com.synnapps:carouselview:0.0.9'
compile 'com.ragnarok.rxcamera:lib:0.0.4'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
compile 'com.stripe:stripe-android:2.0.2'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.github.2359media:EasyAndroidAnimations:0.8'
compile 'com.mikepenz:crossfader:1.3.7#aar'
compile 'com.mikepenz:crossfadedrawerlayout:0.3.4#aar'
compile 'com.mikepenz:itemanimators:0.2.4#aar'
compile 'com.mikepenz:google-material-typeface:2.2.0.1#aar'
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1#aar'
compile 'com.mikepenz:octicons-typeface:3.0.0.1#aar'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
compile 'com.google.code.gson:gson:2.8.0'
}
signalr - client - sdk - android: gradle
apply plugin: 'com.android.library'
repositories {
maven {
url 'https://clojars.org/repo'
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':signalr-client-sdk')
}
signalr - client - sdk: gradle
apply plugin: 'java'
repositories {
maven {
url 'https://clojars.org/repo'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3'
compile 'org.java-websocket:java-websocket:1.3.1'
}
You can use Java8. When you run javac, you must give it the arguments '-target 1.7 -source 1.7' so that it produces code that is compatible with Java7. You do this indirectly for your own source code by correctly configuring your gradle build scripts.
However, I don't think that is your problem. The android gradle tools will automatically run javac correctly on your source code. I expect the problem is with third-party libraries that you are including in your project.
You need to make sure that every library you use is compiled for Java7. Somewhere on your classpath you have a .class file that was compiled with '-target 1.8'.
Today I updated all my support libraries and buildtools to the latest version to support Android N. Once I updated everything and ran the app, I got an error in InstanceId generation method of GCM in my app. So, I searched and found solutions that suggested to update play-services too. After following all the SO questions and answers, I am stuck and can't move forward. Switching back to support libraries 23.x.x is not an option as I want to target Android N.
Here is how my project level build.gradle files look:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
App level build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
// maven { url 'http://hansel.io/maven' }
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
// classpath 'io.hansel.preprocessor:preprocessor:1.0.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
//apply plugin: 'io.hansel.preprocessor'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
signingConfigs {
}
defaultConfig {
applicationId 'com.example.android'
multiDexEnabled true
minSdkVersion 16
targetSdkVersion 24
versionCode 47
versionName "1.3.2"
renderscriptTargetApi 24
renderscriptSupportModeEnabled true
}
buildTypes {
debug {
applicationIdSuffix = ".dev"
resValue "string", "app_name", "example-debug"
}
release {
minifyEnabled false
shrinkResources false
resValue "string", "app_name", "example"
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 16
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
// maven { url 'http://hansel.io/maven' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:support-annotations:24.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:design:24.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.3.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.clans:fab:1.6.1'
compile 'com.facebook.fresco:fresco:0.8.1+'
compile 'com.facebook.fresco:imagepipeline-okhttp:0.8.1+'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.google.android.gms:play-services-analytics:9.6.1'
compile 'com.google.android.gms:play-services-location:9.6.1'
compile 'com.google.android.gms:play-services-gcm:9.6.1'
compile 'com.google.android.gms:play-services-measurement:9.6.1'
compile 'com.github.liuguangqiang.swipeback:library:1.0.2#aar'
compile 'me.imid.swipebacklayout.lib:library:1.0.0'
compile 'com.github.2359media:EasyAndroidAnimations:0.8'
compile 'com.theartofdev.edmodo:android-image-cropper:2.0.+'
compile 'com.wang.avi:library:1.0.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.mixpanel.android:mixpanel-android:4.6.4'
compile 'com.github.ppamorim:dragger:1.2'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.3'
compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'
// debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
// releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
compile 'com.bignerdranch.android:expandablerecyclerview:2.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.birbit:android-priority-jobqueue:2.0.0'
compile 'com.squareup:otto:1.3.8'
compile 'com.mikhaellopez:circularprogressbar:1.1.1'
compile 'com.github.dotloop:aosp-exif:be25ae51ec'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
exclude group: 'com.squareup.okhttp', module: 'okhttp'
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
And this is the error I am getting:
Any help would be highly appreciated. Thanks.
Edit
My google play services is also updated.
Today I had the same problem. This solved the problem for me:
Open the stand alone Android SDK Manager. In the Extras section the "Google Play Services" were at the latest version, but the "Google Repository" after updating the "Google Repository" from version 33 to 35, the problem was gone.
You don't have the latest google play services, just click the link and android studio will offer a dialog to install it.
Finally, I solved it myself. Here is what I did:
Removed compile 'com.google.android.gms:play-services-measurement:9.6.1' and then compiled the project
It gives missing api_key error because GCM got shifted to Firebase and so the google-services.json file does not work
To fix this, simply update the google-services.json file with the new generated file which uses Cloud messaging from Firebase
After this, I compiled and got another error that #drawable/powered_by_google_dark is missing from the project as I am using Places Autocomplete API. To fix this, add compile 'com.google.android.gms:play-services-places:9.6.0' to dependencies
Set all play service dependencies to 9.6.0. 9.6.1 hasn't released yet. If the problem still occurs, install latest google play service and repository in your android studio.
Well sometime it happens when you are not connected to the internet.
Connect to internet and rebuild your project and the error will be gone.
Worked for me this way.
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
I tried to add smoothprogressbar library to my android project
I added these lines to my build.gradle
dependencies {
// of course, do not write x.x.x but the version number
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}
And when i sync the gradle its saying that
Failed to find : com.github.castorflex.smoothprogressbar:library:0.5.1
I tried putting mavenCentral() and maven url in build.gradle and other solutions which i found in stackoverflow but nothing seems to work.
Edited :
This is my full gradle file
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:cardview-v7:21.+'
compile('com.google.http-client:google-http-client-android:1.18.0-rc') {
exclude(group: 'com.google.android', module: 'android')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile project(path: ':backend', configuration: 'android-endpoints')
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile project(':library')
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v4:19.+'
compile 'com.google.android.gms:play-services:4.4.52'
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v13:19.+'
compile 'com.google.code.gson:gson:2.+'
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}
android {
signingConfigs {
...
}
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId ...
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
dexOptions {
preDexLibraries = false
}
productFlavors {
}
}
Works for me. You should post more of your build.gradle script (in particular, how exactly you tried to put mavenCentral() in the script), but the gist is that you need the following outside of the android {} block in the script (and this is in addition to the similar code in the buildscript {} block):
buildscript {
// ...
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}
android {
// ...
}
Then re-sync your project with Gradle.
Use this approach:
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2#aar'