Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

java.lang.NoClassDefFoundError: com.parse.ParseFacebookUtils$1 #12

Closed
nvasilescu opened this issue Dec 11, 2015 · 15 comments
Closed

java.lang.NoClassDefFoundError: com.parse.ParseFacebookUtils$1 #12

nvasilescu opened this issue Dec 11, 2015 · 15 comments

Comments

@nvasilescu
Copy link

Android studio 1.5.

line that throws the error -> ParseFacebookUtils.initialize(getApplicationContext());

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 'com.facebook.android:facebook-android-sdk:4.6.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile 'com.parse:parsefacebookutils-v4-android:1.10.3@aar'
}

@parse-github-bot
Copy link

Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.

Please try the latest SDK. Our release notes have details about what issues were fixed in each release.

In addition, you might find the following resources helpful:

@nvasilescu
Copy link
Author

what more info should I provide ? Any new project template from android studio, compiling those gradle libraries and initiation of ParseFacebookUtils in the ApplicationClass in onCreate().

@nvasilescu
Copy link
Author

Tested on windows also. Same problem. Switched to .jar instead of aar. Same problem. Please fix. It's a critical issue.

compile files('libs/ParseFacebookUtilsV4-1.10.3.jar')

@nvasilescu
Copy link
Author

compile files('libs/ParseFacebookUtilsV4-1.10.3.jar')
compile files('libs/Parse-1.11.0.jar')

If you use these 2 jars the error goes away, but the maven library ParseFacebookUtils can't be compiled with Parse android sdk from maven because you will get dex error.

@grantland
Copy link
Contributor

This is a problem with facebook-android-sdk since it's using an outdated version of Bolts (bolts-android before the split to bolts-tasks and bolts-applinks). This will be fixed in their next release which is slated for early next year.

A workaround for now is to exclude bolts-android from facebook-android-sdk and include bolts-tasks and bolts-applinks manually. You can find an example of this here: https://github.com/ParsePlatform/ParseFacebookUtils-Android/blob/master/library/build.gradle#L33

(Note: bolts-tasks is required by parse-android and is not required to be declared)

@heliumb
Copy link

heliumb commented Jan 19, 2016

@grantland i have this same issue and the solution you provided did not work for me. i still get the same error:
"java.lang.NoClassDefFoundError: com.parse.ParseFacebookUtils$1"

Any advice?

@grantland
Copy link
Contributor

@heliumb are you sure that ParseFacebookUtils is in the classpath? Do you get any gradle or compile errors?

@heliumb
Copy link

heliumb commented Jan 19, 2016

hey @grantland I'm pretty sure but I'm new at this so forgive me if I'm wrong. I just did several things that the parse website told me not to do and it worked...can you please tell me if this is going to be a problematic solution to this. In my dependencies, I included both parse-android and parsefacebookutils, which the parse website says should cause a DexException but I didn't get one. When I include only parsefacebookutils, it does not seem to be able to locate the standard parse library. Then I imported the entire bolts library (rather than just bolts-appslinks) and excluded bolts from the facebook sdk. Somehow these steps made it work....Is this a proper solution to this issue? I honestly have no idea why this works and I'm worried it won't work tomorrow...Thanks!

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/joda-time-2.9.jar')

    compile 'com.android.support:appcompat-v7:22.2.0'

    compile 'com.parse:parsefacebookutils-v4-android:1.10.3@aar'
    compile 'com.parse:parse-android:1.+'
    compile 'com.parse.bolts:bolts-android:1.+'

    compile ('com.facebook.android:facebook-android-sdk:4.4.0') {
        exclude module: 'bolts-android'
    }

    compile 'com.edmodo:cropper:1.0.1'

}

@grantland
Copy link
Contributor

At the moment the following should work:

dependencies {
  compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'

  // any non-parse/fb related dependencies
}

Notes:

  • It's generally a bad idea to use wildcard versioning such as 1.+, since you'll never know what version you're using and things might break unexpectedly if a dependency gets updated with a breaking change that you're unaware of.
  • The latest ParseFacebookUtils version is 1.10.4, not 1.10.3
  • compile fileTree(dir: 'libs', include: ['*.jar']) is not needed unless you really need to include any JARs. Do you have anything in your libs directory?

In my dependencies, I included both parse-android and parsefacebookutils, which the parse website says should cause a DexException but I didn't get one.

This shouldn't be a problem, could you point me to the resource that says it would be?

When I include only parsefacebookutils, it does not seem to be able to locate the standard parse library.

This shouldn't be an issue. What are the errors your seeing and where?

Somehow these steps made it work...

Can you confirm whether or not you're having issues still?

@heliumb
Copy link

heliumb commented Jan 19, 2016

grantland, thanks for all the help! It is working for me, but I do have to include both the parsefacebookutils and parse-android dependencies. When I include only parsefacebookutils, it is unable to import anything from the standard parse library - i just get complier errors on everything to do with Parse in my code.

The parse link that says it should create a DexException to have both parse-android and parsefacebookutils at the same time is https://parse.com/docs/android/guide under Users->Facebook Users->Setup->Step 4 where it says "Add com.parse:parsefacebookutils-v4-android:1.10.3@aar to your Gradle dependencies. This includes the contents of the Parse-*.jar and the com.parse:parse-android:1.10.+ repository, so be sure to remove as needed to prevent duplicate dependencies, otherwise a com.android.dex.DexException will be thrown."

Not sure why I need to include both (regular parse-android and parsefacebookutils) but I guess as long as it works, it's fine with me. I will get rid of the wildcard versioning, thanks for the tip!

@grantland
Copy link
Contributor

strange that you need both, but you shouldn't have a problem with both.

the problem outlined there is that you'll get a DexException when using the Maven dependencies alongside the Parse JAR, but you won't with the Parse Maven dependency.

@heliumb
Copy link

heliumb commented Jan 19, 2016

got it. thanks again!

@heliumb
Copy link

heliumb commented Jan 19, 2016

actually can i ask one more question - where would i look up the most current version of parse.bolts and parse.android so i know which ones to include (to get rid of the wildcard thing)?

@grantland
Copy link
Contributor

we try to keep the repository READMEs up-to-date, but looking them up on http://search.maven.org/ is always reliable.

@heliumb
Copy link

heliumb commented Jan 19, 2016

perfect, thanks!

@JulianoEngineer
Copy link

I have the same problem, but i dont know why for me the solutions don't work. @heliumb / @grantland Could you post your full solution for the grandle file?

I'm using this:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile project(':facebook')
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.chrisbanes.photoview:library:1.2.3'
    compile 'com.google.android.gms:play-services-ads:8.3.0'
    compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'
    //compile 'com.parse:parse-android:1.+'
    //compile 'com.parse.bolts:bolts-android:1.+'

    //compile 'com.parse:parsefacebookutils-v4-android:1.10.3@aar'
    //compile 'com.parse.bolts:bolts-android:1.+'
    //compile 'com.parse:parse-android:1.12.0'

    //compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}

Thanks.

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

No branches or pull requests

5 participants