how to create apk from java source code? - android

I am a newbie in Android programming language and I have a question. I would really appreciate if someone guides me in this regard.
I have java source code of an Android project (no entire project). Can I build the application without other required files such as xml file for layout and ....
Regards,
H

First of, an android application is just an "archive" that contains a specific architecture.
As you pointed out, it is composed of a Manifest (xml) file defining the different parts of your application: Activities, Services, Permissions, etc.
There is also the resources files such as layouts, pictures and files used by the application.
Finally, there is the source code.
I recommend you take a look at online tutorials which are well detailed over the Internet, and to take a look at the Android SDK samples.
To develop Android applications, I recommend that you download the Android ADT bundle (containing both Android SDK and Eclipse IDE including Android projects management).

Related

How do you use a separate .apk file in your android app?

I'm trying to display a .tiff image in an android app and it looks like .tiffs are not supported. The number one recommendation people have been recommending is to use Tiffonandroid (a google code project). Is there a basic way to incorporate a separate .apk file into an android app? I've tried to find resources online, but have come up dry. If that it more complicated then I'm imagining it being does anyone know of any .tiff converters or view libraries that would also work?
Libraries are not .apk files, they are projects or modules of code for you to use in your project. You can import them into your project and many libraries will give directions on how.

iOS and Android Code GIT Clone conundrum

I have been working on a project for both native iOS and Android apps. Now that my parent projects are done, I need to run clones for them. These clones will use more or less the same code but with different languages, resources and possibly XIB files as well. I have been using GIT for code management and I google the best way to handle this and the suggested technique was with Forking which was no good because it started creating issues with different Package IDs in the projects.
Now, you know the problem that I am facing. I am looking for expert opinion to handle this scenario.
Don't know how about Android, but for iOS you can use targets and then set which files should be used by selected target. Each target may have its own Info.plist file, different graphic assets and more.
Start with duplicating an existing target:
You will notice Info-copy.plist file, which is a setting file for the new target.
Then use a proper scheme to run your new target:
If it's not there, go to "Manage schemes" and press "Autocreate schemes now"

Android source code navigation

I recently downloaded the source code for Android. There are many folders starting from the root level and I was wondering if there is any resource on the web containing just an overview of the contents of different folders and where common libraries/framework classes reside.
Thanks.
The Android project is made by a bunch of smaller projects, all of them downloaded when you clone the Android repo (with repo init ...). I don't know if there's such a resource explaining what each project is and I wouldn't expect there is one.
Android framework classes are in their majority under frameworks/base/ directory, while apps like Settings, Browser and others can be found under packages/apps/. A really good way to navigate the sources is to use find + grep if you're under Linux. Another approach that goes SO independent is using Eclipse to navigate the sources. For this last approach, you can find the details here: http://blog.michael-forster.de/2008/12/view-android-source-code-in-eclipse.html
Note that classes in the framework that are not visible for application developers are not that well documented, so if you're planning on customizing Android be prepared to read a lot of code.
Sounds like you're after the javadocs?

Android and Blackberry project in eclipse

I'm fairly new to android and have only really been using eclipse for some basic Blackberry work so I was curious if I could pick a few expert's minds for any suggestions/pointers on the workspace/project setup you use for dual platform support projects in eclipse?
I've found about 80% of my code is common between Blackberry and Android so it's this 20% I'm needing to address.
My current thinking is to have one workspace with shared source in multiple projects via setting them in the source tree options.
Where platform specific features are used I'll tag the source name as *Android_???* and *Blackberry_???* respectively and have a generic class that both projects point to.
I.e. effectively one workspace holds both Android and Blackberry setups and in the workspace have one project for Blackberry and one for Android but each project shares the same filesystem with the appropritate other platform's source files excluded from the build.
If only there was an easy way of doing the #ifdef equivalent in java this would simplify this port but I guess we have to do it without.(I heard about using a c preprocessor to do this but sounds messy so unless it's highly recommended I'd rather not adopt this)
I'd heard about creating a shared library but have a feeling these are not compatible between android and blackberry so any advice on this approach is also welcome.
It's probably too late, but I'll still give you my thoughts on that.
I have a similar need. I have common code and Blackberry and Android specific parts. I have three separate Eclipse project for each part. The "specific" projects are the one actually run, and they both have a project dependancy (which I find cleaner than source inclusion) on the Common one.
Note that the Common project must be a Blackberry project (created using the plugin), since a Blackberry project cannot depend on a non-blackberry project.
It's working well for me!
For anyone else facing this issue I've found the solution that worked was by creating 3 directories on disk
Common
Blackberry
Android
The vast majority goes into Common however the classes that have platform specific calls go into the Blackberry/Android counterparts respectively and extend a common base class in the common directory.
E.g. a class called MyClass that needed platform specific versions would have a MyClassCommon in the common directory and in the Blackberry directory it has MyClass extends MyClassCommon definition and the same for Android.
In Eclipse the Common,Blackberry,Android src paths are individually added via a common variable (trunk) which is extened to the Common,Blackberry,Android paths for the 3 src root imports.
This seemed to be the only mechanism to ensure that the package name was consistent across platforms so not having a knock on effect that other dependent classes needed new package names.
I'm sure there is a more elegant/correct way of doing this but this appears to work well for now.

How could I view packaged APK files in Eclipse unencrypted?

I am newer to android development. I have a couple apps I've made with appinventor. I would like to be able to take a completed and packaged .apk that is saved on my computer that was made with appinventor and open to edit it in eclipse. Mainly I want to see how a working app Ive made is actually written. This is for my own educational purposes only, no pirating or other illegal uses.
generally it is not possible to convert an App Inventor project into Java. However there are projects which have this goal, see the App Inventor-Java translation project and the Java Bridge project.
Check the android-apktool. I have no experience with the tool and as I see it will not show you the sources but it seems to be the best way to 'unpack' apk files.
I doubt this is possible, how are you going to bring the dex code back to your java code, even then, AppInventor makes for horrible APKs, two apps that do the exact same thing will differ greatly in size if made with the SDK vs AppInventor.
You should just read a couple of books, or search for information online, instead of trying to unpack an APK.
It's absolutely possible using dex2jar which involves a little time to set up and run but it give you a .jar that you can open with a java decompiler. As for getting the source files into eclipse, there are probably some decompilers that do this but probably cost money. You can use the one listed to copy/paste the code out but it will not provide you with an eclipse project.

Categories

Resources