i'm trying to use the Jgrapht library but it needs lambdas...
Here's my code:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
}
dependencies {
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.3.0"
classpath 'com.android.tools.build:gradle:2.2.1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And the :app
apply plugin: "me.tatarka.retrolambda" version "3.3.0"
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "it.univpm.gruppoids.iotforemergencyandnavigation"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
compile 'com.google.zxing:core:3.2.1'
compile 'org.jgrapht:jgrapht-core:1.0.0'
}
The error is: Error:(1, 0) Cannot invoke method version() on null object
Open File
Where and what is the error? thanks
You're mixing two kinds of syntaxes. Use either
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.3.0"
}
}
apply plugin: 'me.tatarka.retrolambda'
or
plugins {
id "me.tatarka.retrolambda" version "3.3.0"
}
(gradle-retrolambda README), see also the gradle documentation.
I have the same issue.
You'll need to update a few things:
android/build.gradle:
i) classpath 'com.google.gms:google-services:4.0.1'
ii) Make sure google() appears above jcenter() in both buildscripts and allprojects
android/app/build.gradle:
Update Android libs to the latest specified here:
https://firebase.google.com/support/release-notes/android#20180523
if you have other libraries (for me, it's firebase) make sure to check build.gradle of the libraries, too.
I can't setup the updated version of firebase on android studio.
I've created json file of the project on the site firebase and copied it into the project and after coping lines in gradle:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
compile 'com.google.firebase:firebase-core:9.0.1'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
I get the following error:
failed to resolve: compile 'com.google.firebase:firebase-core:9.0.0'
How can I fix it?
I had the same problem. If you are using Android studio, you should then update google repository in SDK Manager.
Following is my build.grade(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "package name"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.google.firebase:firebase-core:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
And this is my build.grade(project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
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
}
}
allprojects {
repositories {
jcenter()
}
}
Firebase is working based on Google Play Services. So please make sure you have the following sdk tools and they are updated to sync against the library versions of firebase that you are using.
SDK Tools installed for this project
Project 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:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Module Level build.gradle file
apply plugin: 'com.android.application'
android {
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.devdeeds.firebaseauth"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.firebase:firebase-auth:9.2.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
}
apply plugin: 'com.google.gms.google-services'
I get the following error
Error:(3, 0) Cause: org/apache/commons/lang3/StringUtils
when I try to add data binding in my Android project.
My dependencies include :
// 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:2.0.0-alpha7'
classpath 'me.tatarka:gradle-retrolambda:3.2.2'
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My gradle wrapper is : distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip
My gradle file :
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.android.databinding'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.quizviz.workbook.myworkbook"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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:design:23.1.1'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit2:converter-jackson:2.0.0-beta3'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta3'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.0.1'
}
It took me a while to notice this problem is caused by google updating the way to use data binding library. You can see more information from here:
http://developer.android.com/tools/data-binding/guide.html.
You can just remove these two lines of code:
apply plugin: 'com.android.databinding'
And this one in buildscript's dependencies:
classpath 'com.android.databinding:dataBinder:1.0-rc1'
Then add the dataBinding section to your build.gradle like this.
buildscript {
...
}
android {
...
dataBinding {
enabled = true
}
...
}
dependencies {
...
}
Here you go. This works for me :).
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 working in android studio 1.0
the gradle file is showing this error:
Execution failed for task ':app:compileRetroLambdaDebug'
apply plugin: 'android'
apply plugin: 'retrolambda'
android {
compileSdkVersion 21
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "xxxxxxxx"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:21.0.2'
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'io.reactivex:rxandroid:0.23.0'
}
// 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:1.0.0-rc1'
classpath 'me.tatarka:gradle-retrolambda:2.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
what else changes I have to make in the gradle file. Please suggest something...
I had a similar error while updating the dependencies in eclipse. Try to update to the newest plugin versions and change retrolambda to me.tatarka.retrolambda, since the retrolambda plugin is deprecated and will be removed soon. At least it's what I did to fix the error.
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'android'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:2.5.0'
classpath 'com.android.tools.build:gradle:1.0.1'
}
}
...