Launch .apk file on Android device - android

Might seem a pleonasm the 'Title' but I wrote it to emphasize the issue.
I have an application running on an Android device, using the 2.2 Froyo library. The application has to (1) install - if not already installed - then (2) launch an .apk file already present in the data/data/myapp/files/ folder.
Knowing Java I would have used a shell execution of the above operations. But Android is also a separate namespace, therefore I would like to know how to do the sequence install + launch of the .apk file.
To note that, while I'm using Eclipse/Ubuntu now, the implementation should take into account ONLY the Android OS APIs, not my dev environment available tools.
Thanks

You do not launch an apk file. An apk file can be thought of as a container holding some number of activities, services, receivers, among other constructs. It's likely you mean you want to launch an activity (which is performed using the startActivity() method from the Context class, or one of its many subclasses) but by no means is that a certainty.
It would seem from your question that you need to learn quite a bit about Android before continuing on the path suggested by your question, because the question you've posted is really too vague to be answered in a reasonable manner for stackoverflow.

Related

Qt android ndk - app crashes

I've been recently trying to make some very simple app in Qt, and yesterday it used to work correctly on both Desktop and Android (using android ndk, I know it's not good to make android apps in c++, but I just want to try).
Today, out of nowhere, application output says sth like this:
The only thing I've found was cleaning app's cache and data, restarting phone, rebuilding, none of these things worked
A Qt app has an array of used .so library names, somewhere in the resources.
On start-up, it loads all these .so libraries (via loadLibrary()).
The order in which the libraries are loaded is important: functions cannot
reference functions defined in libraries that have not yet been loaded. So implementing a circular dependency is tricky.
From the logs I see that
some function in libszachy_android_1.so (is it the right name? it's a bit strange) invokes srand() that has not yet been loaded; maybe, it is mentioned later in the load list, but loadLibrary() has no idea about the planned future.
Therefore, you get this.
If your code worked yesterday, you likely have made some changes. If you use version control, you likely can compare the today's and yesterday's versions and see the difference. Maybe, you have inserted a forward reference (in the load list sense). OTOH, sometimes both Eclipse and make cannot detect that the source has changed and make incorrect builds (I did observe this, but cannot reproduce). Did you try to uninstall the app from the phone? Did you try to remove all existing .so files in the build directories (rm *.so)?
Maybe, one of your .so modules is broken: sometimes an object is generated despite of errors and it may get used in subsequent builds (at least this is how I can explain the build glitches).
Maybe, you have no memory left on the device, and the .so could not be unpacked correctly.
I suggest examining the application directory with adb shell on a rooted device.
PS you posted a screenshot that is barely readable. Please replace it with the relevant portion of the adb logcat output (I hope you know how to use it; if not, the first thing to do is to learn adb logcat and adb shell).

Android - Conflicting providers/authorities

I'm trying to install Kik Messenger twice. I have two accounts and don't like to log out because I lose all of my conversation history. I'm currently using Titanium backup's profile feature, which is a very nice fix, but it's still a pain having to switch back and forth between profiles. I might be looking for "perfect" when perfect doesn't exist. I am completely new to modding apks and Android in general, all of my work on this so far has been "trial and error". Anyways, here's what I have:
I have the Google Play version of Kik installed on my phone. I have extracted that app and modified the package name successfully using apktool. However, when I try to install, I get an error saying something about duplicate provider authority. So I did some research and learned that I'm supposed to edit this part of the AndroidManifest. So I have played around with that a little bit and after I change the authorities, I am able to install the modded app. However, it crashes immediately.
Does anyone know how to fix this problem with the provider/authorities?
The issue you're hitting is that the app has registered certain classes to handle particular events. These need to be unique across all installed apps and point to existing classes in the app that will perform some activity with the supplied information.
You bypassed the safety check when installing by changing the defined handlers in the Manifest but that didn't really fix it as they still need to actually point to a valid, working class that can handle the requests/events.
You would need to decompile, rename the classes involved and all references made to them and recompile the whole app to really fix the problem. However, I'd assume that it would likely be against the license. If the code is open source then it wouldn't be too big a task to rename some classes & packages then build the app. If it's closed source then it is a harder task.
What you can do is either set up your device to use multiple accounts (the OS not the app) as each user has a separate data storage and preference location that should allow you to have two configurations. Or you can request that the developers include some sort of multiple account handling or easy account swap feature.

How to create batch command for : compile + sign + install + run

Background
As it turns out, it's quite an annoyance to test out in-app-billing (i've written about it here) . Each time you find a bug and need to test your app, you must have the following steps:
compile the app , preferably with the debuggable="true" flag on the manifest
sign the app with your real key you've created for the play store.
install the app on your device
run the app on your device, preferably debugging it via eclipse.
If you'd use a batch operation instead of doing all of those by yourself, it should make things easier to test such apps, and might also be useful for other apps as well.
The question
Is there any way to make the whole process fully automatic, so that with a single click of a button, it will do all of the above?
I know how to achieve 3+4 (using "adb.exe install -r *.apk" and "adb.exe shell am start -n FULL_ACTIVITY_PATH" ), but I don't know how to achieve the others.
If there is a solution that doesn't involve a third party app or plugin (like maven or Ant), it could be very nice. Of course, if that's what is available, I would like to know if it's possible to achieve via a batch file that will use them somehow.
Is there maybe a way to mimic how Eclipse does things in this regard, without being so specific on the project (maybe just the path of the project and that's it)?
Maybe you can package app by ant . You can do every thing you what int the ant code of packaging ,causing the core code is to make property configs in your app and referenced lib, such as build.xml,local.properties...,and replace channel in AndroidMainfest.xml ,so you can also replace any code in your android app,just as you want ,to change the flag of debug , because all the operation just handle local file before packaging your app,you can copy or modify any file in your app. After above process ,you get a app,then you can run other code to install the app. Recently ,I have been using the batch package method to get a lot of app for different channel .so hope it helps.

How could you generate an APK from project B programmatically, using a button click from project A?

I have a project A that should use a wizard to create a project B. Project B is based on a template. Project A should send data to that template and generate an APK from this data and template programmatically.
I've read about the APK structure and what it includes, like classes, resources, and manifest files. My question is, what is the best way to achieve this template-based generation of an APK? What could I use for this?
This is the open source project you're looking for.
https://code.google.com/p/terminal-ide/
Terminal IDE is a command line java / android dev kit that runs on the device itself. Using a correctly configured vim, bash and busybox, in a custom terminal + custom keyboard environment. All these applications are put together so that they interact correctly. A full Terminal emulator + custom ANSI keyboard ensure good bash, vim and busybox emulation. All set up and ready to run in a NON-ROOT environment. Normal user permissions are enough to run all of this.
You can also download it from Google Play here. The application has 4.7 stars on the Play Store from 1,324 ratings. Here is one of the latest written 5 stars reviews this application received on Google Play. And it's not unique by any means (the emphasis in bold is mine).
A Google User - March 12, 2013 - Version 2.02
Wow!
I have over 30 years programming experience (mostly in C/C++ and Assembly) and have been looking to learn to program Android. I looked everywhere for a way to compile and run Java tutorials on my tablet, with no success, until I found Terminal IDE! Then I started playing around with its capabilities and let me say again, wow. DEVELOPER - I have only one suggestion, which others have brought up too: reduce the internal memory footprint. Maybe breakup the different languages into installable add-ons?
In a way, it's a lot like the Android Java IDE called AIDE, minus the GUI interface (but unlike AIDE, it's doesn't have low artificial file limits, and since it's open source it can actually be used to build your own project upon and extend).

Dokan (DokanNet.dll) on Android/Monodroid - Code Migration Issue

Context:
I have an windows desktop app(c#) which loads the dokan libraries , creates a new file system/drive each time it runs, and then deploys financial data files & copywrite protected files in the newly created drive - Allowing only limited process (declared by me) to have access to these files in newly created file system(using dokan).
Now we are migrating the same C# code to android. Though the code doesn’t give Errors, (while running apk)the new drive is not created. While i could debug only to an extent (suddenly get out of debugging mode)
Assumptions for the issue:
Permission issues:
Question:
Does Dokan work with Android? How to go about this, if it’s a permission issue? In market place, most of the devices installing my app may not be "rooted"!!
Has anyone implemented new file system/drive using DokanNet on Android/Monodroid and faced with similar issues? Solutions???
When using a tool it's a good idea to have some basic understanding of how it works. Dokan works by installing Windows filesystem driver. On Android there's no concept of drives and mounting anything to the filesystem is not possible (without building custom kernel and installing it on device). Consequently your idea is DOA on Android and you need to look for other ways to deal with your data.

Categories

Resources