cmark / androtext

Xtext based model-driven software development tool for prototyping Android applications
7 stars 1 forks source link

Unable to build and run the examples #14

Open svetlin opened 10 years ago

svetlin commented 10 years ago

Hi,

Could you please provide step-by-step instructions of how to build and run the examples?

I was not able to build and run the examples in the hu.bme.mit.androtext.examples project.

This is what I did. After deleting the *.validation projects I ran GenerateAndroTextDSL.mwe2 as a MWE2 workflow. Then I ran as an Eclipse application the hu.bme.mit.androtext.lang project which spawned a new instance of the Android Eclipse bundle. There I imported as a general project hu.bme.mit.androtext.examples. Then I opened a file in that project, entered a space, deleted it and saved it (to start the generation). I've got a hu.bme.mit.androtext.examples.gen project in which the src folder did not build as it has an incomplete build path (java.lang.Object not found). I tried to fix by adding a 1.7 JRE container. Then I've got a lot of errors regarding missing Android Container. I've added a project.properties file with content target=android-18 which allowed me to add the Android 4.3 container. This got rid of the errors in the src folder. Now I am getting an error: R cannot be resolved to a variable in the src-gen folder.

Is all of this correct? What should I do further? I cannot add hu.bme.mit.androtext.examples.gen as an Android project because it does not build so that I can try to clean.

Please advise. Thanks!

svetlin commented 10 years ago

UPDATE I tried to import directly the hu.bme.mit.androtext.examples.gen project after generation as an Android project (without adding a JRE and Android container to the project properties).

I got these two resource errors: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/ic_tab_artists_white'). ic_tab_image.xml /hu.bme.mit.androtext.examples.gen/res/drawable line 5 Android AAPT Problem No resource found that matches the given name (at 'drawable' with value '@drawable/ic_tab_artists_grey'). ic_tab_image.xml /hu.bme.mit.androtext.examples.gen/res/drawable line 4 Android AAPT Problem I commented out the two offending lines in ic_tab_image.xml and upon rebuild the error: R cannot be resolved to a variable in the src-gen folder went away.

However, upon starting using a 2.3 emulator and getting to the main screen, clicking on every list entry does nothing -- see the attached screenshot.

device-2013-10-16-164329

Thanks for your help!

svetlin commented 10 years ago

I don't see use of onListItemClick anywhere in the .androtext example, and there is no OnClickListener in the generated Android code.

So is this a still incomplete example that needs a bit more work?

cmark commented 10 years ago

Check out the ExampleListActivity class. It has a very simple map, which maps the list item index to the Activity, so if you put this code into your ExampleActivity, then it will work as expected. I did not had time to finish this part of the project (proper navigation between Activities).

This project is more of a showcase, than a real-life tool.

svetlin commented 10 years ago

Yes, putting the map into the generated hu.bme.mit.androtext.examples.gen/ExampleListActivity class works.

You say your project is a showcase, but if put together with the md2 project (also here on Github) it could be used for some production quality cross-platform mobile development. Your project has more UI-related components and is Android-specific. Whereas theirs is more remote data provider oriented and generates to Android/iOS/web backend. So your project holds a lot of promise and I would not abandoned it just yet...