Looks like my previous instrutions for Api Demos don't apply for the new Simplewiktionary project for Android.
Even File->Import and other variations are failing. I discovered that something new and more specific was required. You might be wondering why I'm even bothering to blog this. Well, it seems that there are many wrong ways to get these sample projects into Eclipse. It seems that the 'art' is find the few right ways to do this.
1. Start Eclipse
2. File->New->Project->Android->Android Project
3. Click on the 'next' button
4. Choose your build target
5. Uncheck the 'Create Activity' checkbox
6. Specify the Project Name as 'WiktionarySimple'
7. Uncheck the 'Use default location' checkbox
8. Click on the 'Browse' of the Location textbox and go to the WiktionarySimple directory created by unzipping latest_samples.zip in the directory of your choice.
9. In the contents area, select the radio button 'Create project from existing source'
10. In the properties area, set the application name to 'WiktionarySimple'
11. Click the 'Finish' button
12. If these steps were followed, when Eclipse is done updating the workspace, the WiktionarySimple project will be compiled and the R.java file will be generated in the project.
Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts
Monday, January 4, 2010
Saturday, January 2, 2010
Creating Android Sample Application
Recently, Android 2.0 had some new sample projects added. They are available as a .zip file from the Android developers site. However, if you unzip and import a project, something wrong happens. The R.java is not generated. The instructions for importing these sample project are as follows from the Android developer site:
You can easily create new Android projects with these samples, modify them if you'd like, then run them on an emulator or device. For example, to create a project for the API Demos app from Eclipse, start a new Android Project, select "Create project from existing source", then select ApiDemos in the samples/ directory. To create the API Demos project using the android tool, execute:
android update project -s -n API Demos -t -p /samples/ApiDemos/
The given instructions give 2 possible actions. The first, as indicated previously, does not work. The second action uses the 'android' executable which is part of the SDK. The options given do the following:
update project : updates an existing android project
-s : only errors produce output (silent mode)
-n : name of new android device (in this case it is 'API Demos'
-t : target id of new android device
-p : Location path of the directory where the new AVD will be created
If you run the above 'android' command-line, you will get the following result:
Updated default.properties
Updated local.properties
File build.xml is too old and needs to be updated.
Added file /home/me/Projects/A20/samples/ApiDemos/build.xml
Updated default.properties
Updated local.properties
File build.xml is too old and needs to be updated.
Added file /home/me/Projects/A20/samples/ApiDemos/tests/build.xml
So, neither of the above procedures really lets you create one of the sample projects for use. The entry will show you the right way to do this for the new ApiDemos sample.
1. The ApiDemos project is an Android 1.6 project. So, in general, make sure before using any of the sample projects that you have the right SDK version installed.
2. Start Eclipse.
3. File->New->Project...->Android->Android Project
4. click on the 'next' button
5. In the next window that appears, select the radio button 'Create Project from existing source'
6. Click on the 'Browse...' button next to the 'Location' text box.
7. Browse to the directory that contains the ApiDemos directory from the latest_samples.zip file.
The 'Location' text box should have a path like /path/to/latest/ApiDemos
8. Select OK
9. In the 'Build Target' area, select the 'Android 1.6' build target.
10. Select the radio button 'Create Project from Existing Sample'
11. In the 'Samples' drop-down, select 'ApiDemos'
12. Click on the 'Finsh' button
13. If this is succesful, the ApiDemos project will build with no errors and the R.java files will be generated automagically.
The above method should be used for the other samples, too. If you do not, the R.java file will not be generated.
You can easily create new Android projects with these samples, modify them if you'd like, then run them on an emulator or device. For example, to create a project for the API Demos app from Eclipse, start a new Android Project, select "Create project from existing source", then select ApiDemos in the samples/ directory. To create the API Demos project using the android tool, execute:
android update project -s -n API Demos -t
The given instructions give 2 possible actions. The first, as indicated previously, does not work. The second action uses the 'android' executable which is part of the SDK. The options given do the following:
update project : updates an existing android project
-s : only errors produce output (silent mode)
-n : name of new android device (in this case it is 'API Demos'
-t : target id of new android device
-p : Location path of the directory where the new AVD will be created
If you run the above 'android' command-line, you will get the following result:
Updated default.properties
Updated local.properties
File build.xml is too old and needs to be updated.
Added file /home/me/Projects/A20/samples/ApiDemos/build.xml
Updated default.properties
Updated local.properties
File build.xml is too old and needs to be updated.
Added file /home/me/Projects/A20/samples/ApiDemos/tests/build.xml
So, neither of the above procedures really lets you create one of the sample projects for use. The entry will show you the right way to do this for the new ApiDemos sample.
1. The ApiDemos project is an Android 1.6 project. So, in general, make sure before using any of the sample projects that you have the right SDK version installed.
2. Start Eclipse.
3. File->New->Project...->Android->Android Project
4. click on the 'next' button
5. In the next window that appears, select the radio button 'Create Project from existing source'
6. Click on the 'Browse...' button next to the 'Location' text box.
7. Browse to the directory that contains the ApiDemos directory from the latest_samples.zip file.
The 'Location' text box should have a path like /path/to/latest/ApiDemos
8. Select OK
9. In the 'Build Target' area, select the 'Android 1.6' build target.
10. Select the radio button 'Create Project from Existing Sample'
11. In the 'Samples' drop-down, select 'ApiDemos'
12. Click on the 'Finsh' button
13. If this is succesful, the ApiDemos project will build with no errors and the R.java files will be generated automagically.
The above method should be used for the other samples, too. If you do not, the R.java file will not be generated.
Subscribe to:
Posts (Atom)