Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with Java 8 #1

Open
david-hoze opened this issue Jan 14, 2015 · 4 comments
Open

Integration with Java 8 #1

david-hoze opened this issue Jan 14, 2015 · 4 comments

Comments

@david-hoze
Copy link

Hi, I have an Android project that uses evant/gradle-retrolambda. When I tried to setup the RoboBinding in my Android Studio project, I got this error message:

Error:error at (no source information available)
/mnt/FCEE58DAEE588F30/AndroidstudioProjects/SpeechACall/app/src/main/java/com/voicesense/personality_profiling_dialer/GcmRegistrationHandler.java:1:0::0 The type java.lang.invoke.MethodHandles cannot be resolved. It is indirectly referenced from required .class files
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugAspectJ'.
> The type java.lang.invoke.MethodHandles cannot be resolved. It is indirectly referenced from required .class files

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

This is my build.gradle file

buildscript {
    repositories {
        mavenCentral()
        maven() {
            name 'RoboBinding AspectJPlugin Maven Repository'
            url "https://github.com/RoboBinding/RoboBinding-aspectj-plugin/raw/master/mavenRepo"
        }
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:2.4.1'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'
        classpath 'org.robobinding:aspectj-plugin:0.8.+'
    }
}

repositories {
    mavenCentral()
}

apply plugin: 'retrolambda'
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'org.robobinding.android-aspectj'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "com.voicesense.hr_dialer"
        minSdkVersion 15
        targetSdkVersion 21
    }

    signingConfigs {
        release {
            storeFile file("../../../../../../home/amitai/personality-profiling-dialer_key.keystore")
            storePassword System.getenv("KSTOREPWD")
            keyAlias "alias_name"
            keyPassword System.getenv("KEYPWD")
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
            signingConfig signingConfigs.release
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

retrolambda {
    jvmArgs '-noverify'
}

ext {
    //robobindingVersion = 'latest.integration'
    robobindingVersion = '0.8.9'
}


dependencies {
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar')
    compile 'com.google.android.gms:play-services:6.1.71'
    compile 'com.android.support:support-v4:21.0.3'
    compile 'com.android.support:support-v13:20.0.0'
    //compile 'com.netflix.rxjava:rxjava-android:0.20.7'
    compile 'io.reactivex:rxandroid:0.24.0'
    //compile 'com.googlecode.libphonenumber:geocoder:2.16'
    compile 'com.googlecode.libphonenumber:libphonenumber:7.0'
    compile ("org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies") {
        exclude group: 'com.google.guava', module: 'guava'
    }

    aspectPath ("org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies") {
        exclude group: 'com.google.guava', module: 'guava'
    }
    apt "org.robobinding:codegen:$robobindingVersion"

}

After some investigation I found out it had to do with AspectJ not being compatible with Java 8.
I believe Java 8 Compatiblity/Update AspectJ · Issue #22 · JakeWharton/hugo and Java 8 not supported · Issue #6 · uPhyca/gradle-android-aspectj-plugin have the same issue. RoboBinding is cool, but RetroLambda with RxJava are cool as well, I would really like to use both.. Any suggestions?

@weicheng113
Copy link
Member

Hi Amitai,

I have tried with RetroLambda and RxJava before, so i have no idea what the
problem is.

Cheers,
Cheng
2015-1-14 PM9:13于 "Amitai Hoze" [email protected]写道:

Hi, I have an Android project that uses evant/gradle-retrolambda
https://github.com/evant/gradle-retrolambda. When I tried to setup the
RoboBinding in my Android Studio project, I got this error message:

Error:error at (no source information available)
/mnt/FCEE58DAEE588F30/AndroidstudioProjects/SpeechACall/app/src/main/java/com/voicesense/personality_profiling_dialer/GcmRegistrationHandler.java:1:0::0 The type java.lang.invoke.MethodHandles cannot be resolved. It is indirectly referenced from required .class files
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugAspectJ'.

    The type java.lang.invoke.MethodHandles cannot be resolved. It is indirectly referenced from required .class files

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

This is my build.gradle file

buildscript {
repositories {
mavenCentral()
maven() {
name 'RoboBinding AspectJPlugin Maven Repository'
url "https://github.com/RoboBinding/RoboBinding-aspectj-plugin/raw/master/mavenRepo"
}
}

dependencies {
    classpath 'me.tatarka:gradle-retrolambda:2.4.1'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'
    classpath 'org.robobinding:aspectj-plugin:0.8.+'
}

}
repositories {
mavenCentral()
}

apply plugin: 'retrolambda'
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'org.robobinding.android-aspectj'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"

defaultConfig {
    applicationId "com.voicesense.hr_dialer"
    minSdkVersion 15
    targetSdkVersion 21
}

signingConfigs {
    release {
        storeFile file("../../../../../../home/amitai/personality-profiling-dialer_key.keystore")
        storePassword System.getenv("KSTOREPWD")
        keyAlias "alias_name"
        keyPassword System.getenv("KEYPWD")
    }
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
        signingConfig signingConfigs.release
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

}
retrolambda {
jvmArgs '-noverify'
}
ext {
//robobindingVersion = 'latest.integration'
robobindingVersion = '0.8.9'
}

dependencies {
compile files('libs/acra-4.5.0.jar')
compile files('libs/ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar')
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:support-v13:20.0.0'
//compile 'com.netflix.rxjava:rxjava-android:0.20.7'
compile 'io.reactivex:rxandroid:0.24.0'
//compile 'com.googlecode.libphonenumber:geocoder:2.16'
compile 'com.googlecode.libphonenumber:libphonenumber:7.0'
compile ("org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies") {
exclude group: 'com.google.guava', module: 'guava'
}

aspectPath ("org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies") {
    exclude group: 'com.google.guava', module: 'guava'
}
apt "org.robobinding:codegen:$robobindingVersion"

}

After some investigation I found out it had to do with AspectJ not being
compatible with Java 8.
I believe Java 8 Compatiblity/Update AspectJ · Issue #22 ·
JakeWharton/hugo JakeWharton/hugo#22 and Java
8 not supported · Issue #6 · uPhyca/gradle-android-aspectj-plugin
uPhyca/gradle-android-aspectj-plugin#6 have
the same issue. RoboBinding is cool, but RetroLambda with RxJava are cool
as well, I would really like to use both.. Any suggestions?


Reply to this email directly or view it on GitHub
#1.

@david-hoze
Copy link
Author

@weicheng113, Can you give me a sample working project with RxJava, retrolambda and RoboBinding so I can see what I'm doing wrong?

@david-hoze
Copy link
Author

@weicheng113 I added retrolambda and RxJava to RoboBinding/RoboBinding-album-sample and it still produced the same error..
You can download the Android Studio project here, and do git diff to see exactly what I changed.

@robobindingacc
Copy link
Contributor

Hi Amitai,

Sorry, It was a typo. I meant i haven't tried before.

Cheers,
Cheng
2015-1-14 PM9:42于 "Amitai Hoze" [email protected]写道:

@weicheng113 https://github.com/weicheng113, Can you give me a sample
working project with RxJava, retrolambda and RoboBinding so I can see what
I'm doing wrong?


Reply to this email directly or view it on GitHub
#1 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants