Could not find 'com.firebase:firebase-jobdispatcher' - android

I am trying to add Firebase Job Dispatcher to my project, but I am unable to build because of this error:
Gradle sync failed: Could not find
com.firebase:firebase-jobdispatcher:[version]. Required by: project
:[module]
My build.gradle file looks like this:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 2
versionName "1.0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
zipAlignEnabled true
}
}
}
repositories {
mavenCentral()
maven {url "https://clojars.org/repo/"}
}
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
compile 'com.firebase:firebase-jobdispatcher:0.5.2'
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'frankiesardo:icepick:3.2.0'
provided 'frankiesardo:icepick-processor:3.2.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:support-v13:25.3.0'
compile 'com.google.code.gson:gson:2.7'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/volley.jar')
}
Additionally, I have version 45 of the Google Repository and version 39 of Google Play Services installed via the SDK manager.
According to the documentation on the firebase-jobdispatcher Github page, this should be the only thing I need to add the dependency. My project does not rely on GCM, so I'm not sure what is going on. Is there something I'm missing here?

Apparently, Gradle could not resolve the dependency using Maven Central alone. Adding JCenter to my list of repositories fixed the issue:
repositories {
jcenter() // new
mavenCentral()
maven {url "https://clojars.org/repo/"}
}

Related

Could not find 'com.afollestad:material-dialogs:0.7.9.1'

My build.gradle(:app) code
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "tk.yurkiv.recipes"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support:design:27.0.0'
compile 'com.android.support:cardview-v7:28.0.0'
compile 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.jakewharton:butterknife:6.1.0'
annotationProcessor 'com.jakewharton:butterknife:6.1.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile 'com.akexorcist:RoundCornerProgressBar:1.2.3'
compile 'com.vlonjatg.android:progress-activity:1.1.1'
compile 'me.zhanghai.android.materialprogressbar:library:1.0.2'
compile('com.github.florent37:materialviewpager:1.1.0#aar') {
transitive = true
}
compile 'com.afollestad:material-dialogs:0.7.9.1'
compile 'org.adw.library:discrete-seekbar:1.0.0'
compile 'com.github.leonardoxh:fake-search-view:0.3.1'
}
Build Output
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.afollestad:material-dialogs:0.7.9.1.
Searched in the following locations:
file:/E:/Android/Sdk/extras/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
file:/E:/Android/Sdk/extras/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
file:/E:/Android/Sdk/extras/google/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
file:/E:/Android/Sdk/extras/google/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
file:/E:/Android/Sdk/extras/android/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
file:/E:/Android/Sdk/extras/android/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
https://dl.google.com/dl/android/maven2/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
https://dl.google.com/dl/android/maven2/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
https://jcenter.bintray.com/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
https://jcenter.bintray.com/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
https://jitpack.io/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
https://jitpack.io/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
Required by:
project :app
According to this issue on the library repository
https://github.com/afollestad/material-dialogs/issues/990
The library is moved to JCenter so in your build.gradle make sure you have this line jcenter()
allprojects {
repositories {
jcenter()
...
}
}
In any new project, this code is added by default
Replace this:
compile 'com.afollestad:material-dialogs:0.7.9.1'
with this:
implementation 'com.afollestad.material-dialogs:core:3.3.0'
Looks like you are running a legacy project which needs a lot of refactoring.
NOTE: This solution might work for the specific question but not for the project. Update your project to fix every other issues.
Edit: Also see AmrDeveloper's answer below assuming the project is old.

No cached version listing for io.fabric.tools:gradle:1.+ available for offline mode

I am starting to use Fabric and I want to install Crashlytics. As it is in the instructions I have installed fabric plugin on my Android studio.
I get this error:
Error:No cached version listing for io.fabric.tools:gradle:1.+ available for offline mode.
the plugin does the required changes to my gradle and the changes are:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.me.myapplication"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
buildscript {
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.orhanobut:hawk:2.0.1'
compile 'com.koushikdutta.ion:ion:2.1.9'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1#aar'
compile 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'
compile 'com.tuyenmonkey:mkloader:1.2.0'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile 'com.github.clans:fab:1.6.4'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.sd6352051.niftydialogeffects:niftydialogeffects:1.0.0#aar'
compile 'com.github.aakira:expandable-layout:1.6.0#aar'
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
}
As it is in the instruction in here:
https://fabric.io/kits/android/crashlytics/install
I have checked and the changes that the plugin made is right.
I've been searching and I have done the following things and none has worked:
reinstall the plugin
uncheck the offline work in gradle setting (I have tried both checked and unchecked)
clean project
rebuilt project
You're in "offline mode" in Android Studio. To disable this, go to Preferences > Gradle and uncheck "Offline work"
The problem was the proxy settings. It was not working rightly.

firebase on android: authentication and database, gradle sync with error

I have written an Android App that uses the Firebase database feature. Everything is working fine and now I would like to integrate the Authentication feature. So I modified my build.gradle for the app to include the two dependencies for the authentication:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.gmeunier.gestiondepoints"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.android.gms:play-services-plus:10.2.6'
compile 'com.google.firebase:firebase-database:10.2.6'
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
compile 'com.google.firebase:firebase-auth:10.2.6'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Despite all my efforts and research on this topic, I still have the following error when I try to sync this gradle :
Failed to resolve: com.twitter.sdk.android:twitter:2.3.0
I can't find which lib/component versions I must use and I would appreciate help and support.
Your project's gradle file should look like this.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
// Required for 'com.firebaseui:firebase-ui:1.1.1'
maven {
url 'https://maven.fabric.io/public'
}
}
}
Original answer: https://stackoverflow.com/a/41664069/7339411
Add the following line inside "repositories", inside "allprojects" and "buildscript" to your Project Level build.gradle file:
maven {
url 'https://maven.fabric.io/public'
}

Failed to resolve: com.google.android.gms:play-services-measurement:9.6.1

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.

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).

Categories

Resources