I need to install the plugin Butter Knife. Where can I download it? I downloaded a .jar plugin (but not if the file is the one I need), I have installed but when I click on the option "generate" not the option to use butterknife appears. following a video tutorial I modified files Gradle build: I have them now as follows:
apply plugin: 'android-apt'
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "calcursoedxleccion0.cal"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$rootProject.ext.supportLibraryVersion"
compile "com.android.support:support-v4:$rootProject.ext.supportLibraryVersion"
compile "com.android.support:design:$rootProject.ext.supportLibraryVersion"
// compile "com.jakewharton:butterknife:$rootProject.ext.butterKnifeVersion"
compile "com.jakewharton:butterknife:$rootProject.ext.butterKnifeVersion"
apt "com.jakewharton:butterknife-compiler:8.0.1"
}
and
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext{
minSdkVersion = 16
targetSdkVersion = 23
compileSdkVersion = 23
buildToolsVersion = '23.0.3'
supportLibraryVersion = '23.3.0'
butterKnifeVersion = '8.0.1'
}
Gradle to synchronize I get this error:
"The android android-library or plugin must be applied to the project"
error (1.0)
What am I doing wrong?
The easiest way to use ButterKnife library is to add this single line to your module-level build.gradle dependencies list:
dependencies {
implementation 'com.jakewharton:butterknife:7.0.1'
}
You can then synchronize your project!
UPDATE 1
I just noticed Jake the Wharton has updated the library since the last time I used it! Now, it appears you have to add to two separate places:
In your project-level build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
And lastly, in your module-level build.gradle file:
apply plugin: 'android-apt'
android {
...
}
dependencies {
implementation 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
}
It is important that you add apply plugin: 'android-apt' to top of the module-level build.gradle file; most likely below the first line like this:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
I have just tested this and works for me. Good luck!
UPDATE 2
Jake Wharton just released an update to the library and here is what you need to do in order to use it:
So, inside your build.gradle (app-level), add the following to your dependencies!
dependencies {
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
I hope this helps you!
UPDATE 3:
Here is versions released till now in case you have conflict with other libraries and want it to work on older API levels
With trying , in case you want it min SDK level 15 till now
you will need to play with versions to get it working in my case these set
are compatable so far with SDK 15 as minimum.
This case i only put these in module app level build.gradle.
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'
})
implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
implementation group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.3.0'
implementation 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
implementation 'io.reactivex:rxjava:1.1.6'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
implementation 'com.android.support:recyclerview-v7:24.2.1'
}
In Android Studio you can do this by:
Right-click your module
Click 'Open Module Settings'
Click Dependencies Tab
Click the green plus icon
Select 'Library Dependency' from the dropdown list
Enter "butterknife" in the search field and click the search button
After selecting the library, Android Studio adds the dependency to your module.
Since butterknife does annotation processing, you have to add this to the build.gradle of your module right after the compile statement for butterknife:
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
where the version number at the end should match your version of butterknife.
Related
I just add a module to my android project. Android Studio builds the project correctly, but when I attempt to launch the app, I getting this error.
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
My project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.apollographql.apollo:apollo-gradle-plugin:0.4.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My module gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.apollographql.android'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.yamblet.smartliving"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':openpayandroid')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.airbnb.android:lottie:2.0.0'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.apollographql.apollo:apollo-runtime:0.4.4'
implementation "com.apollographql.apollo:apollo-android-support:0.4.4"
implementation 'com.apollographql.apollo:apollo-http-cache:0.4.4'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'jp.wasabeef:glide-transformations:2.0.1'
implementation 'com.master.android:permissionhelper:1.1'
implementation 'com.iamhabib:easy-preference:1.0.1'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.github.jkwiecien:EasyImage:2.0.2'
//RETROFIT
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
//JSON PARSING
implementation 'com.google.code.gson:gson:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.master.android:permissionhelper:1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
maven { url "https://jitpack.io" }
mavenCentral()
}
apply plugin: 'kotlin-android-extensions'
Module gradle that I added
apply plugin: 'com.android.library'
android {
compileSdkVersion 19
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.+'
compile files('libs/devicecollector-sdk-2.5.jar')
compile files('libs/google-http-client-1.17.0-rc.jar')
compile files('libs/google-http-client-android-1.17.0-rc.jar')
compile files('libs/google-http-client-jackson2-1.17.0-rc.jar')
compile files('libs/jackson-core-2.1.3.jar')
compile files('libs/jackson-core-asl-1.9.11.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/junit-4.10.jar')
}
I clean and rebuild the project but, the error persists in the build process. Also I add multiDexEnabled true but didnt work. Thanks for your help.
I executed this gradle, and it works only problem I can see here is implementation project(':openpayandroid'), i didn't included it as its your private library, but on my understanding openpayandroid is also including some same dependencies which is causing the problem, so solution can be to exclude that group from it, eg implementation project(':openpayandroid')
{
exclude group 'the dex error causing lib group'
}
if above does'nt work try this
in your project build.gradle try use same version of all the groups e.g.
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "26.1.0" // your version
}
I think this might help but if this doesn't work try to check which file is responsible for this dex error and edit your question
One more thing you have include permission helper twice, remove (but it might not be the problem )
Make sure you have multiDexEnabled true ie. multidex enabled in your app gradle under android section
In build.gradle in default config use
multiDexEnabled true
and add dependency like compile 'com.android.support:multidex:1.0.3'
and extend your application file with MultidexApplication and rebuild your project. This will help you.
If you update the dependencies recently try this answer
Just clean the project & re-build the project
Build -> Clean project
Build -> Rebuild project
I just install from zero Android Studio 3 and clone my project which doesn't use Android Studio 3 before. I tried to compile but gradle couldn't sync correctly.
I'm using gradle 4.3 because I search my problem on other post, but couldn't find how to fix. This is my gradle file :
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath "io.realm:realm-gradle-plugin:2.1.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And app/gradle file :
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
lintOptions {
disable 'InnerclassSeparator'
}
defaultConfig {
applicationId "fr.laway.dev.laway"
minSdkVersion 21
targetSdkVersion 26
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 project(path: ':laway_data', configuration: 'default')
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.github.clans:fab:1.6.4'
compile 'com.aurelhubert:ahbottomnavigation:1.5.1'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.android.support:multidex:1.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.27.0'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.gms:google-services:3.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Finally, my errors :
Is something missing in my gradle file?
I don't know why it's related but I just update my realm library :
classpath "io.realm:realm-gradle-plugin:4.1.1"
This was enough for finish to compile and remove all errors. Gradle still is very mysterious for me x)
From the error, gradle complaining this:
android-apt plugin is incompatible with the Android plugin. Please use
'annotationProcessor' configuration instead.
From the documentation:
Use the annotation processor dependency configuration
In previous versions of the plugin, dependencies on the compile classpath were automatically added to the processor classpath. That is, you could add an annotation processor to the compile classpath and it would work as expected. However, this causes a significant impact to performance by adding a large number of unnecessary dependencies to the processor.
When using the Android plugin 3.0.0, you must add annotation processors to the processor classpath using the annotationProcessor dependency configuration, as shown below:
dependencies {
...
annotationProcessor 'com.google.dagger:dagger-compiler:<version-number>'
}
You need to using annotationProcessor in your laway_data module build.gradle.
I have an android app that I want to add firebase messaging service functionality so I can receieve notifications that are sent from my self-built server to the firebase cloud.
I started adding the configuration lines to the gradle files, but after adding the
apply plugin: 'com.google.gms.google-services'
line, I get an error as follows:
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.0.2.
This is my module:app gradle script file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "br.com.berait.brecar"
minSdkVersion 21
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.google.android.gms:play-services-maps:11.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.android.support:design:25.3.1'
compile 'com.wdullaer:materialdatetimepicker:3.2.2'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
compile 'com.google.firebase:firebase-messaging:10.2.6'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
if needed, this is my project level gradle script file:
//Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have searched S.O for sometime now and all the answers to this type of error haven't worked for me. As you can see, i have the apply plugin line at the bottom of the file. I believe the conflict is being generated by the
compile 'com.google.android.gms:play-services-maps:11.0.2'
line, which was automatically added when I added google maps API support to my application.
Any help is appreciated, thanks in advance!
Bump up the firebase dependency version to
compile 'com.google.firebase:firebase-messaging:11.0.2'
or lower the maps dependency to
compile 'com.google.android.gms:play-services-maps:10.2.6'
I just updated sdk, google play services and google repository, but still this error happened. Please help, I want to integrate authentication using phone number.
SDK Manager
Logcat
Build.gradle Module:Project
// Top-level build file where you can add configuration options common to all sub-projects/module
return
buildscript {
ext.kotlin_version = '1.1.3-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle Module:App
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.*****"
minSdkVersion 16
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.google.firebase:firebase-auth:11.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
On Firebase documentation it says:
Getting a "Could not find" error? Make sure you have
the latest Google Repository in the Android SDK manager
Updating Google Repository should help with Failed to resolve issues as well (at the time of writing these lines, Google Repository version is 57).
So solving this should be rather simple. Here are the steps you should take:
Open SDK Manager.
Select SDK Tools on the top tabs.
Scroll down, under Support Repository select Google Repository.
Hit the OK button.
As soon as installation is completed, change the Firebase dependencies version to 11.0.2.
Click on the "Sync Now" button.
Enjoy Firebase =)
Seems like you forgot to include the google play services plugin add these lines of code
App level gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
...
compile "com.google.firebase:firebase-core:11.0.2"
compile "com.google.firebase:firebase-auth:11.0.2"
...
}
apply plugin: 'com.google.gms.google-services' <-- this line ath the bottom of it
Project level gradle
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0' <--- This Line
}
// Getting a "Could not find" error? Make sure you have
// the latest Google Repository in the Android SDK manager
Google have shifted their new repositories from jcenter to maven google.
Add
google()
inside repositories in project build.gradle
Add Googles own maven repository to your build-gradle file:
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
Source: https://developer.android.com/studio/build/dependencies.html#google-maven
Solved for me setting play-services and firebase equal versions, like this:
implementation "com.google.firebase:firebase-core:11.8.0"
implementation "com.google.firebase:firebase-messaging:11.8.0"
implementation "com.google.firebase:firebase-database:11.8.0"
implementation "com.google.firebase:firebase-storage:11.8.0"
implementation "com.google.firebase:firebase-auth:11.8.0"
implementation "com.google.firebase:firebase-config:11.8.0"
implementation "com.google.firebase:firebase-crash:11.8.0"
implementation "com.google.android.gms:play-services-maps:11.8.0"
implementation "com.google.android.gms:play-services-location:11.8.0"
implementation "com.google.android.gms:play-services-places:11.8.0"
implementation "com.google.android.gms:play-services-auth:11.8.0"
implementation "com.google.android.gms:play-services-base:11.8.0"
Try using older version of Auth.
compile 'com.google.firebase:firebase-auth:10.0.1'
I am working on the Sample in the below blog
https://www.firebase.com/blog/2015-10-01-firebase-android-app-engine-tutorial.html
The projects fails to compile after adding the dependency
compile 'com.firebase:firebase-client-android:2.3.1'
Other dependencies compile without any issue.
'com.android.support:appcompat-v7:23.0.1'
'compile 'com.android.support:design:23.0.1'
Where am I going wrong ?
here is my module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.tri.todoapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.firebase:firebase-client-android:2.4.0'
}
Top-level gradle
// 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.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The project fails to compile because version 2.3 doesn't exists. You should use 2.3.1:
compile 'com.firebase:firebase-client-android:2.3.1'
or the newest 2.4.0:
compile 'com.firebase:firebase-client-android:2.4.0'
You can find more information here:
https://www.firebase.com/docs/android/quickstart.html
We are talking about Google api versions without mentioning Google Repository version.
The actual problem here is that your Google Repository doesn't "know" about the firebase version you all were trying to use.
I got same error while following the official firebase documentation
My app-level build.gradle file looked like this:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
}
apply plugin: 'com.google.gms.google-services'
My Google Repository version was 44
You can check yours in
SDK Manager>Android SDK> SDK Tools (tab)
Latest version is 46 (at the time of writing this)
I updated to latest Google Repository version and the problem was solved!
You can update by checking "Google Repository" under SDK Tools tab and click "Apply" to update Google Repository to latest version
If you do not wish to update your Google Repository version, you can still resolve the issue by lowering your firebase api version slighlty.
For my case, changing app-level build.gradle file to the following also fixes my problem:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
}
apply plugin: 'com.google.gms.google-services'
firebase version has been lowered to version 10.2.0 from 10.2.1
This works because 10.2.0 is known to Google repository ver 44.
I hope this answer will help many in future.
There are two modules you need to add firebase to:
The android module: You should use the "Add Firebase" checkbox that appears in project structure that will add 2.3.1 to the android app.
The backend module requires 2.4 to run in app engine and those steps require you to add the dependency manually.
In that case, be sure you are adding the jvm client -- not the "android" client for app engine.
compile 'com.firebase:firebase-client-android:2.4.0'
It happens because this version
compile 'com.firebase:firebase-client-android:2.3'
doesn't exist.
You can use one of these:
compile 'com.firebase:firebase-client-android:2.4.0'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebase:firebase-client-android:2.3.0'
Pay attention.
compile 'com.firebase:firebase-client-android:2.3.0'
is different from
compile 'com.firebase:firebase-client-android:2.3'
You can find the full list in maven:
using
compile 'com.firebase:firebase-client-android:+'
worked for me.
I had the exact same problem today, but with version 2.4.1. I could however not open the link l jcenter.bintray.com/com/firebase/firebase-client-android/2.4.1/ as mentioned by Mattia Maestrini.
Solution for me: Deactivate my VPN, and then it worked.
it looks like it was a dex limit error. Adding the Firebase SDK must have put me over the limit, to fix this i had to add multiDexEnabled true in the defaultConfig section of my app:build.gradle file as well as compile 'com.android.support:multidex:1.0.0' in the dependencies
Here is my gradle
gradle for 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.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle module app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.tranetech.openspace.firebasedemo"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.firebase:firebase-client-android:2.5.2+'
compile 'com.firebaseui:firebase-ui:0.3.1'
compile 'com.android.support:multidex:1.0.0'
}
I not sure you still working with that project or not, but I also faced the same problem with you, my solution is
In your build.gradle (outside the app folder one), add
buildscript {
repositories {
jcenter()
}
dependencies {
////
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
and in your module build.gradle, add
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.+'
compile 'com.android.support:design:23.+'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.firebase:firebase-database:9.2.1'
compile 'com.firebase:firebase-client-android:2.4.0'
}
apply plugin:
'com.google.gms.google-services'// <- this code
And the last, don't forget to download google-services.json put in your app folder, the path should look like \yourapplication\app, you also can refer to this link for download google-services.json file. Download a configuration file
compile is deprecated. You should use:
implementation 'com.firebase:firebase-client-android:2.5.2'