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.

Ritesh Gune
  • 16,629
  • 6
  • 44
  • 72
Soumya
  • 5,262
  • 8
  • 31
  • 30

22 Answers22

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 ;)

Timo
  • 2,212
  • 2
  • 25
  • 46
  • Simple and easy answer.. Works for me. – Deepak Jul 03 '12 at 12:25
  • Very unhelpful comment on R.java, some advice on how to get around the problem would be useful. – Kickaha Sep 09 '12 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 '12 at 07: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 '12 at 15:25
19

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

racetrack
  • 3,766
  • 30
  • 30
  • 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 04 '10 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 04 '10 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 04 '10 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 '15 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"

Community
  • 1
  • 1
Michael Levy
  • 13,097
  • 15
  • 66
  • 100
  • 1
    So many confusing answers to [a common problem](http://stackoverflow.com/search?q=[android]%20where%20is%20default.properties?). But only yours is correct. +1. – Bill The Ape Jan 06 '12 at 01:49
  • 1
    Credit must go to alextsc who posted the answer in http://stackoverflow.com/a/8319825/90236 – Michael Levy Jan 06 '12 at 19:05
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.

ArunGJ
  • 2,685
  • 21
  • 27
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
Peter O.
  • 32,158
  • 14
  • 82
  • 96
Rony
  • 263
  • 1
  • 3
  • 9
  • 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 '12 at 01:26
  • Clarification: This file goes in the project root directory (usually a workspace subdirectory). Thanks! – Michael Scheper Feb 25 '14 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.

Deepak Sharma
  • 4,999
  • 5
  • 51
  • 61
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.

BraveNewMath
  • 8,090
  • 5
  • 46
  • 51
2

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

iltermutlu
  • 71
  • 1
  • 3
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

deepika taywade
  • 167
  • 1
  • 1
  • 8
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

user2072160
  • 254
  • 2
  • 12
1

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

Uriel Frankel
  • 14,304
  • 8
  • 47
  • 69
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
Jay
  • 3,203
  • 2
  • 25
  • 31
  • And then I updated android sdk, wow I was way behind, probably should have done that first! – Jay Apr 04 '13 at 01:52
1

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

Khobaib
  • 1,577
  • 3
  • 21
  • 29
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.)

n611x007
  • 8,952
  • 8
  • 59
  • 102
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.

MahmudBd
  • 11
  • 2
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.

MissingHandle
  • 693
  • 4
  • 12
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)

MindSpiker
  • 1,437
  • 1
  • 14
  • 22
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.

Sathirar
  • 331
  • 4
  • 17
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.

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
rishiPlus
  • 77
  • 8
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.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
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.

Murli
  • 524
  • 6
  • 11
-2

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

Fakhar
  • 3,946
  • 39
  • 35