[Solved] Lost with creating Android project structure lazarus / 43-Android ---------------------------------------------------------------------- huberte · 2012-04-18 01:43 Hi, Could it be possible to show me something more explicit than http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android QuoteThings to change are the path to the SDK, the package name. The package name needs to be updated in the build files, in the directory structure android/src/packagename, in the activity java source code and also in the main library pascal source in the exports section. I'm quite lost. thks. ---------------------------------------------------------------------- huberte · 2012-04-18 19:06 Can someone explain me which file from androidlcl I have to modify, copy or paste to build my own app ? I'm using the vbox image. http://pastebin.com/37WtWFSH thanks. ---------------------------------------------------------------------- huberte · 2012-04-19 00:29 spent about 10 hours on this I'm gonna make a first part : QuoteTo create a new LCL-CustomDrawn-Android application simply copy all of the file structure and build and java files from the example project called "androidlcl". This example can be obtained from the Lazarus source tree in lazarus/examples/androidlcl done, but I don't know where the build and java files really are... QuoteYou need a separate LPI at the moment for the Android version of the application but all the rest of the code can be shared. Create it using the template for a "Library" and then adapt the code from the example located in the lazarus source code in lazarus/examples/androidlcl Library ? : http://wiki.lazarus.freepascal.org/shared_library ? QuoteThen you will need to modify the build files to change them to your new project name and your new Java package name. Lost ---------------------------------------------------------------------- felipemdc · 2012-04-19 07:44 Quote from: huberte on April 19, 2012, 02:29:35 amQuoteTo create a new LCL-CustomDrawn-Android application simply copy all of the file structure and build and java files from the example project called "androidlcl". This example can be obtained from the Lazarus source tree in lazarus/examples/androidlcl done, but I don't know where the build and java files really are... The file structure of the example project looks like this: lazarus/examples/androidlcl/* lazarus/examples/androidlcl/android/* lazarus/examples/androidlcl/android/src/com/pascal/lcltest/  <-- Here is the java source file Note com/pascal/lcltest is the *package name* of the project. You need to decide your own package name. And then create your own structure: myproject/ <- here copy everything from androidlcl/ myproject/android/src/com/mycompanyname/myprojectname/ <-- Here put the java source file All changes need to be reflected in the ANT build files. Also open the java source file, I think you will need to change the package name there too. And you will also have to change the package name in the exported routine names in your main library file. QuoteLibrary ? : http://wiki.lazarus.freepascal.org/shared_library ? Yes QuoteThen you will need to modify the build files to change them to your new project name and your new package name. Open the directory lazarus/examples/androidlcl/android/ Now read *all* files directly inside this directly using a text editor. Note all the places which have paths, project names and package names. ---------------------------------------------------------------------- huberte · 2012-04-21 22:50 thanks QuoteAll changes need to be reflected in the ANT build files. Where ? QuoteAnd you will also have to change the package name in the exported routine names in your main library file. Link ? Cause I have many many files in the example folder's root (androidlcltest (lpi, lpr lps) mainform non androidtest secondform) QuoteQuoteLibrary ? : http://wiki.lazarus.freepascal.org/shared_library ? Yes Not helping further. I thought I could add this line  Code: [Select]library androidlcltest; to the top of my own project. QuoteOpen the directory lazarus/examples/androidlcl/android/ Now read *all* files directly inside this directly using a text editor. Note all the places which have paths, project names and package names. Seems there is only build.sh unless I have to open ALL files in all folders. For example, here are the file with LCLexample : QuoteSearch "LCLexample" (3 hits in 3 files)  \android\.svn\text-base\build.sh.svn-base (1 hits)    Line 3: ~/Programas/android-sdk-linux/platform-tools/adb install bin/LCLExample-debug.apk   \android\.svn\text-base\build.xml.svn-base (1 hits)    Line 2:   \android\build.xml (1 hits)    Line 2: AndroidManifest needs to be update too, right ? How ? Using a texte editor ? Step 3 is driving me crazy QuoteBesides the LCL project building, such as configuring a proper LPI and having a library main project file, one also needs to add all of the android project structure. Simply copy from the example project in lazarus/examples/androidlcl and adapt it to the new project. Things to change are the path to the SDK, the package name. The package name needs to be updated in the build files, in the directory structure android/src/packagename, in the activity java source code and also in the main library pascal source in the exports section. ---------------------------------------------------------------------- huberte · 2012-04-22 02:50 Ok Here am I: Changed Project Nme in folder and files (see previous post) Changed AndroidManifest with texteditor I did verify build options (cf wiki). I think I miss something on step 3. I end with a myproject-debug.apk (why debug by the way ?) but still with the two forms from the example (I did create two other form for testing, named the same way : mainform and secondform). when this work is done I copy myproject folder into the vbox image and start ant debug Like I said, I think I missed smthg, cause it seems that old entries are still there in : .svn\text-base\mainform.lfm.svn-base, lib\arm- linux\mainform.lfm (seems to be building files but how can I build ?) thks again for your help ---------------------------------------------------------------------- felipemdc · 2012-04-22 10:13 Quote from: huberte on April 22, 2012, 12:50:57 amQuoteAll changes need to be reflected in the ANT build files. Where ? http://svn.freepascal.org/cgi- bin/viewvc.cgi/trunk/examples/androidlcl/android/?root=lazarus QuoteLink ? Cause I have many many files in the example folder's root (androidlcltest (lpi, lpr lps) mainform non androidtest secondform) The main projet file for Android. Might be lpr or pas. In the example project it is this one: http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/examples/androidlcl /androidlcltest.lpr?view=markup&root=lazarus QuoteNot helping further. I thought I could add this line  Code: [Select]library androidlcltest; to the top of my own project. You should have 2 separate LPI files each with a separate LPR main program file, one for Android and for non-Android. QuoteSeems there is only build.sh unless I have to open ALL files in all folders. For example, here are the file with LCLexample : Search "LCLexample" (3 hits in 3 files)  \android\.svn\text-base\build.sh.svn-base (1 hits)    Line 3: ~/Programas/android-sdk-linux/platform-tools/adb install bin/LCLExample-debug.apk   \android\.svn\text-base\build.xml.svn-base (1 hits)    Line 2:   \android\build.xml (1 hits)    Line 2: Search? Which search are you talking about? There is the proper list of files: http://svn.freepascal.org/cgi- bin/viewvc.cgi/trunk/examples/androidlcl/android/?root=lazarus As you can see there are many files. Not only build.xml The .svn folder should be always ignored. It is Subversion internal files. You should delete the .svn folder in your project if you are making a copy of this folder from lazarus. QuoteAndroidManifest needs to be update too, right ? How ? Using a texte editor ? Yes, use any plain text editor. Lazarus also works as a text editor for example. Quote from: huberte on April 22, 2012, 04:50:37 amI end with a myproject-debug.apk (why debug by the way ?) Because it is signed with a debug key intended for development. For proper distribution in the Android market you need a release signing process. Quotewhen this work is done I copy myproject folder into the vbox image and start ant debug And what happens then? It works? ---------------------------------------------------------------------- huberte · 2012-04-22 13:33 QuoteQuote when this work is done I copy myproject folder into the vbox image and start ant debug And what happens then? It works? Sorry, I was not  so clear. No, I still end up with the two old forms (in the apk) from the example while I changed those two forms (lfm, pas files). Do I miss something, do I need to build something before the apk ? It's very confusing ---------------------------------------------------------------------- felipemdc · 2012-04-22 17:08 Quote from: huberte on April 22, 2012, 03:33:40 pmSorry, I was not  so clear. No, I still end up with the two old forms (in the apk) from the example while I changed those two forms (lfm, pas files). Do I miss something, do I need to build something before the apk ? Yes, you need to build the library (your project) in Lazarus before building the APK. The project should be configured to automatically place the compile library in android/libs/armeabi/ like the example does. You can delete older .so file to make sure you are creating a new one. If you change the name of the library then you need to reflect that in other places. I don't remember where exactly, I think that in android/src/com/pascal/projectname/something.java somewhere there in the end is the name of the library to load.