unable to edit R.java Android using Eclipse - android-layout

I am new to Android. Well the problem I am facing is that I have two layouts. One is main.xml and another that I made was relative_layout.xml.
I did not give it an #+id/ to this layout so the default id was relative_layout01.xml but when I gave this an id the old one still remain in my R.java and when I edit R.java it again generated the old version of file.
I want to delete relative_layout01.xml reference as it does not exists as I have given a name to my layout.
Attaching an image for reference.

R.java should be refreshed automatically.
Maybe you still have some references to it in your code (setContentView(R.relative...) or you still have it as an activity in AndroidManifest.xml?
Sorry for the noobish answer. Just my 2 cents..

Delete import android.R, and R.java completely, rebuild and it would be fine

Related

Problem: Visual C MFC Dialog editor “Failed to return new Code Element. Possibly syntax error. New Element Name test”

I have a simple MFC application, using Visual Studio 2019. My problem is that when I want to add a variable to any control I get the pop up message:
Failed to return new Code Element. Possibly syntax error. New Element Name test
To clarify: The problem is in the Visual C MFC Dialog Editor. Not in my code as it runs fine. I have tried all possible solutions that I found using Google. Nothing helps. The app is very simple. The only "extra" is that I am using tinyxml2.
What I found out by Google is that this is not a new problem, and the solution was to not use precompiled headers. And I am not using precompiled headers. so...
I am stuck. A long shot: Note the "Element" in the error text, and all the "elements" in tinyxml2. Some collision of symbols ??
I hint (maybe): I have got this message once before when I was using a long variable name. I shorted the name and the error was gone.
This is my second try. When the problem turned up I removed all changes since it was OK. But the problem is still there. Somthing I did has left some, not reversable, mark in the code (or database).

Cannot create class-file Android Studio

I'm trying to integrate Google Calendar API into my android project and I follow the tutorial here
https://developers.google.com/google-apps/calendar/quickstart/android
At step 5 create a new java class
I right click project folder src>main>java>com>example>utarapp and then new>file and entered the file name but then it has this error
What's going on ?
I'm using android studio 1.3.1
I think you are trying to create file with same name which is already present in the same package. This may be one possible reason.
It seems like you are right-clicking on the upper level in your application's directory tree.
Right click on one of the files inside the utarapp folder and then select Java class option from the menu.
For me this was happenning because of the length of the class name. In my case it was "ChallengesFragmentPagerAdapter"!
Changing it to "ChallengesPagerAdapter" solved the problem.
Create a blank Activity then remove "extends Activity" from the activity class.

Error opening nib in xcode: Error updating Objective-C type information. Multiple types...registered with the same Objective-C name: AppDelegate

Just getting started with xamarin studio and iOS development... I'm trying to set up my development projects. When setting all this up, I had initially created a project called 'MyProject.iOS'. I later decided that I didn't want the 'p' in MyProject to be capitalized. I deleted the existing project (using finder), removed it from my existing solution, and created a new one named 'Myproject.iOS'.
Now, when I try to open the Myproject_iOSViewController.xib file to edit in xCode, I get the following error:
Error updating Objective-C type information. Multiple types (MyProject.iOS.AppDelegate and Myproject.iOS.AppDelegate) registered with the same Objective-C name: AppDelegate
Seems like something is stuck in xCode from my original project that had the same name w/ different casing. I looked in Finder and confirmed that all the old files are gone.
I believe I am experiencing the same issue that was reported here (not sure why this issue is marked as resolved): https://bugzilla.xamarin.com/show_bug.cgi?id=7550
The last commenter has a great repo and reports this solution that worked for him:
1. Close XS
2. Delete ~/Library/Caches/XamarinStudio-4.0 folder
3. Open XS : voilà everything works again now !
My issue at this point is that I cannot find the ~/Library/Caches/XamarinStudio-4.0 to delete. I found a ~Library/Caches/ folder but it did not have a XamarinStudio-4.0 sub-folder in there. How can I resolve this?
I am using 4.0.9 (Build 12) of Xamarin studio.
Here is the full stack trace from the error message box that shows up when I double click the xib file:
System.ArgumentException: Multiple types (MyProject.iOS.AppDelegate and Myproject.iOS.AppDelegate) registered with the same Objective-C name: AppDelegate
at MonoDevelop.MacDev.ObjCIntegration.NSObjectProjectInfo.Update () [0x00118] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/f9c5c24e/source/md-addins/MonoDevelop.MacDev/MonoDevelop.MacDev/ObjCIntegration/NSObjectProjectInfo.cs:98
at MonoDevelop.MacDev.ObjCIntegration.NSObjectProjectInfo.Update (Boolean force) [0x0000c] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/f9c5c24e/source/md-addins/MonoDevelop.MacDev/MonoDevelop.MacDev/ObjCIntegration/NSObjectProjectInfo.cs:72
at MonoDevelop.MacDev.XcodeSyncing.XcodeProjectTracker.UpdateTypes (IProgressMonitor monitor) [0x0003c] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/f9c5c24e/source/md-addins/MonoDevelop.MacDev/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs:476
I just had this problem. I used that post to solve it. At first I could not find the folder that is referenced. This is how I found it.
Go into finder on the Mac.
Under Favorites on the left of the screen, select the primary volume. For me that was labeled Macintosh HD.
Select Go/Go to Folder from the toolbar.
In the Go to the Folder screen that pops up type in ~/Library.
From there you can navigate to the proper directory and delete it.
Hope that helps. Best of luck.

Following Android drag and drop example, error "btn_default_pressed cannot be resolved or is not a field"

Working in min API 15, I'm trying to find how I can drag and drop one item element out of a ListView list onto a TextView above it (just to copy the text into it).
I'm trying to follow this example:
http://techdroid.kbeanie.com/2011/10/drag-and-drop-honeycombics.html
Namely these two parts...
http://code.google.com/p/myandroidwidgets/source/browse/trunk/HCDragDrop/src/com/beanie/hcsample/dragdrop/MyDragShadowBuilder.java
http://code.google.com/p/myandroidwidgets/source/browse/trunk/HCDragDrop/src/com/beanie/hcsample/dragdrop/HCDragDropActivity.java
However, I can't figure out how to fix this error
The import android.view.View.DragShadowBuilder cannot be resolved
Or if I remove the import then DragShadowBuilder gives me
DragShadowBuilder cannot be resolved to a type
I changed my minSDK And target SDK both to '15'. Should I not have access to these classes now? How can I resolve this error?
edit: I've fixed that problem- properties, android, set target. Clean, refresh. Ok.
But now I'm getting
btn_default_pressed cannot be resolved or is not a field
on
mShadow = v.getResources().getDrawable(R.drawable.btn_default_pressed);
Looks like that class came in API 11. So probably you have one of a couple problems.
You have set the SDK target in your manifest, but you haven't updated your actual SDK. If this is the case, go to the SDK Manager and get the necessary updates.
You project is still linked to a API 10 or lower jar. If this is the case go into, Project > Properties > Android and pick the correct library.
Project > Clean and restarting Eclipse can't hurt either.

Many error ins src in ActionBarSherlock after importing

Hi I have a problem with the ActionBarSherlock after importing.
I made the following steps:
I Imported the stuff from the library folder
I checked if the project is set as IsLibrary
I selected Project Build target: Android 4.0
then the project look like this:
I dont know whats wrong, the error in the first package e.g. is:
The method onCreatePanelMenu(int, Menu) of type Watson must override a superclass method
ActionBarSherlock library is full of errors after being imported
There May be other ways, My Suggestion is to go to java file and remove all #override symbols above the methods there, because I have also faced that problem and I did that to get rid of those errors! I think this may meet your need.

Resources