how to open projects from developer.android.com? - android

I downloaded the "LocationAware.zip" from http://developer.android.com/training/basics/location/geocoding.html. How to open this project in Eclipse now?
I would like to open it in Eclipse and then hit run to see how to run this app in the Emulator.
(new to Android - so sorry if the question is too basic)

To run the project you mentioned in Eclipse, hit
- File->New->Project
- Choose "Android Project From Existing Code"
- Choose the root directory, hit finish.
Some extra steps you might need to take care after creating project (if there are errors)
1. Click Project->Clean (so that Resources "R" will be automatically generated)
2. If there are some XML errors, try to change Android Build Target (right click on project folder->Properties->Android)

Related

Adt eclipse phantom error

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

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.

Could not find apk

I installed Eclipse/ ADT in Ubuntu on my computer. I am able to run Chapter 4 To do list examples Part 1-3 successfully (of Reto Meier's PA4AD book), but when I run Chapter_4_Compass, I get the following error. Please help immediately:
[2013-05-20 18:34:55 - Chapter_4_Compass] ------------------------------
[2013-05-20 18:34:55 - Chapter_4_Compass] Android Launch!
[2013-05-20 18:34:55 - Chapter_4_Compass] adb is running normally.
[2013-05-20 18:34:55 - Chapter_4_Compass] Could not find Chapter_4_Compass.apk!
Thanks,
Shekar M.
Right Click on your app -> properties -> android. Uncheck 'Is Library'.
If you are using Android SDK Tools v22, make sure that you have the most up-to-date versions of Android SDK Platform-tools and Android SDK Build-tools also installed (rev. 17).
1) Open the Android SDK Manager
2) Update all of the items in the tools folder
*This may require you to restart the SDK manager a few times.
Here is somthong that just worked for me. I had the same problem as the original poster after moving a project from my PC to a laptop and back again to do some programming whilst on the go.
I tried everything suggested by CRUSADER much of which has worked for many others on SO (if you read the other threads on this subject).
What I noticed was that in the project's Bin directory the APK file was not there. Instead there was a Jar file containing the project name. I know as some point during the build and run process a jar gets initial made and then converted to an APK (Dexing I believe part of this process is called).
Anyway to cut a long story short. I got an APK from one of my earlier project backups. Pasted it into the bin folder folder and now I'm able to build and run my project again.
Weird but it works, like so much of Android/Eclipse.
Try following steps:-
Restart Eclipse (Solves issue most of time...)
Right-click your project and select Android tools --> Fix project
properties.
Right-click your project and select Build path --> Configure build
path.. In here, check if all libraries are imported correctly..
If above doesn't works then go to Help --> Install new software and
then Help --> Install new software . Follow this steps till your
eclipse says no update found or its upto date..
Restart Eclise once again..
Hope this helps..
Maybe it's a little old post, but someone can have similar problem. I had an ' Could not find android-support-v7-appcompat.apk!' error.
I had to remove appcompat from Java Build Path and add a .jar with the same name.
Right click your project -> Properties -> Java Build Path -> Projects
There I had android-support-v7-appcompat project. Remove it.
Now click Libraries tab.
Your android-support-v7-appcompat.jar should be missing. Click add 'JARs...' and:
If you have android-support-v7-appcompat project in your workspace, expand it go to bin folder and there you have it :D Select it and hit OK. It should work now.
If you DON'T have android-support-v7-appcompat project, click 'Add External JARs...' and go to "drive:\your android sdk\extras\android\support\v7\appcompat\libs\".
There you should have your jar.

"Selection cannot be launched and there are no recent launches” when Eclipse for Android Project Dev

I am trying to open an unzipped Android Project using Eclipse but every time I try to run or debug it show this error: "selection cannot be launched and there are no recent launches".
So I looked it up and tried creating a new project from an existing source but opens with errors and I open the src etc folders. I also tried importing the project which didn't work either. There are no run as options and changing the run configuration didn't really help. I couldn't find any option to open it as an Android project.
Could you please help me to run this project.
(Since I unzipped this project there is a _MACOSX folder when I import and I am not sure if that matters or should I remove that folder.)
I am running Eclipse Juno SR 2
I had a similar problem. To fix the issue go to Run-> Run Configurations...
If there isn't create a new run configuration (top left)
Under Android tab: browse and select the project you want to run
Under Target tab: select Always prompt to pick device (or) you can pick automatic launch.
Similar solution can be applied to the Debug by going to Run-> Debug Configurations...
Update:
I realize this is beyond the scope of the question but if any new developers are coming to answer then I would suggest switching to Android Studio from Eclipse. AS is the official Google supported IDE for Android development and much nicer to use.
In the Package Explorer (the left column), right-click on the name of the project (the top item). In the menu that appears, select "Run as"; then choose "Android Application".
I fixed it for Version: Luna SR2 (4.4.2)
select run configurations from right side dropdown of run button.
double click on android application.
get changing window, select your project name by browsing button of "android" tap(there are 3 tabs).
from "target" tab select ADT or your device, in which you want to run.
then press "run" at right -bottom button, left-side of "cancel".
after few moment, you will get new windows. from there you can select your connected device or ADT.
If this file is and .apk, you should install it on emulator using following command:
adb install /path/myfile.apk
For more informations, you can chek following link: http://developer.android.com/guide/developing/tools/adb.html#move
Generally this error comes in eclipse IDE when you don't have a main() function in your code.
Check whether your program has public static void main(String [] args) in it or not.
I'm using a mac and this answer is for Kotlin inside Eclipse
I installed Kotlin from Eclipse MarketPlace, clicked the perspective tab , opened Kotlin, created a new Kotlin project named FirstProject and then clicked src and created a Kotlin file named FirstFile (it had the .kt extension) and typed in
func main(args : Array<String>) {
println("Helooooooo")
}
I pressed the green Run button but kept getting this screen.
To fix it, follow these steps:
Right next to that green run button is a drop down arrow, press it then choose Run Configurations
On the left side of the accompanying screen click Kotlin Script Launch Configuration and in the drop down click New_configuration then select Run
After the screen disappeared when I pressed the Run button again I got the same exact "This selection cannot be launched ..." screen. I deleted the project FirstProject and created another one SecondProject > src > Kotlin file > named it SecondFile, typed in the println("Heloooooooo") code and a screen popped up
I choose OK and the project ran fine.
For steps 1 & 2 I also did the same thing and choose Gradle (you can see it the picture) but I don't think that made any difference.

How to run example Android code

I'm going through some of the Android tutorials and am having trouble running on of the example projects. This page explains how to put ads in a project and it links to an example project (http://dl.google.com/googleadmobadssdk/examples/android-banner-essentials.zip). I downloaded the project, but I don't know how to run it. I tried "Import" in Eclipse, but I couldn't find any way to do it. I also tried making a new project, then deleting all the files and replacing them with the files from the example, but then it says "Resource is out of sync with the file system: '/AndroidBannerXML/AndroidManifest.xml'".
In Eclipse :
From the Eclipse menu, click File > New > Project...
From the Select a wizard window, select Android > Android Project from Existing Code, click Next.
From the Import Projets window, set Root directory to where the samples are (normally C:\Android\adt-bundle-windows-x86\sdk\samples\android-17\ ); check Copy projects into workspace; click Finish.
The sample application will appear as a project in the Package Explorer.
Run the package as you would any Android project (Run > Run As, ...).
Ok, in Eclipse, click
File
New
Project
select Android Project
Then check the radio button labeled "Create Project from Existing Source"
Then just browse to the project. It will fill in most of the data needed like API level.
PS: For a good tutorial on adding adds, see the link, there is about 6 videos elling you how to add admob and publish your app.
http://www.youtube.com/user/thenewboston#p/search/0/8IerupLaakE.
try to right click on project and refresh to sync files
If you don’t install any ADB Driver then you need to download it first from the link here : click here:
http://developer.samsung.com/android/tools-sdks/Samsung-Andorid-USB-Driver-for-Windows
Install the driver in you windows.
Now you open your android code and right click on the project you have made or create a new project and make a program that you want to run. I have already made a SilentToggleMode code. Just right click and go to Run As > Run Configurations.
Then you can see a configuration window. You need to expand Android Application > SilentToggleMode. On the right, you go to Target and enable by click Always prompt to pick a device.
After that click Apply from the bottom of the window. Now you can click Run from the window bottom or close the window and click Run from the eclipse menu bar and choose your application. Then you can see a window from which you can choose your android device, you select it and click OK.
You will be happy now to see that your program is running in your device.
For details, Please follow the link below:
Run Android Program on Android Device

Categories

Resources