0

I am starting to honestly think Eclipse does not want me to finish my project...

Firstly it stops updating my xml files for some reason. Soooo, I decide to clean my project, which makes my R.java file simply disappear. Why in the world did this happen and how can I get it back?

Also, why is aren't my .xml layout files not updating?

Here is the code of the xml file I was working on. It has no indication of an error and I don't see where this error courld be.

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.jfitnessfunctiontester.RegisterUserActivity$PlaceholderFragment" >


<TextView
    android:id="@+id/ageRegisterTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="32dp"
    android:layout_marginTop="41dp"
    android:text="Age:" />

<TextView
    android:id="@+id/weightRegisterTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/ageRegisterTextView"
    android:layout_below="@+id/ageRegisterTextView"
    android:layout_marginTop="52dp"
    android:text="Weight (kg):" />

<TextView
    android:id="@+id/heightRegisterTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/weightRegisterTextView"
    android:layout_below="@+id/weightRegisterTextView"
    android:layout_marginTop="48dp"
    android:text="Height (cm):" />

<EditText
    android:id="@+id/ageRegisterEditText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/ageRegisterTextView"
    android:layout_alignBottom="@+id/ageRegisterTextView"
    android:layout_marginLeft="14dp"
    android:layout_toRightOf="@+id/ageRegisterTextView"
    android:ems="3"
    android:inputType="number"
    android:maxLength="3" >

    <requestFocus />
</EditText>

<EditText
    android:id="@+id/weightRegisterEditText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/heightRegisterTextView"
    android:layout_toRightOf="@+id/heightRegisterTextView"
    android:ems="3"
    android:inputType="numberDecimal"
    android:maxLength="3" />

<EditText
    android:id="@+id/heightRegisterEditText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/heightRegisterTextView"
    android:layout_alignBottom="@+id/heightRegisterTextView"
    android:layout_alignLeft="@+id/weightRegisterEditText"
    android:layout_marginLeft="14dp"
    android:ems="3"
    android:inputType="number"
    android:maxLength="3" />

<Button
    android:id="@+id/finishRegisterButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/weightRegisterEditText"
    android:layout_below="@+id/sexRegisterSpinner"
    android:layout_marginTop="68dp"
    android:text="Finish" />

<Spinner
    android:id="@+id/sexRegisterSpinner"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/heightRegisterEditText"
    android:layout_marginTop="38dp" />

Thanks

Update: I copied and pasted my old R.java code since I couldn't figure out how to get the new one (Is that ok to do?) And now my program won't even compile saying there are mistakes. The thing is, there are no indications of errors at all!

Update 2: Here are the errors I ended find through the Eclipse problem view: Description Resource Path Location Type Error generating final archive: java.io.FileNotFoundException:

C:\Users\Julia\git\FuzzFit\FuzzFit\bin\resources.ap_ does not exist FuzzFit Unknown Android Packaging Problem Unparsed aapt error(s)! Check the console for output. FuzzFit Unknown Android Packaging Problem

Update 3: I have up trying to do all this stuff when nothing is working, so reverted to the version I committed yesterday. Surprise surprise I have a whole new set of errors! Apparently one of my Activities is not finding it's layout files. The error messages are that it doesn't exist. But it does!! I am starting to lose my mind here! What I mistake it was to open this project today... What a mistake...

theJuls
  • 6,788
  • 14
  • 73
  • 160
  • Check if `Build Automatically` is checked in eclipse... – Lal May 10 '14 at 15:20
  • 4
    Most likely there is some error in one of your resource files, which prevents R from updating. – nhaarman May 10 '14 at 15:20
  • @NiekHaarman He already said that eclipse is not updating his xml files.. – Lal May 10 '14 at 15:22
  • 1
    Also check out that your file names don't include offending characters, like UpperCase letters, minus (-), and other special chars (only lower case chars, underscore, dot and numbers - not initial) are allowed – Phantômaxx May 10 '14 at 15:22
  • 2
    @Lal which is not very clear. Eclipse shouldn't modify xml files at all, so what should it be updating? – nhaarman May 10 '14 at 15:23
  • The Build Automatically is checked in eclipse, there are no offending characters in the files and there is no indication of an error. I'll make an edit and post the code of the file I was working on. – theJuls May 10 '14 at 15:27
  • As for the duplicate, I looked through that topic and nothing really helped, as well as the issue seems a bit different. – theJuls May 10 '14 at 15:28
  • It does sound like you have a build problem. Have you looked at the 'Problems' view in Eclipse? – Andrew Fielden May 10 '14 at 15:29
  • Please check **all** of your xml files for tiny errors (also strings.xml, for instance). It could be simply a missing **>** or an excess **-** in a comment... look at every single line in every single xml file. – Phantômaxx May 10 '14 at 15:32
  • @AndrewFielden found two in that view: Error generating final archive: java.io.FileNotFoundException: C:\Users\Julia\git\FuzzFit\FuzzFit\bin\resources.ap_ does not exist FuzzFit Unknown Android Packaging Problem Unparsed aapt error(s)! Check the console for output. FuzzFit Unknown Android Packaging Problem Sorry but I have no idea what they mean. – theJuls May 10 '14 at 15:33
  • Remove `xmlns:tools="http://schemas.android.com/tools"` from your RelativeLayout .. – Lal May 10 '14 at 15:33
  • `Unparsed aapt error(s)` is simply removed by deleting the error in the error window. It happens randomly. `resources.ap_ does not exist` should sugegst that something went wrong in compiling some resource file(s) - Check layouts, drawables, menus, preferences, strings, dimens, styles, themes, ... – Phantômaxx May 10 '14 at 15:34
  • Alright. Removed one of the errors as well as those lines fro the RelativeLayout. Still doesn't work and I still have the second error. – theJuls May 10 '14 at 15:36
  • 1
    What is the second error???Please post the Logcat – Lal May 10 '14 at 15:37
  • and, at last, try restarting Eclipse. – Phantômaxx May 10 '14 at 15:39
  • @Lal my LogCat doesn't say anything. My second error is just: Description Resource Path Location Type Error generating final archive: java.io.FileNotFoundException: C:\Users\Julia\git\FuzzFit\FuzzFit\bin\resources.ap_ does not exist FuzzFit Unknown Android Packaging Problem – theJuls May 10 '14 at 15:40
  • @DerGolem already did so a couple times... – theJuls May 10 '14 at 15:40
  • Only solution for that problem is Cleaning as said in this [link](http://stackoverflow.com/questions/2865577/android-eclipse-error-android-packaging-problem) – Lal May 10 '14 at 15:42
  • Do you try to clean and build your project? In most cases this solves the problem. – ridoy May 10 '14 at 15:43
  • 1
    Please check this [link](http://stackoverflow.com/questions/4714711/android-packaging-problem-resources-ap-does-not-exist) too..It has a different answer.. – Lal May 10 '14 at 15:44
  • Make sure "build automatically" is turned on. If there is a problem in your XML, you should see a red icon on the file. You can also open the "problems" window and see what it says there. If there are no problems and build automatically is on, it *should* generate your R file. – Kevin Krumwiede May 10 '14 at 15:52
  • 1
    Oh, another thing... sometimes, somehow, something imports the default Android R file. You probably don't want that. Check your import statements and make sure only your own R file is being imported. – Kevin Krumwiede May 10 '14 at 15:53
  • @KevinKrumwiede I already did all that stuff. NOTHING is working. I decided to revert to the old version I committed last night and now I have a while new set of errors. I think I'm going to cry... – theJuls May 10 '14 at 15:55
  • Why dont you try cleaning the project??? – Lal May 10 '14 at 15:57
  • @Lal it was the first thing I did!! What happened when I did so? My R.java file disappeared! – theJuls May 10 '14 at 15:58
  • Try the 2nd answer in this [link](http://stackoverflow.com/questions/4437023/resources-ap-does-not-exist-when-compile-my-android-project) – Lal May 10 '14 at 16:00
  • @Nikkajihaikjawak unfortunately yours was the only one that worked. After about 2 hours of trying to fix these things I've just reverted to the old version and still have no idea what happened in the first place. Waste time of time unfortunately... Might as well not had done anything =/ – theJuls May 10 '14 at 16:32
  • Nope. I had it on Git, so I recovered last nights version of it which had very few differences to it. But I just feel like the passed two hours were a waste because nothing worked and I really have no idea what went wrong. – theJuls May 10 '14 at 16:39
  • You can keep a backup of your project, clean your workspace and then import your project again Or create a new project and clone it – JRE.exe May 10 '14 at 15:36
  • As it stands, I am starting to think this is what I'll have to do. Thank heavens for repositories! – theJuls May 10 '14 at 15:37
  • i don't understand what's the problem in creating a new project with similar package name and activities and pasting all the resources, code in it – JRE.exe May 10 '14 at 16:10

1 Answers1

0

Alright folks! Figured it out!

Turns out it has everything to do with Eclipse's updates, in which in generates the activity a different way than it used to. Instead of generating it with just the layout it also has the fragment layout thing which I still have no idea what it does. Using another users question, I did what other user's told me and got rid of the fragment file and made minor changes on the activity class file.

This worked like a charm yesterday, or so I thought... Until today I decided to change some things and they wouldn't change anymore. The error was in the menu files which are also generated, I just had to delete a couple of lines which made no more sense now. That was it!

Uhh... Now just to get something off my chest: I HATE HATE HATE HATE this update so far it has given me nothing but problems!

Thanks for all your help everyone!

theJuls
  • 6,788
  • 14
  • 73
  • 160