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

Compiler error #254

Closed
JohnnyTwoShoes opened this issue Jun 13, 2016 · 35 comments
Closed

Compiler error #254

JohnnyTwoShoes opened this issue Jun 13, 2016 · 35 comments

Comments

@JohnnyTwoShoes
Copy link

Sudden I'm getting:
Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/Sets
at org.robobinding.codegen.presentationmodel.processor.PresentationModelProcessor.init(PresentationModelProcessor.java:43)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.(JavacProcessingEnvironment.java:500)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(JavacProcessingEnvironment.java:597)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:690)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
at com.sun.tools.javac.main.Main.compile(Main.java:523)

@weicheng113
Copy link
Member

weicheng113 commented Jun 13, 2016

Hi Johnny, I published new version of RoboBinding today. Are you using different version of codegen with robobinding framework? If you look into robobinding under your local maven repository .m2. You should see the latest robobinding and codegen. Please have a check. I removed Google Guava dependency in the new version for both codegen and RoboBinding framework. I suspect your codegen version is not up-to-date. Do a sync in Android Studio may resolve your issue.

@JohnnyTwoShoes
Copy link
Author

Please explain. Different version of codegen with robobinding? And I can't find .m2 file in my project?
Here's my top gradle:
buildscript {
repositories {
jcenter()
maven() {
name 'RoboBinding AspectJPlugin Maven Repository'
url "https://github.com/RoboBinding/RoboBinding-aspectj-plugin/raw/master/mavenRepo"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'
classpath 'org.robobinding:aspectj-plugin:0.8.4'
}
}

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

and here's my src gradle:
import java.util.regex.Pattern
import java.nio.file.FileAlreadyExistsException
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.util.function.Consumer
import java.util.stream.Stream

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

android {

compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.ims.xxgalaxytab4"
    minSdkVersion 18
    targetSdkVersion 23

    testApplicationId "com.ims.xxgalaxytab4.test"
    testInstrumentationRunner "android.test.InstrumentationTestRunner"

    multiDexEnabled = true

}

signingConfigs {
    release {
        storeFile file("/Users/xxx/Documents/android key/.DS_Store2")
        storePassword "test123"
        keyAlias "xxkey"
        keyPassword "test123"
    }
}

// }

lintOptions {
    disable 'InvalidPackage' //added for butterknife
    checkReleaseBuilds false

}
packagingOptions {
    exclude 'META-INF/services/javax.annotation.processing.Processor'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/notice.txt'
}
dexOptions {
    incremental true
    javaMaxHeapSize "2048M"
}

// lintOptions {
// checkReleaseBuilds false
// }
useLibrary 'org.apache.http.legacy'
}
ext {
robobindingVersion = 'latest.integration'
}
dependencies {
compile project(':library')
compile project(':library2')
// compile 'com.google.android.gms:play-services:+' ///DON'T USE THIS SLOWS DOWN THE BUILD TIME
// compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.maps.android:android-maps-utils:0.4+'
compile files('libs/acra-4.5.0.jar')
//compile files('libs/opencsv-3.0.jar')
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.3.1'
compile 'com.android.support:support-v4:23.1.1'

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"
compile 'io.realm:realm-android:0.87.0'
compile 'com.jakewharton:butterknife:7.0.1'

compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.okhttp3:okhttp:3.0.1'

compile 'com.fasterxml.jackson.core:jackson-core:2.4.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.1'

compile 'io.reactivex:rxjava:1.1.0'
compile 'org.apache.commons:commons-lang3:3.0'

compile 'net.danlew:android.joda:2.9.2'

// compile 'joda-time:joda-time:2.4'

compile 'com.android.support:percent:23.0.0'

}

@weicheng113
Copy link
Member

weicheng113 commented Jun 13, 2016

Take window as an example, your local maven repository path should be C:\Users[username].m2\repository. And you can locate robobinding by C:\Users[username].m2\repository\org\robobinding. Have a check the downloaded robobinding related jars. and try to delete all the subdirs under C:\Users[username].m2\repository\org\robobinding, and then re-sync your project in Android Studio. Don't worry. I will assist you.

You can change this:
ext {
robobindingVersion = 'latest.integration'
}

to

ext {
robobindingVersion = '0.8.14'
}

@JohnnyTwoShoes
Copy link
Author

JohnnyTwoShoes commented Jun 13, 2016

Hi,

Maybe if I just change ext {
robobindingVersion = 'latest.integration'
}

to the previous version? Can you please remind me what I should replace 'latest.integration' with?
I really need to get my project working again asap.
Thank you.

@weicheng113
Copy link
Member

Hi Johnny,

The simplest way is to change robobinding version to previous one(0.8.13):
ext {
robobindingVersion = 'latest.integration'
}

to

ext {
robobindingVersion = '0.8.13'
}

@JohnnyTwoShoes
Copy link
Author

JohnnyTwoShoes commented Jun 13, 2016

I'm on a mac
.m2/repository/org
ls
apache bouncycastle codehaus eclipse jboss ow2 sonatype

@weicheng113
Copy link
Member

Sorry, seems i made a mistake. It should be gradle repository instead of maven repository: C:\Users[username].gradle\caches\modules-2\files-2.1

@JohnnyTwoShoes
Copy link
Author

ok. thanks, so , under
.gradle/caches/modules-2/files-2.1/org.robobinding folder, we have
aspectj-plugin
codegen
extras
robobinding
delete these 4 subdirectories?

@weicheng113
Copy link
Member

Yes, delete them all. do a re-sync in Android Studio. and check the robobinding and codegen dirs. To see what version of them are downloaded.

Remember you have set robobindingVersion = '0.8.14'

@JohnnyTwoShoes
Copy link
Author

I'm still getting the same error?

@JohnnyTwoShoes
Copy link
Author

ok, Let me clean project first

@JohnnyTwoShoes
Copy link
Author

Still the same??

@weicheng113
Copy link
Member

Can you tell what versions of codegen and robobinding framework under the two directories?

@JohnnyTwoShoes
Copy link
Author

codegen: 0.8.13
aspectj-plugin : 0.8.4

@weicheng113
Copy link
Member

what is the robobinding version?

@JohnnyTwoShoes
Copy link
Author

robobinding: 0.8.14

@weicheng113
Copy link
Member

weicheng113 commented Jun 13, 2016

codegen should be 0.8.14 the same as robobinding. This is where the problem is.

@JohnnyTwoShoes
Copy link
Author

ok. Shall I delete codegen and resync?

@weicheng113
Copy link
Member

Yes, please. I have tried myself. I delete them all and resync. codegen 0.8.14 is downloaded.

@JohnnyTwoShoes
Copy link
Author

JohnnyTwoShoes commented Jun 13, 2016

ok, I deleted all sub-dirs,resyned, but, codegen is still 0.8.13

@weicheng113
Copy link
Member

That is very strange. You see in your build.gradle. You have specified - apt "org.robobinding:codegen:$robobindingVersion"

If you set $robobindingVersion to 0.8.14, It should download 0.8.14 of codegen.

@weicheng113
Copy link
Member

And 0.8.14 codegen is published into maven central here also - http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.robobinding%22%20AND%20a%3A%22codegen%22

I tried locally without any problem.

@JohnnyTwoShoes
Copy link
Author

ok, I want to say a BIG THANK YOU, at least its working again ( if I hardcode the version)

@weicheng113
Copy link
Member

Ok, great. So you did this, right - "org.robobinding:codegen:0.8.14"?

That is very strange. Unable to understand.

@JohnnyTwoShoes
Copy link
Author

yes, very strange??

@weicheng113
Copy link
Member

weicheng113 commented Jun 13, 2016

I removed Google Guava dependency in new version, as it caused many issues for new users.

So your build.gradle can be simplified now.
Change:
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'
}

To:
compile "org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies"
aspectPath "org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies"

@JohnnyTwoShoes
Copy link
Author

JohnnyTwoShoes commented Jun 13, 2016

ok, thanks. Can I ask you, it's still not possible to use robobinding with guava? I tried to fix the issue by adding guava (but it didn't help).

@weicheng113
Copy link
Member

Certainly. You can use Google Guava as you like. RoboBinding framework itself does not depend on any other libraries now.

@weicheng113
Copy link
Member

weicheng113 commented Jun 13, 2016

Johnny, can you try one thing:

  1. Delete codegen 0.8.13 jar only under ./gradle repository.
  2. Use this "org.robobinding:codegen:$robobindingVersion", instead of hardcode. Is it working now?

Just wonder if it is somehow gradle not function properly.

@JohnnyTwoShoes
Copy link
Author

JohnnyTwoShoes commented Jun 13, 2016

I deleted 0.8.13 subfolder and reused robobindingVersion = 'latest.integration'.

it downloaded 0.8.13.

or shall I delete the jar only from 0.8.13 folder?

@weicheng113
Copy link
Member

latest.integration means latest snapshot, which is unstable. Normally, we will not use latest.integration in real world app.

Ok, let me trigger a snapshot publish. The latest.integration should refer to 0.8.15-SNAPSHOT now.

@JohnnyTwoShoes
Copy link
Author

ok, thank you again for all your help. I'm going out to grab some lunch.
PS I tried guava ( though I'm not using it currently) and got some errors when running the app:

java.lang.ClassNotFoundException: Didn't find class "retrofit.Response" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.xxx.galaxytab4-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.xxx.galaxytab4-1, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at java.lang.Class.getDeclaredMethods(Native Method)
at java.lang.Class.getDeclaredMethods(Class.java:656)
at org.robobinding.internal.java_beans.StandardBeanInfo.introspectMethods(StandardBeanInfo.java:406)
at org.robobinding.internal.java_beans.StandardBeanInfo.introspectMethods(StandardBeanInfo.java:396)
at org.robobinding.internal.java_beans.StandardBeanInfo.(StandardBeanInfo.java:106)
at org.robobinding.internal.java_beans.Introspector.getBeanInfoImpl(Introspector.java:123)
at org.robobinding.internal.java_beans.Introspector.getBeanInfoImplAndInit(Introspector.java:212)
at org.robobinding.internal.java_beans.Introspector.getBeanInfo(Introspector.java:112)
at org.robobinding.property.PropertyUtils.getPropertyDescriptors0(PropertyUtils.java:37)
at org.robobinding.property.PropertyUtils.getPropertyNames(PropertyUtils.java:22)
at org.robobinding.presentationmodel.PresentationModelChangeSupport.(PresentationModelChangeSupport.java:24)
at org.robobinding.aspects.PresentationModelMixin$Impl.ajc$before$org_robobinding_aspects_PresentationModelMixin$Impl$1$57e64514(PresentationModelMixin.aj:34)
at com.xxx.galaxytab4.ViewModel.EngineerViewModel.(EngineerViewModel.java:45)

@weicheng113
Copy link
Member

I don't think it is related to Google Guava. Looking at the error, It is class loader was not unable to find retrofit.Response class.

@JohnnyTwoShoes
Copy link
Author

ok. thanks

@weicheng113
Copy link
Member

@JohnnyTwoShoes , Please close the issue if you think it is fixed. Thanks.

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

2 participants