android project can't suddenly resolve methods for no reason - java

I made a simon says project at home and brought the disk on key to school,
when I opened it on the program in the school computer all of this
my code is solid and it works but for some reason all of these baisc methods like the R symbol that is used in "R.id.etc"
the "AppCompatActivity" that is used in the title of the activity calss is not resolved
and the app in
import android.support.v7.app.AppCompatActivity;
is not resloves , is there an easy fix for this issue?
I have tried cleaning and rebuilding the project but my knowledge of this ide doesn't extend beyond that, my project builds with no erros but it shows errors for no reason on the code page and says it cannot resolve symbols.
I have run the project on my phone and the build ran fine with no erros and the code worked just like before, my android final project is due in a week and I want to keep working on it please help .

You try to choose File | Invalidate Caches/Restart then uncheck offline mode and final Clean, Build Project.

i solved it by using this solution from a different thread posted by "Nauraushaun"
https://stackoverflow.com/a/30262226/7547488

Related

How to reinstall the appcompatv7_11 package in android?

So, I had to have my laptop restored, and now when I open my eclipse workspace, my appcompat_v7_11 package has an error in it, and now some of my apps have errors all over the place because of it. I need to reinstall the appcompat package or at least restore the 7_11 package back to the way it was. I want the proper way of doing this, that way I don't end up deleting the wrong files, duplicating the same files, or anything else that will make the problem worse. Thank you in advance.
EDIT: So I realized that each of my appcompat files are assigned to each one of my apps. So obviously my appcompat file 7_11 must have been messed up when my computer was restored. Is there a way to fix or restore this file that way I won't have 100 errors in my app?
EDIT 2: This is the error I get:
Errors occurred during the build.
Errors running builder 'Android Resource Manager' on project 'DayManager'.
java.lang.NullPointerException
Errors running builder 'Android Resource Manager' on project 'appcompat_v7_11'.
java.lang.NullPointerException
If you know of any android help centers that may help me, please post them, as I can't continue my app development without fixing this problem.
EDIT 3: I've noticed that it is missing the Android 4.4.2 and Android Private Libraries
I am replying to the thread a year later but hope this helps others who might land up here with this query.
This is what worked for me
Go to Project and select Clean on your eclipse tool
This video helped https://www.youtube.com/watch?v=fp-hiJrTROU
There are more tips here

Eclipse/Android error: R can not be resolved to a variable

I often randomly receive "R can not be resolved variable" errors, and when it happens I can never fix them unless I create a new project and copy and paste all the code. I think this shows that these are not errors from my code. I have cleaned the projects, restarted eclipse, my computer, and even reinstalled Eclipse, but none of those work.
I Have noticed that the gen file (Generated auto file) does not contain any file. I have not deleted them my self and this has frequently happened before.
I know that many people has posted questions on this topics but they have never worked for me and they usually receive low rating so not many people comments on them either. Also if it requires cmd or terminal, please give the commands for Windows, Linux/Mac. I use Mac. I have recently installed GooglePlayService in the SDK although it worked after I installed it.
I am very sorry for lack of useful information, as I have no idea what the issue is.
Here are some of my screen shots to show MainActivity.java, Package explorer and res.values.strings.xml.
I apologize for describing the situation in a confusing way but I tried my best, please tell me what you find confusing if you do find this confusing.
Aftr all Thank You Very Much!!!
Your "gen" folder is empty. It should contain R.java
[1]
Try this:
-Right click your project
-Select properties
-Select Java Build Path
-Click add Folder
-Select the gen folder
-Click OK
[2]
if [1] doesn't work
Check your Res folder for any errors in your XML files, if one of the files has errors, then the R file will not be built
This error was caused by a bug on the Eclipse where even, if you click on re-build it does not regenerate the resource file.
To fix this, even if your eclipse claim that it is the latest version, you should go on the homepage and manually reinstall the latest eclipse with ADK or just install the android studio

Idea + Play Framework - cannot resolve method/symbol

I use IntelliJ IDEA 12, Play 2.2.0, I have Scala plugin installed, Play 2.0 support plugin installed.
I created java play application via termina (play new). Andas you can see in this pictures I always get this error: "cannot resolve method ok()" or "cannot resolve symbol at"
http://sluchatka.kvalitne.cz/pics/1.png
http://sluchatka.kvalitne.cz/pics/2.png
I searched the web for this problem the whole day, but I didn't find solution.
Can you please help me?
The first problem (unable to resolve reference to template) is because your template probably has not been compiled by the moment (and thus IDEA does not see compiled template and can't resolve reference to it).
I usually develop Play apps having ~run command launched in Play console. So that any changes to templates are immediately compiled and changes detected by IDEA.
As for the second one it seems like a deficiency in Play IDEA plugin. It does not work seamlessly within templates I should say. Lots of glitches. The best way I found is to have ~run launched so that small problems are detected immediately.
According to intelliJ support it is better to import the command line created play 2 project using the IDE import project wizard instead.
File -> Import Project
Select play2 project location
Import as SBT project
This was due to the "play idea" command being outdated or not fully compatible with the current play 2 and scala plugins for intelliJ.
A bonus is that errors start to appear properly, we had trouble with that earlier.
I was having a similar issue with Play 2.4.2 and Intellij 14.1.4. I could run the basic "play-java" example/starter app in Intellij, even though the editor showed errors like "cannot resolve method ok()".
Here's what solves the problem for me:
Before starting, make sure your project is not open in Intellij.
Delete the ".idea" folder from your existing app, OR just create a new app using "activator new".
On the command line, cd to the app's folder and compile using "activator compile".
In Intellij, File -> Open, and select your app's folder. For the SBT import options, I left the boxes unchecked (e.g. "Use auto-import", "Create directories for empty content roots automatically", etc.) but I don't think it matters.
Once everything finishes loading, you shouldn't see the errors any more.
This click in the Project Structure is your answer.

I'm doing the "first app" lessons on Android Developers, but the app will not run

http://developer.android.com/training/basics/firstapp/running-app.html
That's the page I'm on.
So far it's been pretty simple, because besides naming the app "My First App", it hasn't had me change a thing.
However, when I click Run or even try to click Run As, Eclipse tells me that there's a error in the project,though the red X is only on the project name, and is nowhere else to be found.
Normally when I have done Java programming, the code where the error was could be found easily, but I can't in here. Furthermore, I don't see why there is an error, seeing as the code in here seems to be a template "Hello World!" app, that I have not altered once.
I've tried starting over again several times, but each time it always tells me that the app can't launch because my "project contains errors".
i had the same prob, it could be from xml files. try to clean the project and if it not work so try to look in string file maby you have ' (Apostrophe) char in some string , chack if there is eror in console, if you have error tell as what you see
also look this Q
unable to get debug signature key for my android application
I had this problem earlier and I think it's just a loading issue. Try restarting Eclipse, it worked for me.
I had a similar experience. Cleaning the project did it all the good in the world
Deleted the ~/.android directory, re-run AVD manager and then rebuild project.
Thanks everyone!
Right click on the project Properties -> Android and make sure appropriate target is set.

Errors in Eclipse for no reason

I'm building an Android app.
I worked today on my app, and suddenly I saw that all the projects in the workspace are marked with an error. I don't know what caused it, and I can't find explanation of the error anywhere.
I'm using Helios with Windows 7. I even tried downloading Eclipse again but it didn't help.
Today I tried to integrate Facebook with my app. Their tutorial required me to try to get a hesh key from a keystore. In the process I added an Environment Variable named JAVA_HOME, and pointed it to the JDK.
I don't know if it's the cause of my problem, but I think it might be related.
I really don't know what to do.
Thanks!
Try this. In eclipse, go to Project --> Clean --> Select "clean all projects". This should rebuild all projects.
Try cleaning your android project. I get problems with Eclipse sometime, and if I clean the project, it fixes it.
Find the "Problems" view. That will give you more details. Post the description of the problems, we can get more information.
click Window -> Show View -> Problems
Typically, the problem is with a resource you've recently added to your project (drawable, assets, raw, etc.)
Some things to check are:
Invalid XML files
Invalid 9-patch images (outer 1-pixel border must be full black or transparent)
Typically, just start by removing a resource, then cleaning your project (Project > Clean). If the errors go away, that resource is your problem. If not, continue this process until the error DOES go away. Start with the most recent resources you've added, naturally.
i solved error or all project showing errors this way.... close eclipse.
then Right Click on eclipse shortcut-->open file location-->open command widows there and type "eclipse.exe -clean" eclipse the starts..and in my case errors were gone...hope it helps

Categories

Resources