question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem setting up retrolambda in build.gradle files

See original GitHub issue

Hi,I have a problem. I’m using retrolambda on Android Studio because lambda expression are not supported on it and I need them for my app. Here’s my build.gradle file (about the project)

'buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.4.0'
    }
}

// Required because retrolambda is on maven central
repositories {
    mavenCentral()
}

apply plugin: 'com.android.application' //or apply plugin: 'java'
apply plugin: 'me.tatarka.retrolambda'`

When I try to synchronize the project with gradle files it shows this error: “Gradle sync failed: Cause: buildToolsVersion is not specified.”

I’ll post also the build.gradle file for the specific app module,maybe the problem is that I use another external library:

`apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion "25.0.0"

    defaultConfig {
        applicationId "com.example.android.sip"
        minSdkVersion 21
        targetSdkVersion 21
        jackOptions {
            enabled true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    compile files('src/main/java/libs/spark-core-2.3.jar')
}`

Thanks everyone.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
Erhanniscommented, Jan 11, 2017

Yeah, I had the same problem - if I added the stuff to the beginning of my app/build.gradle, though, rather than my root build.gradle, gradle completes successfully. (If that’s the file that’s SUPPOSED to be modified, it would be nice if the docs said so. Hint hint, developers.) However, though gradle finishes the “Rebuild project”, if I actually try to debug it, Android Studio says:

Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
0reactions
Erhanniscommented, Jan 13, 2017

It may be worth noting that I was unable to get ordinary retrolambda working with my dependee eclipse project library thing, and thankfully I was able to just use plain java 7 for it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android, Gradle : RetroLambda not working - Stack Overflow
I am working on an Android application and I came up with RetroLambda tool, with which I can use Lambda expressions in Android...
Read more >
Setting up Retrolambda - Anders Murphy
Retrolambda requires that Java 7 and Java 8 are installed on your machine. ... Add the following to your app build.gradle file: android...
Read more >
Retrolambda stop workin, seems that Path Variables ... - Issue Tracker
to setup the environment variables at all the company laptops without hardcoding the path into the code. I've been using the 2.5.0 version...
Read more >
Lambda Expressions | CodePath Android Cliffnotes
Take a look at the code below for creating an Observable and subscribing an ... the app module build.gradle file to apply the...
Read more >
Use Java 8 language features and APIs - Android Developers
Java 8 language feature support (Android Gradle Plugin 3.0.0+) ... properly configure your project to use them, and any known issues you may ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found