Messed up in Eclipse after viewing a sample project - android

I imported a sample 4.0.3 project and after deleting it from the Project Explorer list every thing is lost, now there are none of the projects that I was working before in Package Explorer??
Moreover now on importing these old project For Example name "On" are coming with the name "OnActivity" but still not able to run.
Else in workspace every file is ok, I tried to CLEAN but still no effect.
I'm new to devlopment kindly guide me.

Recover the source code from your workspace in the Windows file browser. If all attempts to recover fail, you can just create the projects from existing (recovered) code.
And what project are you trying to run? If APIDemo or QAActivity, the log shows you why you can't run them.
And instead of using the Play button (start) to launch, use the dropdown triangle and select the project to run, else the XML will be run (obviously that won't work).
Furthermore, make sure Eclipse knows it's a Android Project you're trying to run.

Related

Android Studio can't run or sync imported project with gradle files

I'm new with almost zero experience to Android Studio and i'm trying to change some settings of an APK.
First i decompiled the APK and then i imported it to Android Studio.
At this time, Android Studio shows me this:
My goal is to run the APK project on an emulator. This mean that i have to press the run button, which is disabled at this moment. After a research i made, i read that i have to sync the project with gradle files, but the sync button is not visible, as you can see on the screenshot above.
Can anybody give me a hint of what to do because i'm stuck here for a long time. Your help will be appreciated.
Thank you very much for your time!
You can't just Decompile an application and then using it inside another project as the new one.
The only thing you can do-use is, checking the java codes or xml codes of the written application to see how it works.
The point is, it won't work like that and you're doing it wrong. However, you'll be able to see not obfuscated java-xml codes inside the application. You can't just import it inside the Android Studio as a new Project like that.

Android Studio is confusing my projects with one another

I'm running Android Studio 3.1.1 on OSx and I have three projects that all use the same local library projects / modules.
My problem is that Android Studio often opens the wrong project when I open one of those 3 projects. Let's say I open Project 2 or Project 3, then I might find that Project 1 is the project that is actually opened, even though it displays the correct path for all three in the "Welcome to Android Studio" dialog.
The solution I've been resorting to until now is to
Remove all three projects from the "Welcome to Android Studio" dialog project list
Go into all three project folders, removing the .iml file
Importing the projects back into Android Studio using the "Import project" function
I'm getting really tired of this, and it's really confusing to think that you have opened one project but another one opens instead.
What could be causing this very strange behaviour?
Sometime android_studio is catching the old cache, to solve this go file , hit invalidate cache and restart. And the second solution is, you have to Refactor the package name, every project should have the unique package name in this situation. i hope this will help...
https://developers.google.com/android/guides/google-services-plugin
go to this official link. It solved me this problem. In my case, ] deleted saved file in this path "app/build/generated/res/google-services/{build_type}/values/values.xml" which contains my previous app's information. After that, when I run my current app, it created that file again, but with my current app's info.

How to refresh A Project in Eclipse

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.

Exported Eclipse Android project won't run from Android Studio

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.

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

Categories

Resources