I am trying to add Firebase Analytics to my Android Studio project.
I am getting the following error:
all firebase libraries must be either above or below 14.0.0
I have already been seeing this question that has a solution but I tried similar changes and is not working still.
Here is my (module: app) build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "my-application-id"
minSdkVersion 9
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.navercorp.pulltorefresh:library:3.2.0#aar'
}
}
dependencies {
compile 'com.google.firebase:firebase-core:15.0.0'
}
repositories {
maven {url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
}
apply plugin: 'com.google.gms.google-services'
And here is my (project) build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.3.0' // google-services plugin
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
Thank you in advance for your help.
To solve this, please move the following line of code:
compile 'com.google.firebase:firebase-core:15.0.0'
In the above dependencies section and change it to:
compile 'com.google.firebase:firebase-core:16.0.1'
If you also want to use Analytics, please also add the following line of code:
com.google.firebase:firebase-analytics:16.0.1
To make it work, change also the followin line of code:
classpath 'com.google.gms:google-services:3.3.0'
to
classpath 'com.google.gms:google-services:4.0.1'
I am trying to use this library for my app but as it is made in kotlin I am facing the problem . I downloaded the module of this library and imported this module in the project but in the initial state i am gettin kotlin plugin not found so i changed the gradel as this
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
resourcePrefix "yal_ms_"
}
buidscript {
ext.kotlin_version = '1.0.1-2'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.1-2'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:26.1.0"
compile "com.android.support:recyclerview-v7:26.1.0"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
repositories {
mavenCentral()
jcenter()
}
I am trying to use the kotlin library for the first time and I dont know any thing much about kotlin any advice how to use this library will be helpful .
Try Importing this library by gradle
Add maven { url "https://jitpack.io" } to the repositories of project gradle. So it will be like this
build.gradle(Project)
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
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()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and add compile 'com.github.yalantis:multi-selection:v0.1' to dependencies in build.gradle(app)
This may create Manifest Merge Conflicts error while building project to remove that add tools:replace="android:label" under <application> tag in Manifest
Hi people i have the following error on the title im so done of searching for a solution and still got nothing :'( this is a project for my company and it is 1 month of work please help me I really need my project back .
This is my build.gradle:
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter() // or mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "nunoalmeida.atphc"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
buildscript {
repositories {
jcenter() // or mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.+'
}
}
}
Replace this , it worked for me
classpath 'com.android.tools.build:gradle:2.2.0'
buildscript {
repositories {
jcenter() // or mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
}
}
cut this code from your module level build.gradle file and paste it to your project level build.gradle file.
it worked for me.
Download the Gradle distribution and read the "User Guide" PDF from top to bottom and save yourself the time that you'll spend asking questions.
If you do that, you'll find that buildscript dependencies are set with "classpath", not "compile".
This is an old question which is irrelevant today. See Android developer's instruction. Applying Databinding to your projects is a lot easier now than four years ago.
As I am going over Android Data binding Guide from https://developer.android.com/tools/data-binding/guide.html. I have made sure I am running Android Studio 1.3 (canary version).
Following the guidelines, I get this error:
Gradle sync failed: could not find com.android.databinding:library:1.0-rc0
Has anyone else have the same problem? Thanks for your help.
App build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0-beta1'
classpath "com.android.databinding:dataBinder:1.0-rc0"
}
}
allprojects {
repositories {
jcenter()
}
}
Module build.graddle
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'android-apt'
def AAVersion = '3.3'
def MyProject = 'com.commonsware.android.frw.filesdemo'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
repositories {
mavenCentral()
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName "$MyProject"
}
}
android {
compileSdkVersion 22
buildToolsVersion "22"
defaultConfig {
applicationId "$MyProject"
minSdkVersion 17
targetSdkVersion 22
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/NOTICE'
exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
}
dexOptions {
preDexLibraries = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile "com.squareup:otto:1.3.6"
compile "commons-io:commons-io:+"
compile 'com.fasterxml.jackson.jr:jackson-jr-all:2.5.0'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
}
I had this problem and solved it by adding "jcenter" under allprojects.repositories in my top-level build.gradle (I had been using mavenCentral).
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.databinding:dataBinder:1.0-rc1'
}
}
allprojects {
repositories {
mavenCentral()
jcenter() // <=== *** Adding this fixed it ***
}
}
I got errors when I sync build.gradle files.
Error:Failed to resolve: com.android.databinding:library:1.0-rc0
Error:Failed to resolve: com.android.databinding:adapters:1.0-rc0
And I finally found the solution.
dependencies {
// instead of the below pathes...
//classpath "com.android.tools.build:gradle:1.3.0-beta2"
//classpath "com.android.databinding:dataBinder:1.0-rc0"
// I used the following classpathes.... It works!
classpath "com.android.tools.build:gradle:1.3.+"
classpath "com.android.databinding:dataBinder:1.+"
}
By looking at your error Gradle couldn't find com.android.databinding:dataBinder:1.0-rc0 you should try this instead,
classpath "com.android.databinding:dataBinder:1.0-rc1"
To use DataBinding follow all these steps.
Update your Android Studio to Android Studio 1.3 version.
To set up your application to use data binding, add data
binding to the class path of your top-level build.gradle file,
right below "android".
dependencies {
classpath "com.android.tools.build:gradle:1.3"
classpath "com.android.databinding:dataBinder:1.0-rc1"
}
Then make sure jcenter is in the repositories list for your projects
in the top-level build.gradle file.
allprojects {
repositories {
jcenter()
}
}
In each module you want to use data binding, apply the plugin right
after android plugin.
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
Clean and build your app.
Complete code
top-level build.gradle file,
// 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'
classpath "com.android.databinding:dataBinder:1.0-rc1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
module-level build.gradle file,
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.packagename"
minSdkVersion 15
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.2.1'
}
For more detail Data Binding Guide.
For Complete demo Data Binding Android
Make sure you have Android Studio 1.3 or higher
Your project build.gradle should look something like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0-beta1'
classpath "com.android.databinding:dataBinder:1.0-rc0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
And your module build.gradle should look something like this:
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.my.appId"
minSdkVersion 15
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'])
}
I had a problem where I was targeting M Preview so nothing worked. Once I changed the build tools to 22.0.1, and the targetSdkVersion to 22, everything worked.
I had the same issue and solved it by updating android sdk tools to 24.3.3.
Update for latest Android Studio & latest Gradle
You don't need to add databinding:dataBinder dependency now. Just enable dataBinding in app level build.gradle in android tag.
android
{
...
dataBinding {
enabled = true
}
...
}
As the Documentation said
To use data binding, Android Plugin for Gradle 1.5.0-alpha1 or higher
is required.
I have added the following line to build.gradle 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-beta2"
// 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
}
and then add the :
dataBinding {
enabled = true
}
to your build.graddle module app like this :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "gujarat.databinding"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
}
Please, try to change classpath to 'com.android.tools.build:gradle:1.3.0-beta2' and set buildToolsVersion "23 rc2".
Don't forget to update SDK packages via SDK manager before doing that.
Here you can find more information about Android Preview SDK: Set Up the Preview SDK
I had an identical issue, and solved it by removing the plugin for android-apt. Not sure what's conflicting there, but something is.
You should update your SDK and It will resolve this issue.
You should add
classpath 'com.android.tools.build:gradle:1.3.0'
classpath "com.android.databinding:dataBinder:1.0-rc0"
build.grade which in project Directory.
then Sync the gradle
Sync your project after adding classpath
i am trying to add Jack Whartons ViewPagerIndicator library https://github.com/JakeWharton/ViewPagerIndicator
to my app as i want to use the circle indicator for the viewpager i have. However i am having trouble adding it to my app.
i have followed this tutorial - Using ViewPagerIndicator library with Android Studio and Gradle
However i am getting this error
Error:Artifact 'library.aar (com.viewpagerindicator:library:2.4.1)' not found.
Searched in the following locations:
https://jcenter.bintray.com/com/viewpagerindicator/library/2.4.1/library-2.4.1.aar
if i remove the jCenter() code in my gradle then it works but the other dependencies i have included do not, so i am not sure how to get round having all the dependencies work together.
Here is my top level gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
}
And here is my module:app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "co.app.al.app"
minSdkVersion 16
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.0.0'
compile 'com.afollestad:material-dialogs:0.6.2.3'
compile files('libs/volley.jar')
compile 'uk.co.chrisjenx:calligraphy:2.0.2'
compile 'com.viewpagerindicator:library:2.4.1#aar'
}
Thanks for any and all help
You can check the maven repository or jcenter:
http://search.maven.org/#search%7Cga%7C1%7Ccom.viewpagerindicator
https://bintray.com/bintray/jcenter/com.viewpagerindicator%3Alibrary/view#files
There is a library artifact with 2.4.1, but it ISN'T an AAR file.
You have to use an alternative repo
maven { url "http://dl.bintray.com/populov/maven" }, but it is important the order.
Change your script:
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
mavenCentral()
}
}