36

While configuring MJAndriod I have got an error as follows:

Project has no default.properties file! Edit the project properties to set one.

I have a default.properties which us set to a perfect target and works for another application in the same workspace.

Kindly help me resolve this.

22 Answers 22

36

If the project already contains a file default.properties you can open that file and edit+save it (add a space, save, remove that space, save). That worked for me.

A note with the above discussion:

R.java is getting generated automatically by doing the above described process. When I go and remove it, it gets generated again. Neither is it allowing me to edited the automatically generated one. – Compuser7

With respect to the comment quoted above, R.java is indeed an automatically generated class that contains references to all the resources (in the res folder) that belong with your project.

When Eclipse rebuilds, this file is regenerated, since most application (I mean Java code) rely on the fact that there are some resources (images, layouts and string values) available. When you remove the file R.java through Eclipse, Eclipse will see this change in the project as a reason to automatically rebuild (see the options under Project) the project, regenerating the R.java file.

So DON'T try to remove R.java, because Eclipse will regenerate it as soon as you rebuild the project, which will result in a match of patience ;)

4
  • Simple and easy answer.. Works for me.
    – Deepak
    Jul 3, 2012 at 12:25
  • Very unhelpful comment on R.java, some advice on how to get around the problem would be useful.
    – Kickaha
    Sep 9, 2012 at 22:07
  • @Kickaha The only thing that might be helpful is this: if you want to change something in R.java you have to get your resource configuration correct. Since no further details are given, I cannot supply a better answer. It might even warrant a new Question?
    – Timo
    Sep 28, 2012 at 7:52
  • @Timo I eventually found that there was a second R.Java in my project (in an incorrect location because of a mistaken drag and drop) that needed to be deleted. It was quite frustrating for a while there. Thanks for the reply.
    – Kickaha
    Sep 29, 2012 at 15:25
19

Don't import it into Eclipse, use create new project from existing source in Eclipse.

4
  • I've imported projects just fine. Is this an issue with this specific app? Or are you saying just to be sure? If you're saying never import android projects, I'm going to have to give you -1, but I'll wait for the clarification
    – Falmarri
    Oct 4, 2010 at 17:30
  • 7
    It's because that particular project is missing the default.properties file, and that file gets generated automatically using android tools. Either create a new Android application with existing source and point it to where you downloaded the code (then android tools will automatically generate that for you), or create a default.properties file, and put a target=android-APILEVEL in it.
    – racetrack
    Oct 4, 2010 at 17:38
  • R.java is getting generated automatically by doing the above described process. When I go and remove it, it gets generated again. Neither is it allowing me to edited the automatically generated one.
    – Soumya
    Oct 4, 2010 at 17:49
  • thanks for this answer! I was stuck on correctly/successfully importing an existing project - for a couple of days, and finally stumbled across this answer which did the trick. Would be nice if this answer was somehow highlighted as a 'must know' for importing an ADT project
    – Gene Bo
    Feb 16, 2015 at 20:40
14

See project.properties in android project. In ADT 14, default.properties was renamed to project.properties.

Quote from the changelog:

default.properties which is the main project’s properties file containing information such as the build platform target and the library dependencies has been renamed project.properties.

*Note: Per the above link, if you don't have a default.properties file, likely you should upgrade your tools.

See build changes in revision 14, at the bottom under "Project Setup"

2
6

When i imported a project from another pc into my workspace, there was the default.properties but no R.java. Editing the default.properties didnt generate R.java. I changed the skd version from 1.1 to 1.5 and the R.java file was generated and the project worked.

6

First Close your project.

Open a Text File then Add target=android-your_Api_Level.

Such as: target=android-7 And then Save that file as project.properties Then manually place project.properties file into your Project's Folder and then Reopen you project.

The file generally looks like:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-7
2
  • This worked for me! I just closed the project and re-opened the project and it fixed the problem. Since my project.properties file was already there, i did not have to edit it. I just closed/opened and it worked. Thanks
    – prolink007
    Mar 10, 2012 at 1:26
  • Clarification: This file goes in the project root directory (usually a workspace subdirectory). Thanks! Feb 25, 2014 at 21:49
5

Just try these steps and i am sure it will definitely help you..

1.Just rename the project.properties to default.properties.

2.Delete your project from eclipse.

3.Again import your project into the eclipse.

Now the problem must be solve.

Please dont forget to give +1.

3

I got the default.properties error because the Android SDK wasn't installed on the machine I was using. What happened in my case was that I was setting up a second machine to development on.

After installing the SDK, the project imported just fine. You don't have to do New Project.

2

"default.properties" is renamed as "project.properties". You can reach "Package Explorer" -> "MyXXXXXApp" -> "project.properties"

2

Project has no default.properties file! Edit the project properties to set one

best option is create new workspace import the project ,fix the project its work

2

Right click on project --> properties --> Android.

Change the checkbox for project build target.

Press apply.

Change it back to your original build target.

Press apply --> ok

Worked for me

1

I have nothing to do something special.Only Open the debug.properties file edit target=android-APILEVEl.Like suppose it is default target=android-8 you can edit it target=android-4.Then build the project.Again edit target=android-8.Again edit it.Now you can see there have no error in your project.

1
  • 1
    This might a silly question, but where is the debug.properties file located in the project setup? Dec 17, 2011 at 17:55
1

In my case, it was because I was moving a project from Eclipse 7.1 to an older install of 7.0 on a different computer. You may want to check your eclipse versions.

1

In my case the file probably got deleted somehow. I just went to the SVN repository and reverted to the file.

1

Yet another solution as my own reminder; I got this error with FacebookSDK, importing project fails to build because it doesn't have default.properties, it has project.properties.

  1. Create empty default.properties (right click -> new, file)
  2. Edit project properties, select android, check correct SDK version, hit ok
  3. Clean projects
1
  • And then I updated android sdk, wow I was way behind, probably should have done that first!
    – Jay
    Apr 4, 2013 at 1:52
1

import -> Existing Android Code Into Workspace should solve the problem.

1

When importing to Eclipse project, I accidentally did:

BAD: Import... >> General >> Existing Proejcts into Workspace

when I should have done instead:

GOOD: Import... >> Android >> Existing Android Code Into Workspace

Removing the project imported with first method, and then re-importing it with the second method solved the problem for me.

(Others have written similar answers but I didn't get it until the explicit comparison.)

0

For me this problem occurred because I develop in two different environments with the same files. The newer environment converts the file structure and works fine then when I go back to the old environment I get this error. After messing around for a while trying to figure this out here is the solution I use:

1) rename project.properties to default.properties

2) edit .classpath file to remove the line:

<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>

4) Restart eclipse and/or clean the projects (may not be necessary)

0
`# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
**target=android-7`**

Change the target and save the file. Worked for me.

0

In my case I went to My Project then to > Properties > Android > and checked Google API box. Clicking 'Okay' caused it to then work for me.

0

May be you are missing Third party library to like actionBarSherlock, slidingMenu, achartengine Add it into lib folder and Add to Build Path..

Its work for me.

0

I solved this problem by adding appcompatv7 library to my project, though I don't require this library(as I my project don't target lower versions) I don't know why I had to add this. Hope someone else can solve their problem by adding same.

-2

File-> Switch workspace -> newWorkSpace will solve the issue dx.jar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.