android eclipse unable to execute dex java heap space error - android

I am so tired of this java heap space error on my eclipse whenever I build my android application.
I add 9 libraries to my android application. (Right click on project name -> Properties -> Android -> Add library).
In some forums, I find people asking to make changes in eclipse.ini file and some saying to add user library and add jars to it. And add user library to my app.
I have changed my MaxPermSize to 1024 in eclipse.ini. It didnt help
When I add user library to my app, my app is not able to recognise app_compat_v7.jar. It throws error on styles file where I use Theme.Appcompat.Light
May I know where I am going wrong ? Any help will be appreciated.

Try the following:
Right click your project. Go to Properties -> Java Build Path -> Order and Export.
And
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.
And also see this question.
Second Technique
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

Related

AndEngine could not Identify Imported Packages

I am working with andengine and I am stuck at a point, I have a project running to other system, I have new installation.
I am unable to figure out, I have imported project , in settings i have selected AndEngine as external Libraries, but still, No Auto resolve suggestion by compiler/IDE to add the reference,
Below I am attaching screen shot
Right click your project
Project Properties
Java Compiler
Compiler Compliance -> 1.6 (Source: Nicolas Gramlich, the guy who made AndEngine)
Create gen and res folder if missing (if there is already, and it still say missing, then delete and recreate it).
Right-click the project -> Properties -> Android, choose Android 4.0 if there is no target selected. Delete all library reference and add its manually again.
And always clean and build your project when you add images or change things.
Good luck!

Android eclipse bug?

I'm getting errors everywhere that say: cannot be resolved or is not a field to all my R.something.
I'm guessing the R file isn't properly generated and from what I've read it's a problem in the res folder but I cant find it; I deleted the last layout I made but the problem persists.
No layout actually has any errors to be shown (they all build successfully).
Can anyone help me with this bug?
I found this happening to me with a broken layout. No need to be worry. I am trying my best to giving you the solution
Solution
Make sure that anything the R. links to is not broken. Fix all errors in your XML files. If anything in the ADKs are broken, R will not regenerate.
If you somehow hit something and created import android.R in your activity, remove it.
Run Project -> Clean. This will delete and regenerate R and BuildConfig.
Make sure Project -> Build Automatically is ticked. If not, build it manually via Menu -> Project -> Build Project .
Wait a few seconds for the errors to disappear.
If it doesn't work, delete everything inside the /gen/ folder
If it still doesn't work, try right-clicking your project -> Android Tools -> Fix Project Properties.
Check your *.properties files (in the root folder of your app folder) and make sure that the links in there are not broken.
Right-click your project > properties > Android.
Look at the Project Build Target and Library sections on the right side of the page. Your Build Target should match the target in your AndroidManifest.xml. So if it's set to target 17 in AndroidManifest, make sure that the Target Name is Android 4.2. If your Library has an X under the reference, remove and re-add the library until there's a green tick. This might happen if you've moved a few files and folders around.
What to do if R doesn't regenerate
This usually happens when you have a broken xml file.
Check errors inside your XML files, mainly within the /res/ folder
Common places are /layout/ and /values/ especially if you've changed one of them recently
Check AndroidManifest.xml, I find that often I change a string, and forget to change the string name from AndroidManifest.xml.
Check that Android SDK Build-tools is installed. Window->Android SDK Manager->Tools->Android SDK Build-tools
Make sure when you update the Android SDK Tools, you also update the Android SDK Platform-tools and Android ASK Build-tools. Build fails silently if they don't match.
If you can't find the issue, right click /gen/ -> Restore from local history... -> tick R.java -> click Restore. This doesn't solve the problem, but it will clear out the extra errors to make the problem easier to find.
Hope it will help you. :)
One (or multiple) xml resources must be broken in your project. Check out "Problems" view in Eclipse (Window - Show view - Problems) and fix all issues there. Then rebuild your project (Project - Clean).
Sometimes, just restarting Eclipse can fix the problems.
Some steps you can try:
Right click project -> Android Tools -> Fix Project Properties
Right click project -> Refresh
Right click project -> Properties -> Java Build Path -> Check everything that's unchecked in 'Order and Export'
Project -> Clean...
Restart Eclipse
Might solve your problems!
EDIT: Also make sure there are no caps in your XML files.

Eclipse Android project

I have a problem I can't seem to get around. I've created a project in Eclipse (I recreated it from another project that I thought was corrupted). There are no visible errors in any of the files, including the .xml files. However, the project root [project name] itself has an error (red 'x') and so I can't run it.
On a side note, in the default properties file the line:
target=android-4 is underlined in red with the note that 'android' is not spelled correctly. I have not altered this file since it was generated.
Any clues? Target is 1.6, sdk 4. And I'm new at this :)
You may have already tried this unsuccessfully, but if not, you might want to try the Android Tools > Fix Project Properties action from the context menu of the project root.
Eclipse also thinks android-4 is misspelled in my default.properties, so I doubt that is the cause of your build problem.
Does the Problems view describe any issues? (Window->Show View->Problems)
You could also try cleaning the project in eclipse. Project->Clean..
if the error message you get is
The project cannot be built until the build path errors are resolved.
this might help:
Open the Project -> Properties
Select Java Build Path -> Libraries
Add any new library (to be deleted later) -> OK
Wait for the workspace to refresh or force a refresh
The error should go away
Remove the dummy library
You can stop the spelling error by adding that word to a user dictionary, but a spelling error wouldn't prevent a run.

Failed to load properties file for android project

I finally was able to build and debug the android platform with this tutorial. I imported my project in eclipse, and afterwards installed ADT. Then I converted my imported project to android project (Android Tools -> Convert To Android Project). And now I'm having Failed to load properties file for project 'droid-platform' error. Session data:
eclipse.buildId=M20100211-1343
java.version=1.5.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=ru_UA
Command-line arguments: -os linux -ws gtk -arch x86
Does anyone know, how do I deal with this?
Use the contextual menu on the Project in error, "Android Tools"-->"Fix project properties", I also tried "Refresh (F5)" in the same pass, than it worked again.
ADT does not work good with the platform itself. Actually, the platform is not an android project itself.
I really struggled with this one and finally solved it using the solution here:
"Debug certificate expired" error in Eclipse Android plugins
I also had the error message you mention, but somehow, deleting the keystore fixed everything.
p.s. do a clean after deleting the keystore.
Yusuf
The solution to this problem is to setup some System Environment Variables.
Right click on "My Computer" and select "Properties"
Select the "Advanced" tab
Click the "Environment Variables" button
Under "System Variables" find "Path", select is and then click "edit"
Scroll to the far right, now you need to add two paths, "C:\Documents and Settings\YOUR_USER_NAME\.android\avd" and "C:\Program Files\Java\jdk1.7.0_01\bin", you need to add a ; at the end of each path. Click "Ok" when done.
Select the "New" button, for variable name enter "ANDROID_SDK_HOME", and for variable value enter your SDK install path (Default is "C:\Program Files\Android\android-sdk") and then click "Ok"
Restart Eclipse and it should work!
on my mac, with Eclipse and the Android AVD exited,
1) i deleted all projects in my workspace (backup first!),
2) recreated it with the same workspace name and
3) finally restarted eclipse and a new project setup works fine without the "Failed to load properties.." msg.
So easy just choose the project that has an error, and then go to menu>project>build Project
Just create a new file called project.properties in the root of your project.
Add the line:
target=android-10
Or modify it to whatever version of the Android you're targeting.
I got the a similar error When following the Notepad tutorial on the Android Developers website, the first step in Exercise 1 is to create the first project by going to
File->New->Android Project-> "Create project from existing source"
The problem is that when you select the Notepadv1 path to create the project from existing source, Eclipse will take the project out of the parent folder and move it up a level. For example, if you select
C:\workspace\NotepadCodeLab\Notepadv1
... as the existing source, Eclipse will copy all the contents of that subfolder except the AndroidManifest.xml (and Android.mk file) into a new folder one level up, eg.
C:\workspace\Notepadv1
So one workaround is to create the project, close Eclipse, then copy in all the missing files from the old subfolder to the new folder, then open Eclipse again and refresh the folder.
Presto, no more missing files.
In my case, I just add to import the R.java (ex:import com.exercise.teste.R;) to my class files by right clicking on ex: R.id.mybutton and choose import ex; your.package.name.R, then CLEAN, BUILD.
What fixed the problem for me was going into eclipse sdk manager and installing the tools there even though I had them installed on my sdk manager. It seems that there 2 separate sdk managers with different files, so try directly going into the sdk manager in Eclipse and seeing if you have the tools installed there.
I had the same problem, and without installing AUSKey only corrected the error by removing the log4j.jar / Library / Java / Ext on Windows (\C:\Program Files\Java\jre7\lib\ext) was fixed. In my case, the solution was like this:
https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=54452
I had this error when I manually tried editing the manifest file, "AndroidManifest.xml". When I made changes using the little GUI provided for editing the file, it works fine.
Make changes via the Manifest General Attributes and Manifest Extras sections that opens up when you double click the "AndroidManifest.xml" file. Yet beware of changes made directly to the xml, even if they are identical!
I was facing the same issue but I finally got the solution:
Right-click on your Eclipse project.
Go to Build Path->Configure Build Path->select Android from left side.
In Library section select and remove the existing v7 library
Add it again from your imported v7 project.

Eclipse - HelloWorld - Android error?

I created a Hello world app but get this strange error:
The project cannot be built until the build path errors are resolved
I haven't changed the project, jut created it and tried to run it.
to avoid that annoying problem i have 3 solutions that worked for me.
Solution 1)
delete your generated R.java file
inside your gen/ folder
Solution 2)
a)Delete your project from Eclipse
(i said ONLY from Eclipse, uncheck option: Delete project
contents on disk)
b) import your project to Eclipse:
file > Import > Existing Projects into
Workspace (Look for your project
previously deleted from Eclipse) >
Finish.
Solution 3)
make Solution 1 then Solution 2
It is either a spurious message you can solve by forcing Eclipse to recompute its library paths
I found the resolution for this at Scott D. Strader's blog.
To summarize the solution I only needed to add a library to my project and then remove it to force Eclipse to perform the necessary actions to resolve the problem. I would post the detailed steps here but I don't want to steal his content.
The resolution was to force a resave of the selected projects (and their .classpath files):
Open the project properties
Select Java Build Path > Libraries
Add a new, arbitrary library (to be deleted later) > OK
Wait for the workspace to refresh (or force a refresh of the project)
The error(s) will go away
Remove the dummy library
Note: as the OP mentions, a simple restart of the IDE can be enough.
Or you actually miss one critical library like a JRE library:
I needed to add the JRE library to the project for it to run. Not sure if this was due to the updated version or something elseā€¦. Any way this fixed the issue:
Project > Properties
Java Build Path
Libraries tab
Click add library
Select JRE System Library
Next
Finish
Sounds like you are missing an import or a jar. In your project in the project explorer there should be a red x on the file icon that contains the error.
In addition to the listed answers, there is one other scenario I've seen this error appear when using the sample projects included with the Android SDK. For some reason, the generated R.java file can be invalid or corrupt. You can get around it by expanding the "gen" folder in the Package Explorer and deleting the R.java file. It will immediately get regenerated and the error goes away.
Right click on your project, choose "Build Path", "Configure Build Path" -> and choose Android 2.2, or that target you specified when you created your project
I have had similar issues. for me simply closing the emulator and re-running the project works

Categories

Resources