Problem facing while accessing already created project into the workspace - android

This is the problem am facing since many days. am trying to manage that but not able to solve that. while am try to access the project which is existing project into workspace then am getting some kind of error at the "#override" tag and when remove that the error disappear and single error will be shown at the application name and that cannot be removed. Am doing for the mean while is try to copy all the code from the each java file and paste it to another project that was created newly.
Can any one help me in this concern. Thanks in advance.

Your problem is related to JDK for this what you have to do is from menu options choose
Window > Preference then navigate to node displayed in below image and set "Compiler compliance level as 1.6"

Related

How to Completely Remove an Android Layout from Android Studio

I'm building an app in Android Studio and I accidentally created a base LoginActivity template but then deleted it because I wanted to make my own. Now, when I try creating another activity with the same name, it tells me "Layout name must be unique."
I could just name it something else but:
I don't want to
There would still be some sort of duplicate files in my system doing nothing
My goal is to just remove all mentions of activity_login, ultimately so I can make a new activity with the same name, but I can't figure out how.
Go to res->layout->activity_login.xml and delete it from android studio
Or open project in file explorer, then Go to app/src/main/res/layout/activity_login.xml and delete it
If it didn't solve it, Invalidate Caches and restart Android Studio.
That's happens sometimes.
just go to : File->Manage IDE Settings -> Restore Default Settings.
This will solve it for sure :)
I had the same problem. Empty res/layout/activity_xxxxx.xml and invalidate cache didn't work, until I found there's xxxxx.java existing in app\src\main\java\com\example\xxxxx. After deleting the .java file as well, I found that I'm able to create the Activity file with the same name.

Generate Annotation files Automatically in Eclipse

I am using Annotations and svn(Version control) in my application. I have created one package inside of my application and some Activities inside of it. Now the application is perfectly running. I just committed the files to svn and tried to checkout files from another one pc. Now my projects contain some errors. The errors happen whenever I use intent for calling new Activity that shows an error. The error says "Summary_ cannot be resolved to a type"(Here I mention summary is my Activity name).
And I just add a space in that java file and save the error is gone. But I can not ask other peoples to do this every time. Because this also happen whenever the eclipse is restarted or when I clean my project . Checkout from svn. Update svn.
I guess the annotation files are not generated. Please anyone help me to solve this issue.
Note : I just added a space(or whatever) in that java file and saved. the error is gone . I want to know why it is happening?

Eclipse can see resources which do not exist

I am new to Android development.
I created an Android project, and imported some images as resources.
Unfortunately, one of them contained a capital letter, which is illegal. I have first renamed, then removed the offending image. Then I delete all images, but Eclipse still insists they are there after clicking refresh refreshing and running clean several times.
Could anyone tell me how to fix this?
If the file actually exists in your workspace . Just Right Click the file and select Validate . It should be alright

Newly created layout files not added to R.java

I have tried literally everything to figure out why no new layout files are being added to my R.java file in eclipse. Nothing is working.
I have:
Restarted Eclipse
Used Project>Clean
Deleted R.java (had to restore because it would not autoregenerate no matter what I did)
Ensured all methods are defined in SDK version
Rebuilt the project
Unchecked auto-build
Every combination of above options
Been tempted to throw my computer across the room
Does anyone have any suggestions?
Check you don't have any errors inside one of your xml files. That is, check not only for xml file name errors but also for errors in the xml code, for example an illegal attribute, a forgotten tag etc. Check this in all your xml files, not just layout files but also anim, xml drawables etc. These errors don't show up in the error log but will prevent the R.java from being generated.
When I experienced the same issue as you this was often the reason. The error highlight was only visible inside the file, not the error log.
Net, go through every xml file with a fine comb.
I faced this kind of problem many times. From my thoughts it is caused due to the problem of images in the drawable or case sensitive of layout file (everything should be small). Check your case sensitive of layout file.
I will give all possible solutions that i had done when something like this happened with me
Project-->clean
Check for library if there was any for that
RightClick-->Properties-->Android-->add
Restart Eclipse
Check in
the manifest for if you have many packages make sure u are using the
activity declared package.
I would check the imported R. The problem could be that you have
import android.R;
instead of
import com.myproject.R;
Project -> and check Build Automatically
Is there any error in your resource files? If there is any error in your resource files the R file will not be generated.
When first of u go on Project->Clean the your application then refreshing and auto genrated R.java file for your apps.
Not to be repetitive, but did you check the Android manifest file? The error there doesn't usually pop up.
Did you check for other locale letters (maybe whitespaces too?) in the filenames? Letters that look exactly like Latin.
I think I had similar problem with the names. You can try rewriting your files' names.
Project Explorer (Right click on your project) -> Build Project
This worked for me.

Cannot find the culprit file in my android project even after expanding the main folder

The side bar in eclipse shows a red cross on the title of my project folder but there are no such signs in the directories below it in hierarchy. In which particular file does error exist? How can I know that?
Error log shows: Current file is not a match for the given config.
Sorry I just came across this now, but I've had the same error too, so I'm sure others have. There was a quite a bit easier solution than what you had to do, at least in my case. I had the exact same problem, where my main project said there was an error, so I couldn't debug or run, but there was no apparent error, other than the red X on my main folder.
In order to solve this, I simply closed the project by right-clicking on the main folder, and selected "Close Project". Then, I right-clicked on the closed project, and selected "Delete". Don't worry, this will not delete any files, it will only remove it from the workspace, and will make sure you really want to do that by asking you to confirm. Now, just click on File->Import and select "Existing Projects into Workspace". Choose your parent folder for your app that was erroring, and import it. The few times I've had the phantom error on my main app, this has fixed it each time.
Whether there is an underlying cause and this process simply refreshes something in the workspace, I'm not sure, but at this point this fix is fast enough for me to use it.
Hope this helps next time!
Project -> Clean
Closing project and opening it again fixed it for me.
formed a new workspace and formed a new project. Added each file individually. Now it shows no error.. but still can't figure out what was wrong with thr previous code..? :=(
I faced the same issue..
there was a problem in manifest xml..
the path was not set properly. there may be space in the path..
I just copied the activity tag from other project and pasted in my project and just edited the path in android:name. it worked fine..

Categories

Resources