Error found after importing archive file in eclipse - android

I am a very beginner in android development using eclipse..
I have given an assignment to modify the android application made by a professor..
so I downloaded the file and imported it to eclipse.
My professor can normally run the program..
however, when I tried to test it before modication using simulator, " the application is forced to stop unexpectedly" is shown..
Moreover, I found that all .java file in src contained "x" ...and the codes in the .java file, like "import android.graphics" or "private class xxx" all contained error..which i have been told that "import andorid.graphics" cannot be resolved..
Could anyone tell me what's wrong with the codes...
and kindly provide me the procedures to fix this problem?
is it possible for me to send the zip file to someone..so that he/she can help me find out the problem??

Make sure the Android sdk and ADT are configured properly in Eclipse and you have updated the relevant packages using SDK Manager. Best way to test this is to create a HelloWorld Android app
http://developer.android.com/sdk/installing.html

Assuming that you have correctly installed the same Android SDK that your professor is using, the first thing to try is to right click on the project name, then select Android > Fix Project Properties.
I've often found that importing existing Android projects into a workspace can be problematic, especially when the project comes from a different machine. A work-around is to create a new Android project, then copy all the sources and resource files into the new project. It's a pain, but it avoids many problems that arise due to different development configurations.

Related

The most basic Android app on Eclipse is not building

I am trying to make the a default android application project build and run. This is even less than a hello world.
I am using eclipse neon 3, android 8.0, and my SDK Manager says everything is up to date.
When I create a new Android application project, it immediately has errors, which is crazy to me.
The first error is here: import android.support.v7.app.ActionBarActivity; android.support is squiggled and unrecognized.
The error message is: "ActionBarActivity cannot be resolved to a type".
I have spent all day on here reading about similar problems and tried the following:
-Using the SDK Manger to add "Android Support Library".
This is not shown in my SDK, even when clicking on obsolete.
-RMB Project > Android Tools > Add Support library. This failed:
[2017-06-24 16:07:08 - Android Support Jar not found:] C:\WINDOWS\system32\v4\android-support-v4.jar
So I went and found this file somewhere and put it there. Then it stopped failing but didn't fix my problem.
-Project > Properties > Java Build Path > Add External Jars > android-support-v4.jar. This did nothing.
-Many suggestions have me navigating to C:\Program Files (x86)\Android\android-sdk\extras\android where I am supposed to find all kinds of folders but all I have is m2repository.
Any help would be appreciated, but I would also like to know why this is so difficult. I have been developing in other languages for a while and have never seen a default project be so difficult to get running.
Should I be using a different IDE or something?
Android Support Jar not found:] C:\WINDOWS\system32\v4\android-support-v4.jar
Why is your Android home directory pointed at System32?
Found it and put it there.
That was the wrong solution to the problem. You needed to fix the environment variables for PATH and ANDROID_HOME
have never seen a default project be so difficult to get running.
Because the main development efforts for stability and ease of Android development are focused elsewhere
Should I be using a different IDE or something?
Yes. When you downloaded the SDK, did you skip over all the Android Studio links?

Android : R class stopped getting generated

I am a newbie to android programming .I was doing tutorial from Commsware tutorial , to be precise T3 tutorial during which I cleaned the project.After that R class file has stopped generating.
I deleted that project,looks like the same error is getting propagated to other new projects I am creating.
This error is coming for the newly created project also.
I tried all the solutions in stackoverflow like : cleaning project,selecting android version in build path , deleting my workspace,freshly install eclipse etc..
The other intimidating thing is my res folder does not show any errors and my xml file does not contain any capital letters.
It must be some silly error which is causing this?
Perhaps you should take a look at this if you've recently updated SDK tools.
After updating to SDK Tools to rev. 22 for the first time, you may need to relaunch Android SDK Manager again and install a new item: Android SDK Build-tools.
After installing this, clean your projects and rebuild.
this happened to me after updating the android dev kit and esclipse.
couple of things you should try.
if you updated ADT, you must restart ADB server. you probably haven't read the message that says after update. or maybe restart whole pc.
if you're using external jar files, rename the libs folder to lib and revert it back to libs (from eclipse, f2)
There seems to be a problem with the target build settings within your projects.
The R file will not be autogenerated if there is the slightest error in your project. E.g if you use elements in a layout xml file that are available only in Android 2.2 but your project targets android 2.0. Sometimes the offending elements don't show up as errors because, syntax-wise, they are correct.
I advice you look at your target builds in android manifest.
Or target a higher android build (Get the latest one via SDK manager)

Failed to create the part's controls

I get a null pointer exception opening about half of the android XML files in my layout directory. There seems to be no pattern to why some files open and some files don't.
I upgraded eclipse to Juno. Re-installed all the plugins (ADT), re-installed the android SDK. I brought in my old workspace and adjusted my projects to point at the new android SDK.
Stack
java.lang.NullPointerException
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.setLocaleCombo(ConfigurationComposite.java:1566)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.syncRenderState(ConfigurationComposite.java:3049)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1158)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:679)
at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:359)
at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:1081)
at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:607)
I found one way to resolve this. My eclipse recently crashed (and wouldn't start again) for an unrelated reason. To get it to start again I deleted most of the files in ${workspace}/.metadata/.plugins. These files regenerate (but will wipe some of your saved plugins and settings). Resolved my startup problem and my xml editor problem.
Just close all the xml files and restart your Eclipse SDK
An additional solution that worked for me and might work for others:
Create a new workspace and import your existing projects into it. I felt a little better about trying this than I did blowing away or moving my .plugins directory in the existing workspace. After I created the new workspace and imported the project that was giving me the cryptic "Failed to create parts controls" message, it worked fine. I'm pretty sure it's something bad in the .plugins or elsewhere in the old workspace, but I'll just keep using this new one until it starts to crap out on me.
Note that this can also happen if the containing folder contains too high a resolution
Example:
layout-sw500dp (this folder works okay)
layout-sw1000dp (this folder causes "Failed to create the part's controls" error)
I finally found out...
I had the problem even after deleting and setting a new copy of eclipse. The problem was because of the wrong Java version. You should find the right Java version for your eclipse.
In my case I have a project which uses Java 8 and for that I use eclipse Luna. But my other project which I develop it vie eclipse kepler uses java 6 (The project with the problem!).
Since Kepler and Java 8 are not compatible, I got this weird behavior from kepler. As soon as I ran Kepler via Java 6, everything was back to normal.
If you wanna know how to sets different Environment Variables and sets your Windows Path without setting up the Environment variable everytime for each project, let me know, I would be happy to share how to write a batch file to do that...

How do I make a basic App Engine Connected Android Project?

I'm new to this, so please bear with me. I simply want to get the basic App Engine Connected Android Project to work in eclipse.
I first downloaded Eclipse 3.7 and the Android SDK. I installed the ADT plugin through eclipse. I configured eclipse to point to the sdk and created an android project. I added some widgets, messed around with SMS messages, and ran it on my phone. Worked like a charm.
Then I decided it was time to work with app engine. I downloaded the Google plugin for eclipse from within eclipse using this link http://dl.google.com/eclipse/plugin/3.7. I also downloaded the Google App Engine Java SDK from that link.
Ok, here's where it gets more fun. I created a new app engine connected android project and named it "TestProjectThree". I then clicked "Debug as->local app engine connected android project". On the console I got a url, but on my phone I got a black screen. I then noticed that there was nothing in the android/gen folder, so I did a clean build of both projects. Suddenly, it gave me 10 warnings.
"Cannot fully validate context since domain type com.testprojectthree.server.HelloWorldService is not available.
You must run the ValidationTool as part of your server build process."
I googled the problem and found this link http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation.
I began following the instructions. I tried to enable annotation processing, but it was already enabled. I tried to add the requestfactory-apt.jar to the factory path, but it was already there too.
Apparently now I need to run something called an Annotation Processor. I've never used Maven before but I right click on my android project->configure->convert to Maven project. I do a clean build and a POM file appears. I then copy all of the XML from that link to the line right above the /project line in the POM file. I copy the second bit too because I'm using indigo. Clean and build again. New error.
"/TestProjectThree-Android/gen already exists but is not a source folder. Convert to a source folder or rename it."
No idea what that one means either, but I see right click gen->build path->convert to source folder so I click that too. Clean and build again. NO ERRORS!! YAYAYAY!!!
Debug as local app engine connected android project. Got a black screen on the phone, and some sort of error in eclipse. “Source not found”. Looked for a more detailed error message but the console just has the app engine url on it and logcat looks empty.
I went back to the link about the validation tool and read all the comments. A lot of people seemed confused. I have no idea if I did it right, or did any of it right, and am very lost now. Please please please help me!!!
This sounds very similar to a problem I had, although not exactly.
I think the code generated by the AppEngine project that is used by the Android project is either not generated correctly, or needs a refresh.....and clean doesn't do it.
Try this:
First, make sure the requestfactory-apt.jar was in the "Factory Path" of "Annotation Processing" in the "Java Compiler" section of Project Properties.
In AppEngine project.
Properties-> Java Build Path, Source section. Select the ".apt_generated" entry and then "edit…" and rename it, by putting a "1" at the end of the name (or whatever).
Project -> Clean
then in Android Project
Properties-> Java Build Path, Source section.
Select the "apt_generated" source folder that is linked to the ".apt_generated" source folder in the AppEngine project.
"Edit…", then in the first line "Linked Folder Location" navigate to the NEWLY named folder in the AppEngine project (the one with the "1" at the end……)
Then Project -> Clean
Then build & run your Android project, it should now have newly generated RequestFactory code from AppEngine project and validate OK at runtime.
It's possible that closing and opening projects and cleans were also required.
Use parse. I tried using AppEnging for my app's backend, but parse seems to take care of a lot of backend jobs and makes life extremely easy https://parse.com

Eclipse Projects not loading in my Package explorer?

i was developing Android applications on my macbook pro after which i had to shift to the iMac at work. So i copied my Eclipse directory and the android sdk and the workspace and pasted it on the iMac at work.
I have set the Android sdk root inside the preferences of the Eclipse but the workspace is not loading inside my package explorer?
i have made the workspace folder inside the documents folder where it was in my macbook pro.
When Eclipse starts i choose the specified path of my workspace and then start eclipse.
Why are my workspace projects not being available in my package explorer?
thank you in advance.
EDIT:
i imported the project into my workspace. But there was .classpath 5.0 compatibility error, so i right clicked on my project and clicked android tools -> fix project properties. That error regarding .class path compatibility went away but a new error came in which the whole src folder inside my project has errors.. i mean each and every class.
And the error is regarding classes that come in the Android library...for eg. it is giving me error in the getCount method saying there is no such method in a class i used to extend the BaseAdapter class..what is going wrong here?
i have cleaned my project several times, but no change.
I just experienced something similar - had to create a new workspace and import the projects from my previous workspace to make it work. Pretty annoying, but it seems to be a bug in Eclipse.
Make sure that the build path of the project links correctly to the Android SDK. Right click on the project and choose configure build path and make sure that there are no red marks there.
Your project list is stored at .metadata.plugins\org.eclipse.core.resources\projects\, so you might want check that file to see if your projects are there.
from : Eclipse - No project visible in explorer
What helped me is i went to the package explorer and on the right site click the menu i.e. go to Filters -> Non Shared Projects. Remove that check mark. Then i see all projects.

Categories

Resources