-
Notifications
You must be signed in to change notification settings - Fork 144
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
NoClassDefFoundError exception #65
Comments
Is that in the sample app? |
No, it happens using my own implementation in a Preference object on the prefCustomPath = findPreference("prefCustomPath");
prefCustomPath.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
final Intent chooserIntent = new Intent(context, DirectoryChooserActivity.class);
final DirectoryChooserConfig chooserConfig = DirectoryChooserConfig.builder()
.newDirectoryName("Dir")
.allowReadOnlyDirectory(false)
.allowNewDirectoryNameModification(true)
.build();
chooserIntent.putExtra(DirectoryChooserActivity.EXTRA_CONFIG, chooserConfig);
startActivityForResult(chooserIntent, REQUEST_DIRECTORY);
return false;
}
}); Thanks. |
Well, it fails when using the Fragment too (same Logcat). prefCustomPath.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
final DirectoryChooserConfig chooserConfig = DirectoryChooserConfig.builder()
.newDirectoryName("Dir")
.allowReadOnlyDirectory(false)
.allowNewDirectoryNameModification(true)
.build();
final DirectoryChooserFragment chooserDialog = DirectoryChooserFragment.newInstance(chooserConfig);
chooserDialog.show(getFragmentManager(), null);
return false;
}
}); |
Yeah, this has nothing to do with the code there. Something with your build is broken, it seems that the transitive dependencies aren't included. It is declared as a dependency of the library though:
|
Fixed. I have included this lines in my own repositories {
mavenCentral()
maven { url 'http://guardian.github.com/maven/repo-releases' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
...
compile ('net.rdrei.android.dirchooser:library:3.0@aar') { transitive = true; }
} |
👍 Thanks for documenting that! |
After all the fixes by @javiersantos there is still a new error message: Error:Execution failed for task ':app:dexDebug'.
|
What about adding this to your defaultConfig {
multiDexEnabled true
} I think it happens because you have exceeded the 65K methods dex limit imposed by Android. |
@javiersantos thanks for your swift support. But your suggested insertions lead to some other nasty messages: Error:duplicate files during packaging of APK D:\My Documents\AndroidStudioProjects\RayStoryBoard\app\build\outputs\apk\app-debug-unaligned.apk |
I Don't know if it's just me or what, but I couldn't find a valid Maven repoistory on Guardian's "gu.options" github directory. |
[BASICS] It's a great library BTW. |
Another option for including co.gu.option is adding this to your build.gradle dependencies { |
awesome work great |
Thanks. It worked by adding jar file. |
As this thread is quite long, here the summary of what solved it for me:
Hope it helps somebody else when checking this issue. |
Yep @Phantast's solution is the best one. adding transitive=true will grow your apk by ~800kb |
How about adding the resolution by @Phantast to the readme start-screen? |
It is quite some time ago since I faced this issue. Go ahead and add it. ;) I dont feel safe enough to make these changes. |
This happens when pressing the button with the Intent.
Logcat:
The text was updated successfully, but these errors were encountered: