English 中文(简体)
Integrate an Android app (.apk) into an existing Android project
原标题:

Here s the use case:

A friend and I are building an Android app and along with it want to integrate a game. The core of the app has been built in Eclipse but we are looking into building the game with an app building tool like Google AppInventer (http://appinventor.googlelabs.com/about/) or Corona (http://www.anscamobile.com/corona/). We d like the existing app we ve built to have a button like "Play Game" which will launch the game we build using one of these utilities.

However when I messed around with Google App Inventor I noticed that I could only export the project as a .apk, which are binary files. Ideally, I d build the app in AppInventor, export the source code and add the package to our existing project in Eclipse. Well, it s not that easy since we only have access to a .apk file. So my question is can this be done? How?

Some have suggested using an apk decompiler, but would this even be worth it? Are there any good apk decompilers that will give us access to some source code (java files, xml files, resources) without too big of a headache? Is there another tool out there that can export source code? Any other way to integrate 2 separate .apks?

Or will we need to build 2 separate apps? :(

最佳回答

A project written in App Inventor cannot be exported into Eclipse.

The created .apk file is not a binary file. It is a ZIP archive of several files and folders, but none of them is java code.

What can be done to combine an App Inventor app with an app created with Android SDK is to make use of the ActivityStarter component inside App Inventor. Details on that are here: http://appinventor.googlelabs.com/learn/reference/other/activitystarter.html

Finally, keep in mind that App Inventor apps cannot be uploaded directly to the Market. However, some users have created a process that allows to do that, it is called Marketizer.

If you spend some time reading posts from this forum: programming-with-app-inventor (it is a Google Groups forum), you might get even better ideas.

问题回答

You may consider building dependency Project A as a JAR and include that JAR-file to the build path of your dependent Project B.

To do that in Eclipse yo should click Export > Java > JAR > { Select project & unselect AndroidManifest.xml } > Finish

If you do not exclude AndroidManifest.xml from your Project A, you will get an issue saying there are duplicating manifest files described here.

Also you might get the following error:

conversion to dalvik format failed with error 1

To fix that just clean & rebuild your project

I tried that for two projects having reference for the same version of Android SDK and it worked. Note that if you need to run activity from the Project A you also need to declare it in the manifest of the Project B





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签