I am trying to use eclipse and sl4a to create an android app for my tablet. I am following the procedure mentioned in this blog.
http://jokar-johnk.blogspot.com/2011/02/how-to-make-android-app-with-sl4a.html
I have my python scripts already compiled.
I need to make a '.apk' file using these python scripts, such that when I run the app in android, it should do what it is supposed to.
To create the '.apk' file, I am using eclipse with pydev plugin.
I created a clone of sl4a repository and imported to eclipse.
When I am creating a new project for android app development, I am not sure where to import my python scripts and embed them such that, at last I have an executable '.apk' file.
When I create a new project in eclipse, I see couple of folders like src, gen, res and several files under them. Where do I need to place my python scripts now? Do I need to create a separate folder under the project and directly import my python scripts or put them under src/gen/res?
As it says in that guide, you don't create a new project, you make a copy of the ScriptForAndroidTemplate template app, then:
"Right click on your_script_name then open with text editor. Delete
the default script, replace it with your own and save. Then
Clean/Build/Refresh your project and run it."
And it should work!
Re-read (and follow) the tutorial if you're still stuck. Good luck!
Related
I am working on a Java application that will run on an embedded system - a custom android build or modified AOSP. It is built on a linux server.
I would love to use an IDE like Eclipse with all its goodies like code completion, source code checking etc. but it seems very complicated. I looked at Puri's blog here
for one, the build process of our custom android uses Android.mk makefiles.
How can I (Should I?) modify the Eclipse build process to build the custom android build?
You can use either eclipse or studio to maintain a custom, pre-installed application.
In either case, you will not use the IDE to build the actual application image. That will be built as part of the make from the root of the AOSP install(1)
You can, however, create a project whose root is the directory in either /device or /package that contains your app.
Once you've done that, read the Android.mk file to find dependencies. Add them to the project as you would for any other project, for your chosen IDE.
If you go for eclipse, I suggest that you put the build directory somewhere in /out, or outside the AOSP directory altogether. If the root make file finds it, it can be a problem.
When you need to test your app on a device or an emulator, use mm to build only your app.
Better yet, if possible, do most of the development for your app as you would any stand-alone app, so that you can easily install and test it. Only put it in the AOSP directory as part of the release process.
Note, you can use either eclipse or studio to kick off that system
build. In eclipse, use External Tools. Studio provides similar
capabilities
This may sound like a stupid question with a "duh" answer but I'm really new to this.
I have a HTML/JS project I created in Eclipse. Can such a project be exported as an Android application or .apk?
Or does a new Android project need to be created and programmed in Java for what I'm trying to achieve?
(I know about Phonegap and it is not suitable for my project as it doesn't have support for WebGL that I need)
There are a few libraries, tools which will pack your code into a webview. So with some work you can create multiplatform web implementation, and the build too, ofc ( apk, ipa )
Check the Google for more, but one is popular: Phonegap.
Google: "platform independent web based mobile" "framework" " solutions"
You can open your eclipse project by Dream Weaver and build it by phone gap .
the integration between phone gap and Dreamweaver support all versions of WebGL .
Since you are using Eclipse (and for all the others who do), the .apk file of the latest compilation you did is always found in the /bin folder of your project
Just starting with Phonegap and having some trouble understanding the directory structure and setup (on Windows).
I have been able to install and setup phonegap, jdk, android sdk, ant, etc. Using the command line I can now create a new project, edit the source files in www , build it and run it on my phone, Android Emulator and even Genymotion .
But the one thing that I just can not seem to understand is how I could edit and run the Phonegap project from within Intellij IDEA. All examples and how-tos I can find use the older Phonegap 2.9 structure, which is quite different from 3.0.
I enabled and configured all plugins, etc. I then try to import the existing project folder as a new project in IDEA, but it says "Source files for your project not found".
But when I build the project first with phonegap build android using the CLI, and then try to import it in IDEA, source files are found and I can continue the import of the project. But the Project Structure then seems to point to source files in platforms/android (platforms/android itself and also platforms/android/gen and platforms/android/src , I have no idea what to choose, so I choose all). I then click Next a couple of times until the Android project is created. After changing Project Language Level to 5 (no idea what this means) , I can now run the project from within IDEA.
But... changes that I make in www (in the root) don't end up in the compiled project!
So do I have to copy all files manually to platforms/android/assets then ? (the command line phonegap builder did not require this). Or do I have to edit the files in platforms/android/assets/www directly ? (which seems odd, since I would like to be able to only maintain the same code for all different platforms).
What do I need to do to achieve this in IDEA?
Somehow I think some things in Project Structure are wrong, but I have no idea what all this means (Modules, Libraries, Facets....).
Where should the manifest file be located, and the resources, and assets and libs?!
Could anyone point me in the right direction?
After phonegap create & build , there is a whole Android project located in %my_project_root%\platform\android
if you don't have the Android SDK at left, use the green icon to add one.
That's all
We don't need to modify manually the code under %my_project_root%/platforms/* but only under the %my_project_root%/www/* and %my_project_root%/merges/*
After running
phonegap build android
it automatically replaces platform specified code.
I found solution for me the next way:
After importing source code to IDEA, I added new web module which points to the %my_project_root% to be able to see all needed directories.
Also I created new IDEA command line tool with alias phonegap and tool path /usr/local/share/npm/bin/phonegap.
So before running default android running configuration I run phonegap build android just directly from IDEA (I think it's more convenient) and then run usual android run command to deploy the app to emulator or real device.
I hope this stuff will help you.
I would like to make an small program in Windows to duplicate an android project to use it in eclipse. I know that there is an option in eclipse (New Project -> Android Project -> create project from existing source), but I would like to automate this step (doing it programmatically in Java). Is there any command, script, etc to do so? I have tried copying the project folder, renaming every reference in the new project´s files and importing the new project into eclipse using a ZIP, but it does not seem to work.
Thanks in advance.
Try working with Android Library Project may also suit your requirement
What exactly is the problem? Additionally, if you are working on multiple machines, do yourself a favour, and use some sort of version control (SVN, Git, etc.) That would make it easy to commit/checkout files across machines.
So, this is not like other problems. I have basically one question
Android project build system uses the Android.mk files.
Is there any eclipse plugin out there that parses through the mk files and allows me to load those projects into eclipse ? essentially import Android.mk file project...
You can import the whole Android sources into eclipse. The instructions are here. Then you should make some modifications (for instance, include android-common_intermediates/javalib.jar instead of google-common_intermediates/javalib.jar) and you will have possibility to develop in eclipse.
Eclipse separates Android sources to several projects by itself(I think according to classpath entries). If you want to change this behavior you should look in this direction.
If you have tried eclipse instructions at Android source site, you probably would know by now that it leaves lot of details to imagination.
One thing you need to keep in mind is that AOSP build doesn't work with eclipse. As long as you build your code from terminal and use eclipse to edit/browse/debug purposes, you will have more productive sessions.
The article at Using Eclipse to browse/edit Android platform code explains this in step by step.