I know this question has been asked here a few times before. But i haven't seen any possible solution yet.
Before i make the project 'Run as Android Application' , if i do not clean it, i receive the following error and have to restart Eclipse ... and clean again.
Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define
Lcom/jstun/core/attribute/MessageAttributeInterface;
com.jstun.core... is a part of my src folder, of course i can't remove it. And even if i remove that package, another package will show up as an error like:
Unable to execute dex: Multiple dex files define
Landroid/support/v4/app/ActivityCompatHoneycomb;
I've seen this error since updating to ADT 15, i'm using Eclipse Galileo on Ubuntu
Do you have any idea? Thanks for any reply!
This is a build path issue.
Make sure your bin folder is not included in your build path.
Right click on your project -> go to properties -> Build Path.
Make sure that Honeycomb library is in your libs/ folder and not in your source folder.
Include the libraries in libs/ individually in the build path.
BTW, you may want to bring in the android-support-v4 library to get Ice Cream Sandwich support instead of the Honeycomb support library.
I have encountered a similar error today and the reason was that the support library was referenced by two library projects used by my app project but with different versions.
In more details:
My app depends on 2 library projects
FaceBookSDK 3.0 -> which is referencing android-support-v4
ActionBarSherlock -> which is referencing android-support-v4 but with a modified version to support maps.
To solve the problem I had to make FaceBookSDK library depend on ABS library instead of the support library directly.
Well for me, I deleted the file in the libs folder called android support v4.jar and it all worked out. Goodluck :)
I had the same error happening and every time I fixed it, it would come back after I restarted Eclipse.
First of all, as other people said, make sure you do not have multiple copies of the same .jar file around your projects.
In my case, I had a main project that used ActionBarSherlock (among other library projects). The trick that worked for me was going into ActionBarSherlock --> Properties --> Java Build path --> Order of Export and unselecting Android Private Libraries. Then going into Project -> Clean and now you should be able to build the project correctly.
Now, for some reason, every time I restart Eclipse, it automatically enables that checkbox, so I have to repeat this process again.
Hope this helps some lost soul out there :)
Go to Project/properties and Java Built Path and unchecked the Android Private Libraries
To me, just go to Project Properties >> Java Build Path >> Order and Export. Uncheck all external library, as the image bellow. It work for me. Hope this help.
I have also faced this problem in my project. AVD is not able to reload assets,lib,res and etc folder contexts.
problem :
Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.
Then,I created new projects and copied MainActivity.java,activity_main.xml, drawable context.
Then delete old project from package explore,restart your Eclipse and AVD.
My project is now working properly.... :)
I hope this steps will help u little bit folks..!!
I have same issue, what i tried is:
List item
Open Project Build Path,
Select "Libraries" tab,
Remove all library except the Android Library
Adding all required JARs Files,
And Done!
It works for me, thanks.
If some of you facing this problem with facebook-connent-plugin for phonegap
try to remove files in bin/class/com/facebook/android directory ! -> and rebuild
As others mentioned, this occurs when you have multiple copies of the same class in your build path, or elsewhere in your setup.
I had added android-support-v4.jar to my libs/ folder, and somehow eclipse added a second copy to bin/classes/android-support-v4.jar.
You can test for this with
grep -r YourOffendingClassName YourApp | grep jar
Deleting the extra copy in bin/classes solved the problem - unsure why Eclipse made a copy there.
I got this error for another reason. I was mistaking adding both the v4 AND the v13 support library. This was not necessary for me since my minSdkVersion is 15.
I fixed it by only including the v13 support library. Also, make sure to check mark the library in your exported library build path in eclipse. I also moved it to the top.
Even after going through multiple answers, no solution worked for me.
I deleted "Android Dependencies" from the build path.
Added all the jar files again to the build path and the error was gone.
Somehow eclipse seemed to cache the things.
I'm leaving this answer for someone who gets in this scenario as I did.
I stumbled here and there before noticing that I mistakenly dragged and dropped the Support Library JAR file into my src folder and it was lying there. Since I had no idea how it happened or when I dropped it there, I could never imagine something was wrong there.
I was getting the same error, I found the problem after sometime and removed it. Project is now working fine.
The Solution for me was just to do following things:
->lib directory in your project and delete any multiple elements.
Project->Properties->Java build Path and delete any Dependency Library was added automatically and not by you! ->Apply
Restart Eclipse IDE
Now Clean the project.
Run/Debug on Device/Emulator the project ...
Good Luck
My problem at first was:
Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
1) I Right click on my project -> Android Tools -> Add Support Library
(Run my app...Didn't work so I keep it going...)
2) Right click on my project again -> Properties -> Android -> Check Android 4.1.2 (16) on Project Build Target
(Run the app again...and get this:
Unable to execute dex: Multiple dex files define Landroid/support/v4/app/BackStackState;
3) So I went to the "lib" folder on my project and delete the "old" Android.support.library.jar
(Run the app and cross fingers and...)
¡IT WORKS!
Hope it helps someone...Thanks people!
I have had this issue and that doesn't mean, that the same library is loaded many times but System is trying to load a class with the same name and possibly same package name simultaneously, i.e.
com.pack1.de and Class Geometry of library1.jar
and another
com.pack1.de and Class Geometry of library2.jar.
How should you approach?
You should analyze which methods are being used, a method of library1.jar or library2.
There are 2 Solutions,
Rename a packagename and then dalvik interprets, that they are distinct classes
Or if you want to risk, purge the class, which doesn't contain the methode, which we really use.
I hope that has clarified this often asked question.
I removed Android dependencies from build path and it worked.
This error happened to me when in my app's project I referenced a Library project in my Eclipse workspace (in my case the Facebook SDK) and at the same time included the Facebook SDK as a jar in the libs folder. Removing the library reference but keeping the jar in the libs folder removed the error.
I had same problem. I had to delete the .apk file and then it worked.
For me I deleted android-support-v4.jar from lib folder and also removed from build path.
Right click on project and go to build Path>configuration build path
Select library tab and click on support-v4 library and click on remove
Click on OK
and then clean your project and run it will work :-)
In case anyone else bangs their head on this issue like I just did:
My case involved a chain of library projects. Simply doing a project clean on all of the libraries fixed everything
I found below solution in eclipse...hope it works for you :)
Right click on the Project Name
Select Java Build Path, go to the tab Order and Export
Unchecked your .jar library's
This problem occurs when a same library is added into your project multiple times. If you haven't added the library multiple times intentionaly, check out the dependency/private libraries of the libraries you have added in your project, most probably they have already included a library which is causing this conflict.
I was also struggling to find this is issue. In my case what happened is while copying the apk to email (drag drop) - by mistake the apk was pasted in src folder in one of the packages.
After removing the apk from source folder it worked fine.
I had this problem in Intellij and it was because the ActionBarSherlock library I added to my project defined the android-support-v4.jar as a compile dependency and this jar was already included in my project so there were multiple copies/version of DEX at compile time.
The solution was to change the ActionBarSherlock module dependency for this jar to be Runtime instead of compile, as my project was already providing it.
For me the issue was that, i had added a lib project(autobahn lib) earlier and later switched the to Jar file of the same library.Though i had removed references to the older library project, i was getting this error.
Following all the answers here i checked the build path etc. But i haven't added these libs to build path manually. So i had nothing to remove.
Finally came across this folder.
bin/dexedLibs
I noticed that there were two jar files with the same name corresponding to autobahn Android which was causing the conflict. So i deleted all the jar files in the dexedLibs folder and rebuild the project. That resolved the issue.
To add the myriad of other potential sources... I had updated all the libraries in my project's lib folder but then Eclipse "helpfully" reinstalled all the original libraries. There was no longer any reference inside Eclipse to these libraries but the external dex-maker program just grabbed all the files in the lib directory and thus got two versions of several library .jar files.
git status identified the new files and git clean -f got rid of them for me (though I sometimes had to wait or restart Eclipse on Windows because it still had the files open from the copy).
ULTRA simple solution and finest:
Remove everything in Right Click Main Project's Folder -> Properties -> Java Build Path except Android X.Y (where X.Y is the version in android). Clean, and Build. Done!
Make sure before of that to have a single android-support-v4.jar.
If you are using cordova, try cordova clean command
I have a Gradle file which, whenever I load open it in IntelliJ IDEA 14.1.5, shows IDE errors for the entire file. Namely all the errors seem to be either:
java.lang.String errors
or
groovy.lang.Closure errors
I've tried clearing the file's contents and only writing the top line:
group 'com.me.blah'
but even that results in an error.
For context's sake - this is an individual module in a larger SpringBoot project. This module is a set of simple static files (with Gradle for CSS compilation, static analysis, etc), while the rest are Java modules, and are not having Gradle issues.
Can anyone think why IntelliJ would be struggling to understand this Gradle file?
I've noticed this often. When creating a new project and using the 'Gradle' template, IntelliJ seems to get it all wrong. So what I've resorted to doing is after creating a new project, delete the .idea and .iml files and re-open the project directly from the Gradle file. IntelliJ seems to better understand what is going on in this case.
For the first part of the question: group is a property, so there must be an assignment, not a function call. The right code is:
group = 'com.me.blah'
I found this suggestion in the IDEA bug tracker(IDEA-142683):
Workaround:
One can add a comment such as
//noinspection GroovyAssignabilityCheck
to suppress the warning, but this should not be necessary as these are standard every day Gradle usages.
This issue was recently updated and is marked fixed, ready for release with version 2016.2 release.
Try File | Invalidate Caches and restart. It worked for me after i mess the syntaxe somewhere else in the file.
For anyone looking for a similar fix, this boiled down to the type of the module. My module was defined in my .iml file as
type="WEB_MODULE"
I created a new Gradle module and pasted in the same contents, deleted the original, renamed the new module to have the same name as the old one, and everything worked fine. When I diffed the results the only change was that the .iml file now said:
type="JAVA_MODULE"
So there's the answer, seemingly. Change your module from "web" to "java".
For me, after trying out all this answers without result, changing the Java SDK of the project did the trick, I was on 1.8 and changed it to the newest one, but still a project level language of 8.
Hope this helps!
What I found is that this warning is from Groovy inspection of the Intelliji. So if your project is not pure groovy, you can disable this inspection by going to File -> settings -> Editor -> Inspections -> disable Groovy. Again, just a workaround.
Happened to me recently on windows. I tried all of the above but it didn't work.
What i did:
1 - I had JAVA_HOME environment variable already set. So IDEA picked that as project SDK and these warnings showed up.
2 - So, i removed the default JAVA_HOME from project SDK and manually added jdk path. Restarted and all warnings were gone.
Maybe it will help someone. Thanks.
I have a project which has shared functionality between three other projects and have linked these to existing projects as I normally would using the add project functionality of the libraries folder.
This all used to work however when I started up Netbeans yesterday it just wasn't working as in the other projects won't compile even though the projects are linked. It can recognise the packages - just the actual classes themselves were not recognised... and to add to the weirdness some of the classes are getting picked up fine.
I have checked the dist folder of the shared project and the Shared.jar file exists. Also I have checked the Jar and the other classes that are not being recognises are there also.
Any suggestions?
alt text http://inverse.seednet.eu/snaps/duvc6r.png
Solution
I had to reinstall netbeans to get this solution resolved
This is most likely a bug in 6.8, as I have ran into the same problem and I only solved it by recreating the project, was a fairly fast process, only had to re-import the sources and then add the JARs on which it depends.
To confirm this case you only have to see the imports that NetBeans did not find, and then go to the included JARs and see if the class really is there, if it is, then it should be able to find it.
Do you have AbstractCrawler.class compiled to its output location as well?
I've a strange and new issue with an eclipse 3.5 rcp application: Everything worked fine, then I changed the running system and moved a single class from one plugin to a dependent plugin. No big issue, but all of a sudden the application complains with a class not found exception (or NoClassDefFoundError - don't know exactly but will look it up and edit the post...)
I double, triple, ... checked all that I know, and made sure, that the manifest contains the dependancy with the correct version number and that the package is correctly exported in the other plugin. Eclipse jdk doesn't complain (no compiler errors/warnings) but when I debug just to the point where the class is instantiated and use 'CTRL+SHIFT+I' to inspect the 'new MyClass()' statement, the inspectors tooltip sais, that it can't resolve that class.
Any help, hint and encouraging comment is highly appreciated!
I also encountered a NoClassDefFoundError in an Eclipse 3.5 Galileo RCP app where I had a src/java folder in one plugin and needed to export a package for use by another plugin.
The solution for me turned out to be including the bin folder as part of the runtime class path. Normally it's only been necessary to include the . folder.
Solved the issue just by chance (and don't have the faintest idea whether this was a bug or a feature...):
The plugin project, where I moved the class into, had a maven-like folder structure with src/main/java and src/test/java, both folders defined as source folders.
Just because I wanted to try almost everything, I changed this structure back to the typical eclipse structure with just src as the single source folder.
And, after another 'project clean', it's running again. Strange...?
Edit
thanks for the hint, the folder structure was just a typo in this post.
After a lot more struggle - I'm quite positive that this was an eclipse issue. After 'solving' as above, the very next day the application failed to load other classes from the
same plugin and I think, after a restart of the Galileo workbench, the problems are gone.