I was developing a simple app and eclipse says that i cannot run the app because there are errors. I try to find that error, but everything is perfect! Its a simple app(a counter)...
Please Help!
Print Screens:
[I cannot post images because of my low reputation(this is my third question)]
EDIT:
There is nothing wrong and it does not report any bug. When i click "RUN" it just says "Your project contain error(s), Please fix them before running your application".
Let's try to make a full clean of your project.
Right click your project name. Android Tools > Fix Project Properties. If you have multiple Library Projects linked to this project, follow the same step with them first.
Hit the top menu Project > Clean. Select the radio button Clean all projects and hit OK.
You should leave Eclipse doing its job (depending on the amount of projects and files, it may take a while). If this doesn't work, follow the same process, but as a third step, close Eclipse and restart it right after you hit the OK button. Eclipse is powerful, but a silly IDE sometimes.
If the problem is there after restarting, and you have some libraries attached, check inside the Project build paths (right click the project name, Project Properties > Java Build Path) have the proper JARs, only once, and before any Android Library
Related
I have been studying Android on Eclipse Mars for some time and i have been facing a constant problem everyday-the changes made in a folder/file are not recognized by some other folder/file. For example, if i create a new layout in the layout folder and then use it in the setContentView, it shows me an error ("layout-name cannot be resolved or is not a field). It works if i save the project,close it, and open it again, but this takes up a lot of time if i have more than one error, so the question-is there a way to save and refresh the project (without having to close it) so that the newly made files and folders are recognized by the java files?
Thank you.
You can refresh your project in Eclipse by right clicking on the project root folder in your Project Explorer and selecting "Refresh".
You may also want to consider checking if you have "auto build project" turned on. In your top toolbar go to Project -> Build Automatically.
If build automatically is turned off you will have to manually build your project, by Right Clicking on the project in your Project Explorer and selecting "Build Project".
However, I do agree with Pankaj Nimgade that Android Studio is likely a better entry point IDE for Android development.
Real advice: Switch to Android Studio as soon as you can. There you would sometimes have another problem called "sync" though. But it's a much better IDE and you are at least in line with Google.
on Eclipse, F5 should do the trick. Or right click your project and Refresh. Or Clean all projects. If you are still stuck, simply close Eclipse and run it again.
I followed googles instructions and exported a test project from Eclipse by using the
Export -> Generate Gradle build files
opened up Android Studio and imported. After getting my support libraries working properly my project would compile with out any errors. My problem started when I tried to run the app on my device. When ever I try to run the app it directs me to use an AVD, never giving me the option to select my device. I obliged, created a new AVD but to no avail only to get build failed error. (I'll add the exact error when I can) NOTE: I can see my device is connected by clicking on "(6)Android" and the bottom left of the screen. I do see all logcat messages in verbose. I added android:debuggable="true"to my manifest but still nothing.
Confused I created a new project directly from Android Studio, hit run and bingo,...it gave me the option to use my device to run it or an AVD. Selecting either results in a successful launch of the dummy "Hello World" app. I think it may have something to do with build variants as my imported project doesn't specify "debug" vs "release" while the Android Studio generated project does.
Anyone else experiencing this?
I found the answer to my own question. Bit of a double whammy. Before installing Android Studio I updated my SDK via Eclipse (as recommended/required by google). Turns out by doing so a few items in my current projects got disconnected. ie. build paths, dependencies, ect. (you now have to place external Jar's in the src/libs folder)
Here is what I did to fix it.
In Eclipse, Preferences -> Java Built Path ->"Order and Export" tab. Make sure items are selected
If you have external Jars, manually copy and paste the jar in the libs folder of the project. (I did this in my Finder)
confirm the project launches via Eclipse
If it runs, export the project again by "Generate Gradle build files" (confirm overwriting existing files, if any)
5.Open Android Studio and re-import the project. Again, confirming overwriting of any existing files.
6.Next to the run bottom at the top of the screen click on the drop down next to your project name. Click "Edit Configurations..." and select "show chooser dialog" if not already selected.
clicked ok to exit,..and PRESTO!!! I finally have a successful project migration.
Hope this saves someone else time.
Cheers!
Yeah i have experienced similar stuff on Eclipse, its quite buggy. Since Android studio is based on it i would expect everything. Still the best solution to everything is to reload project, refresh project or restart IDE.
I installed both the Android and Facebook SDKs. I did all the steps in http://developers.facebook.com/docs/mobile/android/build/#sdk till Step 6.3.
In step 6.4, when I try to run the project in Emulator (Using Android 4.0.3), I get "Android library projects cannot be launched" and the project doesn't proceed further. Even the logcat doesn't have any content.
Can someone please tell me what may be the problem?
Thanks
Souvik
Folow these steps
1. In the Package Explorer, right-click the library project and select
Properties.
2. In the Properties window, select the "Android" properties group at left and
locate the Library properties at right.
3. Select the "is Library" checkbox and click Apply.
4. Click OK to close the Properties window.
Library projects cant be launched. you can use that in your project and run your project adding it as library.
It would be much better to have the Facebook sdk as a Library so you can simply #import the sdk file into eclipse. Simple. I spent a day trying to get the sample source into a project to test the post on wall. I get the app to run but no breakpoints get called in my project, I had to create the build.xml and not sure if that is the cause. It would be better if the whole test project files were included instead of only the resources and jar files. That way you could just import everything and it should work within 5 mins.
So I have read several of the similarly titled threads here, but none seem to solve my issue.
I have installed Eclipse 3.6 on a Mac (Lion), I have several Android SDKs installed. I am trying to open and run the APIDemos app from the 2.3.3 Samples folder.
I do this using File->New Project->Android Project->
Once in there, I select Target = Android 2.3.3
At that point, I select 'Create Project From Existing Sample' and select 'ApiDemos'.
The project opens, and I am immediately shown 862 Errors (not Warnings). I am unable to compile or run, and am not sure where to start to get these errors to compile. I'm assuming something, somewhere, is not seeing a file as it should...but I'm just not sure what it is...
The frustrating thing is other Sample projects are working, but I would like to get the ApiDemos up and running on my device for testing purposes.
I appreciate any feedback.
I guess it must be the java compliance level problem. Go to your project properties, and set the Java Compiler's Compiler Compliance level to 1.6. See if that fixes the errors.
I had the same problem and this is my solution.
Uncheck "Build automatically" in the menu "project"
Select "Clean" from menu "project".
Select "Clean projects selected below" and check "ApiDemos".
Check "Start a build immediatly", "Build only the selected projects"
Then it compiles as it should (at least for me).
After this you can check "Build automatically" in the menu "project" again.
I got similar problems. I spent some hours to figure out a solution: delete project files of ApiDemos in Eclipse's workspace folder. Then re-add project ApiDemos.
I guess that some of the generated objects don't refresh after I update Android SDK.
If you have never build and run ApiDemos before, my solution should not apply your case.
Actually the combination of Cameron Wong's, Riffer's and userSeven7s's posts did the trick for me:
deleted Api Demos folder in the eclipse workspace folder
reopened project from android samples
Set Compiler Compliance level to 1.6
Cleaned/Rebuilt
I just created a new Android project in Eclipse IDE, clicked on finish, and before even running project can see error symbol on project folder in eclipse IDE. If I expand folders, I don't see any red cross mark on any of files, can you please help me out. If I run as android project it says "Your project contains error(s), please fix them before using your application" . I am puzzled, it was a fresh project. Tried deleting and creating another project , restarting eclipse. Nothing works. Can you please help me out. Thank you for reading my post.
Lots of times Eclipse will fail to build Android projects properly. This might be eclipse.. it might be Eclipse's Android plugin. I'm not really sure. The way I get around it is by selecting from the menu Project > Clean... > Select the project giving you problems and hit ok. This will clear all built files and force it to rebuild, often fixing the problem.
There is a problem with the project itself, like the classpath or something. Go to Window > Show View > Problems (you may have to choose Other..., if so you will find it in the General section). In the Problems view it should give you more info. If you still can't figure it out post what the text from the Problem view.