Android: Conversion to Dalvik format failed: Unable to execute dex: null - java

I'm trying to use the SmugFig SmugMug API on Android. It was designed for J2SE I would imagine, so I'm not sure it will even work on Android, but I figured it was worth trying as opposed to trying to create my own API.
When I load the project though, I get the following error:
Conversion to Dalvik format failed: Unable to execute dex: null
It doesn't say what package it fails on, just "Android Packaging Problem", but it did not do this before I added SmugFig and it's dependency JARS to the build path.
Where should I look? Or does this mainly me that it just won't work with those libraries?

I found a blog entry that says increase the memory allocated in eclipse.ini to this:
-Xms128m
-Xmx512m
or something higher, but this didn't do it for me.
However, I found another post that suggested doing Project > Clean and that fixed it for me.
I think it happens when you shut down Eclipse w/o shutting the emulator down first. Pretty lame bug. Spent a few hours digging for the solution this morning...grrrrrrr :-(

Go to Project » Properties » Java Build Path » Libraries and remove all except the "Android X.Y" (in my case Android 1.5). click OK. Go to Project » Clean » Clean projects selected below » select your project and click OK. That should work.
It is also possible that you have a JAR file located somewhere in your project folders (I had copied the Admob JAR file into my src folder) and THEN added it as a Java Path Library. It does not show up under the Package Explorer, so you don't notice it, but it does get counted twice, causing the dreaded Dalvik error 1.
Another possible reason could be package name conflicts. Suppose you have a package com.abc.xyz and a class named A.java inside this package, and another library project (which is added to the dependency of this project) which contains the same com.abc.xyz.A.java, then you will be getting the exact same error. This means, you have multiple references to the same file A.java and can't properly build it.

After the Eclipse DDMS update 8.0.0 came with the release of Android 2.3 this error suddenly appeared.
None of the above suggestions helped, but it turned out that the root of the problem was a referenced project (a few classes shared between the server and client sides).
Once I removed the project reference and built and included a jar of the once referenced project the problem ceased to exist.
Seems like something went rogue in DDMS 8.0.0 with referenced projects.

What worked for me was removing the android.jar reference in
Configure Build Path -> Java Build Path -> Libraries
Leave the Android 3.0 library reference.

its simply because of the Heap size occupied by some JAR files...which can be removed manually...
else the best option is to modify the Eclipse.ini file in the eclipse folder.....
add -Xmx1024m to the file to make the memory size to 1 GB ...it woul work for sure.....

Steps that help me to remove this error
remove user libraries(external libraries).
clean the project
again add the external library
build the project
run the project.
Hope this will be helpful to you.
Thanks.

http://groups.google.com/group/android-developers/browse_thread/thread/3911749addce534d
They are working on pushing a fix now for 2.3
Edit: This has been fixed for 2.3 , go get the update via eclipse.

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-XX:MaxPermSize=512m
-vmargs
-Xms512m
-Xmx1024m
works for me https://groups.google.com/forum/?fromgroups=#!topic/phonegap/yWePvssyiLE

Ensure you don't reference the same project within a jar and eclipse. For instance, you have a project called myproject in eclipse. Your android project references both myproject project and the jar generated from it. This will give an error when you try to dex as it tries to dex against the generated classes from myproject and from the myproject.jar

Only this solve my problem .Project > Clean

Here they suggest that these error is caused by huge .java files.
I had the same problem and incrementing the memory allocated works for me.

I helper to remove /home/user/.android folder.
OS: Debian Wheezy 32bit

Absolutely none of the previously mentioned "fixes" have worked for me, which comes as no surprise because they aren't even addressing the problem to begin with.
The bug itself stems from a conflict with Proguard. Here is the bug report: http://code.google.com/p/android/issues/detail?id=18359 And to fix it, you simply need to manually update Proguard: http://sourceforge.net/projects/proguard/files/latest/download?source=files

For projects which uses New Relic
Update New Relic via "Update New Relic" under Project r'click -> Update New Relic. This worked for me.

Related

Lombok does not work for Eclipse Neon

I downloaded lombok.jar (lombok-1.16.14.jar) put it into my Downloads. Then I clicked on this jar, the execution correctly identifies the Eclipse instances on my MacOS and then I selected the instance I want. Lombok is also specified in the pom.xml
org.projectlombok
lombok
1.16.14
provided
In eclipse.ini I got the addition:
-javaagent:../Eclipse/lombok.jar
lombok.jar was added to the same directory as eclise.ini
/Applications/Eclipse.app/Contents/Eclipse
I am still getting setter/getter errors in Eclipse Problems despite that my mvn build works fine.
The code for a User:
#Entity
#Getter
#Setter
#NoArgsConstructor
#AllArgsConstructor
#EntityListeners(UserListener.class)
public class User implements Serializable, UserDetails {
...
The error:
The method getRole() is undefined for the type User
Since you have already added the .jar to your lib folder, then go to the lib
and execute java -jar lombok-1.16.4.jar, you'll see a wizard, specify the location of your eclipse.ini, after you are done with this your eclipse.ini file should look like this:
-vmargs
...
-javaagent:lombok.jar
-Xbootclasspath/a:lombok.jar
For me this just worked fine but I found in other answers that:
You should not just "restart" Eclipse, go to File -> Exit and then open it again. taken from here
Don't forget to do a mvn clean just to make sure that you recompiled your classes. taken from here
After all this you should also right-click on your project, then Maven -> Update Project taken from here
There is a manual way to install lombok under eclipse, I do not checked it, but it maybe helps you -
copy lombok.jar to where your eclipse folder where is the eclipse.ini
open eclipse.ini,put at end the below two lines below and save it
-Xbootclasspath/a:lombok.jar
-javaagent:lombok.jar
restart eclipse.
I had the problem, that the link, which I used to start eclipse, didnt respect the eclipse.ini file.
My environment is:
IDE: Version: Neon.0 Release (4.6.0)
OS: Ubuntu 16.04.2 LTS
The installation routine java -jar lombok-1.16.16.jar works quite well. I.e. it adds the reasonable line -javaagent:<ABSOLUTE_PATH_TO_ECLIPSE_INSTALLATION>/lombok.jar to the eclipse.ini.
But if I start eclipse by using my desktop-shortcut, it starts without lombok (checked by looking at "Help"->"About Eclipse").
If I start eclipse by executing the executable eclipse next to the eclipse.ini file, lombok launches like a charm.
Hence I checked my desktop shortcut (e.g. ~/.local/share/applications/eclipse.desktop) and indeed, it started eclipse without reflecting the eclipse.ini.
Instead it uses something like /usr/bin/java -jar org.eclipse.equinox.launcher.jar ... to start eclipse.
So the solution was to replace the old Exec line in the desktop shortcut by:
Exec=/opt/eclipse/neon/eclipse
where /opt/eclipse/neon/ is the place where I have installed eclipse.
Antoniolazaro has given a solution for Eclipse Neon issue on MacOS
When I put the complete path, it works on Mac Os.
-javaagent:/Applications/Eclipse.app/Contents/Eclipse/lombok.jar
Resource Link:
https://github.com/rzwitserloot/lombok/issues/1173
And the lombok project owner rzwitserloot has given 3 suggestions for checking
Can you give us the complete path, from root, of your eclipse
install? Starting with 1.16.14, the installer should still find
eclipse even with the funky paths that the OOM installer comes up
with. I have no idea why the installer isn't finding your eclipse
automatically, here. I can't reproduce this on my mac.
The lombok uninstaller has the same 'find eclipses' capability as
the installer. Mac doesn't have a registry and we aren't going to
dump a bunch of crud in your homedir just to keep track of where we
installed your lombok; we like it that way: No cruft. So, that part
(that the uninstaller can't find a custom-install location and
requires you to again specify it) is not a bug.
You still have to add lombok.jar to your project as a dependency
same as any other third party dependency (something like guava, for
example). It's not clear from your problem description if you
actually did that.
Resource Link:
https://github.com/rzwitserloot/lombok/issues/1310
Even after following the below steps(try the steps given below first) , if it doesn't works, one issue can be that you are using the eclipse from the desktop , not from the folder where eclipse is installed. Running eclipse from the desktop sometimes is unable to load the .ini file, hence lombok won't run. So, try running the eclipse from the folder where you have installed it.
Steps:
1. Give the lombok dependency in the pom and build it.
The lombok.jar is usually downloaded in the folder .m2/repository/org/projectlombok/lombok/1.x.y
Install the jar in the folder "java -jar lombok-1.x.y.jar"
Then it will ask you to select the IDE. Browse to the eclipse installation
folder and select eclipse from there.
Now your eclipse installation folder, should contain the lombok.jar and eclipse.ini should contain the line
-javaagent: /lombok.jar
Run the eclipse from the installation folder. Clean and rebuild the project.
It should work now!
try #Data annotation for the class.
public #Data class user{
\\do stuff
}
For me, downloading the latest Eclipse Neon, i.e. Neon 3, fixed the problem
My environment is:
IDE: Version: Neon.3 Release (4.6.3)
OS: Ubuntu 16.4
It works for me when i do this steps below:
1. copy `lombok.jar` to where your eclipse folder where is the `eclipse.ini` ;
2. open `eclipse.ini`,put at end the two lines below with full lombok path and save it:
-Xbootclasspath/a:/DEV/Tools/IDE/eclipse/jee-neon/lombok.jar
-javaagent:/DEV/Tools/IDE/eclipse/jee-neon/lombok.jar
3. restart `eclipse` in command line (when i try run with exist link in launcher it's not work)
4. rebuild your projects
As far as I am concerned, I use a "Chocolatey" distribution of Eclipse on Windows.
It does not change much. But for those of you who are not admin of their desktop, it might be a hassle, because Chocolatey installs softwares in C:\ProgramData\... which is an "admin" directory.
In other words, you may need to modify your shortcut's property "start in" which will not be possible unless you are admin of your desktop.
The trick that worked for me here was to create a new shortcut, which has the correct "start in" property to start eclipse in the directory where the eclipse.ini is...
Then recompile using eclipse, then work on your project a bit until eclipse realizes that lombok was installed...
Cheers
After installing lombok, you need to copy lombok.jar into your project or add dependency in maven configuration xml file
exit the eclipse and then go to the eclipse directory and open eclipse.ini and add -clean on a top and rerun the eclipse. hope your problem is solved.
To elaborate on the above replies:
PROBLEM:
In my scenario:
I installed SpringBoot STS under Eclipse Photon,
I created aSpring Boot/Gradle build project, and I got the "undefined method" error using Lombok #Data.
Environment: Ubuntu Linux 18.04.
SOLUTION:
cd ~/.gradle/cache/.../lombok/...;
java -jar lombok-1.16.22.jar
NOTE:
java -jar lombok*.jar brings up a GUI that
Allows you to select which Eclipse install to update.
Updates eclipse.ini AND...
Copies lombok-xyz.jar into the Eclipse install folder, as lombok.jar.
Eventhough there are already a lot of answers here none of the given answers solved my problem, so I'll add my information here as well in case it might help someone:
My setup is:
Win10 Home,
Eclipse Version: Oxygen.3a Release (4.7.3a),
Eclipse Build id: 20180405-1200,
Add lombok to my pom.xml
mvn clean install
close eclipse
navigate to my .m2 folder .m2\repository\org\projectlombok\lombok\1.18.6>
run: java -jar .\lombok-1.18.6.jar (or whatever version you have
Install lombok
Now it's getting intresting. The installation added the following to my eclipse.ini:
-javaagent:lombok.jar
How ever it placed them at the bottom of my .ini file. So it looked liked this.
--launcher.appendVmargs
-vmargs
-...
--add-modules=ALL-SYSTEM
-javaagent:lombok.jar
I assumed that -javaagent:lombok.jar belongs under -vmargsso I put it at the bottom of --launcher.appendVmargs. That didn't work either though. But when I put -javaagent:lombok.jarright below vmargs it works. Ultimately my eclipse.ini looks like this:
--launcher.appendVmargs
-vmargs
-javaagent:lombok.jar # lombok works for me if this is here
-Declipse.p2.max.threads=10
- Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=#user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
#-javaagent:lombok.jar | lombok doesn't work for me if its placed here.
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
Not sure why this issue orcurrs but maybe it helps you. If you are under macOS remember to add -Xbootclasspath/a:lombok.jalike other answers in this thread suggest.
I have faced this issue recently and all the above solutions mentioned by the above users didn't work. The problem I have was there are special symbols like '$' in path(This can be found in last line of eclipse.ini file) to eclipse. Due to the same reason lombok cannot identify the file and append the necessary two lines in eclipse.ini file. Removing the special characters like '-' , '$', '_' in my eclipse path fixed mu problem
For, after installing lombok like mentioned above I had to do right click on your project folder -> Run as -> Maven clean. Ne the .jar is deteced and properly used
Copy and paste the lombok jar into the eclipse installation folder.
Run the command "java -jar lombok-.jar".
A GUI opens.
Check the IDE listed in the installer.
This entry should be available in the eclipse.ini file "-javaagent:<>".
Restart Eclipse to find the changes which starts listing the associated getters, setters in your java file.
Simply add to eclipse.ini file this statement (or check if you have):
-Xbootclasspath/a:lombok.jar
-javaagent:lombok.jar
Attention please, usually you have only:
-javaagent:lombok.jar
Obviously restart your eclipse
For Eclipse neon on Mac (High Sierra) :
Use lombok version 1.16.14 or above.
Installer launches by running (double clicking) lombok-1.16.14.jar file itself. It should detect installed versions.
On the Mac, it detects Eclipse.app only from Applications directory. If not, you can tell the jar where to find it in the popup dialog. Note that you should point it to eclipse.ini file (Eclipse.app -> Show app contents -> eclipse -> eclipse.ini)
Lower versions of lombok do not work on High Sierra. They don't detect installed eclipse instances.
Finally remember to restart eclipse (via File -> exit) and run maven update project.
I might be late to reply here but for future references adding this answer,
Please don't use Lombok v1.18.14 as it will crash eclipse. It is mentioned in changelogs. Use next version v1.18.16.
Simple way to setup lombok to eclipse is mentioned in this answer https://stackoverflow.com/a/69332138/3637115

Libgdx Conversion to dalvik format failed with error 1 [duplicate]

In my Android application in Eclipse, I get the following error.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/xmlpull/v1/XmlPullParser;
....
Conversion to Dalvik format failed with error 1
This error only appears when I add a specific external JAR file to my project. I searched for a long time for a possible solution, but none of them work.
I even tried to change to Android 1.6 instead of 1.5 (the current version I use).
Go to Project » Properties » Java Build Path » Libraries and remove all except the "Android X.Y" (in my case Android 1.5). click OK. Go to Project » Clean » Clean projects selected below » select your project and click OK. That should work.
It is also possible that you have a JAR file located somewhere in your project folders (I had copied the Admob JAR file into my src folder) and THEN added it as a Java Path Library. It does not show up under the Package Explorer, so you don't notice it, but it does get counted twice, causing the dreaded Dalvik error 1.
Another possible reason could be package name conflicts. Suppose you have a package com.abc.xyz and a class named A.java inside this package, and another library project (which is added to the dependency of this project) which contains the same com.abc.xyz.A.java, then you will be getting the exact same error. This means, you have multiple references to the same file A.java and can't properly build it.
In other ways this may be occurred if you accidentally or knowingly edit/ add any thing in the class path file manually .In certain cases we may add android.jar path manually to classpath file for generating java doc.On removing the that after javadoc generated code will works fine.Please check this too if any one still occurs.
I solved the problem.
This is a JAR file conflict.
It seems that I have two JAR files on my buildpath that include the same package and classes.
smack.jar and android_maps_lib-1.0.2
Deleting this package from one of the JAR files solved the problem.
Windows 7 Solution:
Confirmed the problem is caused by ProGuard command line in the file
[Android SDK Installation Directory]\tools\proguard\bin\proguard.bat
Edit the following line will solve the problem:
call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %*
to
call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
You can solve this issue easily (with Eclipse Android Developer Tools, Build: v22.0.1-685705) by turn off menu > "Project" > "Build Automatically" while exporting (un)signed Android application. After that, don't forget to turn it on again.
If you have ADT revision 12+, you should update your proguard from 4.4 -> 4.6 (as described here). Also, you should leave ...\bin\proguard.bat file in the orginal form.
Just download it from the web, and copy lib folder from downloaded package to the :
[Android SDK Installation Directory]\tools\proguard\lib
EDIT (new solution):
It looks like the previous solution is only a bypass. I managed to finally fix the problem permanently:
In my case there was a mismatch in android-support-v4 files in my project and in the Facebook project that is referenced in my project.
I found this error by performing Lint Check (Android Tools / Run Lint: Check for Common Errors)
My previous solution:
I've tried any possible solution on this site - nothing helped!!!
Finally I've found an answer here:
https://groups.google.com/forum/#!topic/actionbarsherlock/drzI7pEvKd4
Easy steps:
Go to Project -> uncheck Build Automatically
Go to Project -> Clean... , clean both the library project and your
app project
Export your app as a signed APK while Build Automatically is still
disabled
Here's another scenario, and solution:
If you run into this problem recently after updating the ADT for Eclipse:
In your app project, check for any linked source folders pointing to your library projects (they have names in the form "LibraryName_src").
Select all those projects, right-click, choose "Build Path"->"Remove from Build Path".
Choose "Also unlink the folder from the project", and click "Yes".
Clean, rebuild and redeploy the project.
It seems the reason is that some previous version of ADT linked Library project source folders to the "child" projects, and the current ADT/Dex combination isn't compatible with that solution anymore.
EDIT: this is confirmed by an Android Dev Blog entry, specifically this one - see the 8th paragraph onwards.
Go to Project and then uncheck "Build Automatically".Then try to export the project and the error is gone.
This can also be caused if you have added Android.jar file to your build path, perhaps by an accidental quick fix in Eclipse. Remove it with right clicking Project -> build path -> configure build path -> android.jar, remove.
Simply cleaning the project has worked for me every time this error has come up.
My own and only solution that I found today after four hours of testing all the solutions, is a combination of many solutions provided here:
Delete project from Eclipse
Delete files in \bin and \gen from project folder
Remove references to libraries into .classpath file in root project folder
Restart Eclipse with command line : eclipse -clean
Import project
Right click on project - select Properties > Java Build Path > Libraries and remove everything else than Android XX.Y
Finally clean project, wait for automatic Building or Build it
Launch and now it works! At least for me...
I tried every step at a time and many combinations, but only the succession of all steps at once made it! I hope I won't face this again...
Just for the other people who still have this problem and they have tried the above answers but still getting the error (which was my case), then my solution was to delete the project from Eclipse and re-import it again.
This made the Android library to be added again to my referenced libraries, so now I have two Android JAR files referenced, hence I deleted one of them and now it compiles fine.
Solution: Delete the project from Eclipse IDE and then re-import it again, then check for the above solutions.
Ran into this problem myself today. Cleaning and rebuild did not fix the problem. Deleting and reimporting the project didn't help either.
I finally traced it back to a bad additions to my .class file. I think this was added by the plugin tools when I was trying to fix another problem, removing it got rid of the "Conversion to Dalvik format failed with error 1" build error:
<classpathentry kind="lib" path="C:/dev/repository/android-sdk-windows/platforms/android-3/android.jar">
<attributes>
<attribute name="javadoc_location" value="file:/C:/dev/repository/android-sdk-windows/docs/reference"/>
</attributes>
<accessrules>
<accessrule kind="nonaccessible" pattern="com/android/internal/**"/>
</accessrules>
For me, an extra JAR reference had appeared in my build path. I deleted this, and it works now.
My problem was caused by ADT version 12.0 and ProGuard integration.
This bug is well documented and the solution is in the documentation
Solution is in here
ProGuard command line
Updating Proguard to latest version solved it for me.
My proguard path was C:\Program Files (x86)\Android\android-sdk\tools\proguard\
I downloaded the new version from here
and replaced both bin and lib folders
THANK GOD!
I've dealt with this problem when using Sherlock ActionBar library in my project.
You could do the following step, it's work for me.
Right click to your project, select properties.
A dialog will show up, select 'Java build path' on the left menu.
Remove 'Android dependencies' and 'Android private libraries' on the right panel then click OK
Clean your project (select menu Project --> Clean)
Right click your project, select Android Tools -> Fix project properties
Clean project once again.
Restart your computer
Open eclipse and Export apk
Hope that will help you.
In my case the problem is actually with OpenFeint API project. I have added OpenFeint as library project:
.
It is also added into build path, ADT tools 16 gives error with this sceneario.
Right click on your project and click build path, configure the build path and then see the image and remove your project OpenFeint from here and all is done :)
I found something else. Android uses the /libs directory for JAR files. I have seen the "Conversion to Dalvik format failed with error 1" error numerous times, always when I made a mistake in my JAR files.
Now I upgraded Roboguice to a newer version, by putting the new JAR file in the /libs directory and switching the class path to the new version. That caused the Dalvik error.
When I removed one of the Roboguice JAR files from the /libs folder, the error disappeared. Apparently, Android picks up all JAR files from /libs, regardless of which ones you specify in the Java build path. I don't remember exactly, but I think Android started using /libs by default starting with Android 4.0 (Ice Cream Sandwich, ICS).
In general, it seems that this problem comes when there are unnecessary JAR files in build path.
I faced this problem while working on IntelliJ IDEA. For me it happened because I added JUnit and Mockito libraries which were being compiled at runtime. This needed to be set to "testing" in module properties.
None of previously proposed solutions worked for me. In my case, the problem happened when I switched from referencing a library source code folder to using the library JAR file.
Initially there was an Android library project listed under the Android application project Properties\ Android page\ Library section, and the library compared also in project explorer tree as a link to the library source directory.
In the first place, I just deleted the directory link from the project tree and I added the JAR library to the build path, but this caused the exception.
The correct procedure was (after changing back the build path and putting back the reference to the library source):
properly remove the library source directory link by actually removing the reference from application project Properties\ Android page
adding the library JAR to the application project build path as usual.
None of the listed solutions worked for me.
Here's where I was having a problem:
I added the jSoup external JAR file to my project's path by first putting it in a source folder called "libs", and then right clicking on it, Build Path -> add to build path. This threw the Dalvik conversion error. It said I had "already included" a class from that JAR file. I looked around the project's directory and found that the place where it was "already included" was in fact the bin directory. I deleted the JAR file from the bin directory and refreshed the project in Eclipse and the error went away!
All the solutions above didn't work for me. I'm not using any precompiled .jar. I'm using the LVL and the Dalvik errors where all related to the market licensing library.
The problem got solved by deleting the main project and reimporting (create a new project from existing sources).
I had the same problem and none of these solutions worked.
Finally, I saw in the console that the error was due to duplicated class (one in the existing project, one in the added jar file) :
java.lang.IllegalArgumentException: already added: package/MyClassclass;
[2011-01-19 14:54:05 - ...]: Dx1 error; aborting
[2011-01-19 14:54:05 - ...] Conversion to Dalvik format failed with error 1
So check if you are adding jar with duplicated classes in your project.
If yes, try removing one of them.
It worked for me.
Often for me, cleaning the project DOES NOT fix this problem.
But closing the project in Eclipse and then re-opening it does seem to fix it in those cases...
I ran into this problem but my solution was twofold.
1.) I had to add an Android target version under project -> properties -> Android.
2.) I didn't have all google 'third party add-ons'. Click in AVD SDK manager under available packages -> third-party add-ons -> Google Inc. I downloaded all of the SDKs and that solved my issue.
I am using Android 1.6 and had one external JAR file. What worked for me was to remove all libraries, right-click project and select Android Tools -> *Fix Project Properties (which added back Android 1.6) and then add back the external JAR file.
I ran into this problem because the Android-Maven-plugin in Eclipse was apparently not recognizing transitive references and references referenced twice from a couple of projects (including an Android library project), and including them more than once. I had to use hocus-pocus to get everything included only once, even though Maven is supposed to take care of all this.
For example, I had a core library globalmentor-core, that was also used by globalmentor-google and globalmentor-android (the latter of which is an Android library). In the globalmentor-android pom.xml I had to mark the dependency as "provided" as well as excluded from other libraries in which it was transitively included:
<dependency>
<groupId>com.globalmentor</groupId>
<artifactId>globalmentor-core</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- android-maven-plugin can't seem to automatically keep this from being
included twice; it must therefore be included manually (either explicitly
or transitively) in dependent projects -->
<scope>provided</scope>
</dependency>
Then in the final application pom.xml I had to use the right trickery to allow only one inclusion path---as well as not explicitly including the core library:
<!-- android-maven-plugin can't seem to automatically keep this from being
included twice -->
<!-- <dependency> -->
<!-- <groupId>com.globalmentor</groupId> -->
<!-- <artifactId>globalmentor-core</artifactId> -->
<!-- <version>1.0-SNAPSHOT</version> -->
<!-- </dependency> -->
<dependency>
<groupId>com.globalmentor</groupId>
<artifactId>globalmentor-google</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<!-- android-maven-plugin can't seem to automatically keep this from
being included twice -->
<exclusion>
<groupId>com.globalmentor</groupId>
<artifactId>globalmentor-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.globalmentor</groupId>
<artifactId>globalmentor-android</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
In my case
project->properties->java build path -> in order and export tab -> uncheck android-support-v4.jar
Just clean the project
If this does not work try the other solutions

Error: Archive for required library cannot be read or is not a valid ZIP file.

I am having trouble setting up the build path of my java project. I am currently in a Co-Op IT position so I am somewhat new to all this. My background is mostly in C++ and I am learning java on the fly. I am also somewhat new to Eclipse (Kepler service release 1).
I am working on a bug on an existing program and need to get the program to build so I can work on it. When I add all of the external .jar files that I know for a fact are the right ones, I am getting this error on two of them :
"Archive for required library: '(location of file)' cannot be read or is not a valid ZIP file"
Two of the other full time guys on my team have gotten the program to run with those exact same .jar files, one running Eclipse Indigo and the other running the same Kepler version as myself. I also was able to open the two .jar files manually and everything appears to be there. After every trial trying to fix this, I have refreshed, cleaned and restarted eclipse. The two other full time guys said they have never seen this error. I would like to get some insight on this from anyone who has any similar experiences so that I don't have to use up much more of their time.
I Had this issue, just fixed by deleting .jar files from Libs directory then copy->paste original Jars again. Then do a complete clean -> rebuild
I got this problem, took help from following link solution
which basically says to
1. delete the corresponding maven download folder
2. maven>update project in eclipse
In my case I deleted hibernate folder, since i was getting error related to hibernate-validator.jar
I had the same error here. What I did to resolve the problem was close and reopen the project.
I got the same problem and found out the root cause is the JDK in my linux shell is set to 1.6, but in the eclipse, the JRE is 1.7.
Using Eclipse without m2e features (Standard Edition) helped me.
Similar problem with Spring toolsuite
Just came across this link that shows a way to get unblocked.
In preferences dialog box go to
Java->Compiler->Building
and change Incomplete build path to "Warning" (from default "Error")
This can be done globally (for all projects), or on a project by project basis.
Check the jar's file permissions/ownership.
I had the same issue on eclipse installed on Linux and fixed it by setting the file permissions right.
In my case ..worked after removing this from spirngrest-servlet.xml file.
<prop key="net.sf.ehcache.configurationResourceName">/Sysehcache.xml</prop>
I think it had to do with default location of maven repository of jar files.
Been at it for 3 days. finally solved it.Hope it helps anyone.Just look for similar think in your spirngrest-servlet.xml file. Good luck.
I just tried the following and it worked:
Close eclipse as there might be some files eclipse is accessing and you won't be able to delete.
Delete all the libraries installed in the maven repositories folder: ".m2/repository"
Open eclipse and update your project(Alt+F5).
What did we just do? : This is possible that the existing libraries in the local repository are erroneous and maven tries to open which it fails in. We have now deleted the already existing library and with the project update, Maven will download the library again which should resolve the issue.
i fixed this by just deleting everything inside of the /Users/username/.m2/repository folder. not the repository folder itself. and then running a mvn clean package in the project folder

RCP's exec launcher can't find companion shared library on launch, but starts with click on org.eclipse.equinox.launcher_1.2.0.v20110502.jar

I'm building an Eclipse RCP application against Eclipse 3.7.1 and Java 1.6.
I'm also using Tycho to build, and have set up my RCP according to the Tycho tutorial from the EclipseCon 2011, to which I've stuck slavishly, apart from project names.
The application builds fine up until I get to Step 5 (adding a p2 repo, then adding a .product file. Well, it still builds fine, and everything is where it should be, but I cannot start the RCP by clicking on the .exe file from the repository in the workspace.
All I get is the old dreaded "The [RCP] executable launcher was unable to locate its companion shared library" error popup.
First of all I thought I might have set up the CLASS PATH incorrectly, but when I open a console and type javaw or java -version anywhere, it all works.
Also, when I go to the pluginsfolder in the p2 repository for the RCP in the workspace, and double-click on org.eclipse.equinox.launcher_1.2.0.v20110502.jar, the RCP starts, albeit without the splash screen.
This must surely mean my Java set up is correct, and it's not a class path problem?
I'm not sure where this problem might lie (I have a plugin, a feature, a product, a repository, and a parent package with the main pom), so if you let me know your suspicions where the error might come from, I'll be more than happy to post respective XML, build.properties, screenshots and what have you. Unless this is a common error with a common solution.
Many thanks in advance!
Oh yea: Windows 7 (64-bit), JDK and JRE both 64-bit as well, Eclipse EE 3.7.1 (I chose that because it contains the most plugins I'll need later by default).
UPDATE
I'm attaching my CLASS PATH Settings for reference.
User variables
CLASS PATH: C:\Program Files\Java\jdk1.6.0_30;.;
System variables
JAVA_HOME: C:\Program Files\Java\jdk1.6.0_30
Path: %JAVA_HOME%\bin;
UPDATE 2
When I let Tycho create a ZIP file in the p2 repository, and copy that from the repo to another location, unzip it and run the .exe, the application starts without problems. So I guess this query is partially solved, but I'd still be interested to hear why I wouldn't be able to start the application from the repository...
Today I came across the same issue. I guess you could find the solution here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=176084
In short, the problem in my case was, that the org.eclipse.equinox.launcher_1.2.0.v20110502.jar must be unpacked in the plugins folder under the folder name: org.eclipse.equinox.launcher_1.2.0.v20110502
... hope that helps!
In my case the error The [RCP] executable launcher was unable to locate its companion shared library was because my path was too long.
Same issue I was facing from yesterday. Today, I have changed path of project(git clone) and build it and able to run RCP executable.
I think this issue was because of path too long.

Conversion to Dalvik format failed: Unable to execute dex: Java heap space

I have added a 2.45mb jar file to my Android eclipse project and now I continue to get "Conversion to Dalvik format failed: Unable to execute dex: Java heap space" no matter what I do.
I have researched online, and was informed to update my eclipse.ini to increase my Java VM heapsizes. I have done this for all the values in eclipse.ini and I continue to get the build error.
Any ideas?
Modify the -XmsAm and -XmxBm paremeters in eclipse.ini so that they are large enough. The default is -Xms40m -Xmx384m. Try changing them both to -Xms512m -Xmx512m and restart eclipse to see if that helps. If not, continue to increase the values and restart eclipse until either one of two things happens:
Your build completes.
Eclipse won't restart because you don't have enough memory.
eclipse.ini is located at /etc/eclipse.ini in Ubuntu (assuming you installed Eclipse from the Ubuntu repositories).
For MAC please see:
Finding eclipse.ini is a wee bit tricky. To locate it, right-click on the Eclipse Application icon and select "Show Package Contents", then double-click on the "Contents" folder and then double-click on the "MacOS" folder, the home of eclipse.ini
https://confluence.sakaiproject.org/pages/viewpage.action?pageId=61341742
Sometimes checking the .jar library in project properties also causes this problem. In that case, try the following:
Right click your project.
Go to Properties -> Java Build Path -> Order and Export.
Uncheck the check box against your included library.
Press OK and run the project.
On doing this Eclipse will take only the classes which are needed in the code, from the jar instead of storing all the classes from the jar.
All above answers are perfect , but you can try one more thing and that is fast and easy ,
close all your unnecessary open projects in Eclipse workspace and then Restart Eclipse .
You can also increase the -XmsAm and -XmxBm paremeters in eclipse.ini .
Go to your project properties and remove your added libraries from Java Build Path hit ok,
then again re add them. I also faced this problem.By doing this I solved this issue.
Important addition:
The solution didn't work on my Windows (probably memory allocation issues), but did well on a Linux on same machine. So installation of another OS would help you or Windows re-installation.

Categories

Resources