android Use Linux tools stored at assets folder - android

I want to use tools from Linux which not available in Android by default such as iw and iperf. I saw Android applications that use this tools (like this). There are two ways to do it.
First: get root rights on device and put file of the tool to the system/bin/ folder.
Second: put file of the tool to assets folder of Android project and somehow use it.
Applications from Play Market use second way. But I don't know, how it cuold be done. Is there any description of implementation of second way?

https://xjaphx.wordpress.com/2011/10/02/store-and-use-files-in-assets/
This the best example of what you want to do.
For putting executable in assest see
https://stackoverflow.com/a/5642593/775964

Related

Including resources folder in apk

I'm writing a hybrid application in Cordova using Intel XDK. I've found and installed plugin for displaying native notifications on device, but got stuck with problem concerning icons customization. I am supposed to use Local resource for native resources relative to the res/drawable/ (Android) or Resources/ (iOS) folder.
And here comes the problem, because I can not make Intel XDK to add anything into the res folder inside .apk. I've found out that I should create appropriate folder structure (platforms/android/res/drawable) and place there my icon, but unfortunately one is not loaded in the .apk. How to build application so my own resources would be included? Am I missing some xml config or settings?
Plugin Link
Despite the statements in the forum post, it may be possible to do what you are asking about, but not without some effort. The forum post is correct, there is no way to add custom images, for use by the plugin you are trying to use, in your XDK project as described by the plugin docs. In the case of an XDK project, the platform directories pointed to by those plugin docs exist only in the build system, where it uses Cordova CLI to build your app, they do not exist in your local XDK project directory (despite the resemblance to a Cordova CLI project, your local project directory is missing the platform folders).
To do this you'd have to create a simple plugin, that will add those resources into the respective platform folder locations at build time. I'd have to spend some time figuring out precisely how to do this, which I don't have time for right now, but at least wanted to help you give it a try, if you are up for it. :-)
The simplest way to figure this out would be to inspect a plugin that adds custom graphic images to the built app it is being included in. The inAppBrowser is one you could use as a guide, certainly there are others. Inspect the plugin.xml file for that pluginand find the Android platform section where it copies files from the plugin's src directory into the platform's res directory. In essence, what you want to do is create a small custom plugin that contains a plugin.xml file that includes such directives, plus the custom images you want to copy into the respective locations for each platform. So you'd also have an src/android/res/etc... directory containing your Android images, and so on for the other platforms. You may have to look at a few plugins to see how this is done for other platforms.
Here's the plugin guide, most of which you won't need, just the bits to create a basic plugin.xml file and the local images you want to add to your app > https://cordova.apache.org/docs/en/5.1.1/guide/hybrid/plugins/index.html
You'll then have to add this plugin as a "local" plugin to your project, using the Plugin Manager tool. Do not develop your plugin inside the <project>/plugins directory, that is a destination. Develop it somewhere else, either inside your project (e.g., <project>/my-custom-icons) or somewhere outside the project. The Plugin Manager doesn't care where it is located, as long as it is somewhere on your local dev system and NOT inside the <project>/plugins directory.
I have posted a solution for this problem in this thread:
res/drawable files in Intel XDK
Altough I have not yet tested this on iOS, the solution should be similar.

Does Android use sparse files similar to Bluestacks?

I have Bluestacks installed on my windows8 machine and I was poking around its files and folder structure. I see that in Bluestacks, app data is stored under Android/Data.sparsefs/Store or Android/SDCard.sparsefs/Store
How similar is this to the actual Android OS? Does the OS have the same folder structure and/or sparse files? (or roughly the same) If not, what is the difference and how does the Android structure look like?
When you install an application you have this folder:
/data/data/"your package name"
example:
/data/data/myappexample
Use the DDMS to access for your Emulator.
inside this path you have:
databases/: databases
lib/: libraries for the app
files/: other related files
shared_prefs/: preferences and settings
cache/: caches

How to use a Android Studio project on two computers?

I use two computer for coding. My desktop pc and the notebook. I sync the two computers with dropbox. How can I import/load a project on each of this two computers? The project base folder is different on each computer. When I try to load/import a project which is created on the other computer it loads the project but I got a error with a wrong path.
"Gradle "Test2Project" project refresh failed:
Could not fetch model of type "IdeaProject" using Gradle distribution "http://services.gradle.org/distributions/gradle-1.6.zip".
Project directory "C:\Users\thomas\AndroidStudioProjects\Test2Project" does not exist."
The wrong pfad is the right pfad on the other computer. How can I import Android Studio projects so that it works even on another computer with a different folder structure?
Like the others i agree, that using a VCS would be the best solution. Even though you can try to filter all android studio related files (like *.iml, .idea folder and local.properties). I don't know if you can do this with dropbox or if you need some kind of 3rd software.
After that you should be able to make source code changes on both computers without greater problems. (You may have to declare project dependencies changes for the android studio twice)
Builds depending on the build.gradle files should work to. But again: using a VCS is the better way to go.
Go for git, you can use bitbucket.com as a free remote repository.
This is a problem I have ran into when trying to store Android projects in a Dropbox folder. What happens is that Machine 1's IDE is mapping system resources (like the SDK) as being in that machine's filesystem. When you go to Machine 2, everything will work EXCEPT for what you expect--because the SDK will probably be in a different spot!
One way to get around this is to use your VCS (dropbox, git, whatever) as a repository for JUST your source files, and then have a local project created on each machine that reads from the Dropbox folder. This requires two separate projects that are mapped differently, but that have the same source folder.
I discovered this problem when I tried to load up an Android project on a new install on a Mac machine:
Do you see what's happening there? My Mac Android Studio is saying, "Hey, I don't see where "C:\Android\SDK is, but I do see that you have an Android SDK in a different folder, so I'm going to update your project files to reflect the actual location of the SDK."
In my opinion, the only way around this is to create your project on both machines, and version control your source and assets folder. If you don't create the project separately on each machine and use VCS for just the source and assets, the only way to get around build and filepath errors is to store your SDK in the same folder on each machine. This worked for me when I was building on a Windows desktop and Windows laptop, but no longer works for me since I am using a Macbook Pro.
I know this was questioned about 4 years ago, but this is up to now still an issue. Using a VCS seems like a good solution, but for me it is simply more overhead than i want to have. I also use Dropbox to synchronize my folders and the history they provide is for my private programming needs good enough. So i think, it would be good, if android studio simply uses relative paths.
I know it needs some system paths and it does a good job in looking at the local.properties and setting it to the correct place when the project is loaded.
The main problem with using Dropbox are the build-directories. There are many many references to fully qualified paths in the files within these directories. So my solution was to exclude the build-directories from Dropbox-synchronisation.
When you work at your laptop, build the app, create new files, change files or delete files, the build on your pc will be completely outdated when you switch back to it. but android studio will recognize this and do a fresh build when you start your project for the first time after working on the laptop.
so the biggest problem at this point is the file local.properties and this is handled correctly by android studio. it may be a good idea (or a really bad one, i don't know the drawbacks) when the build system wouldn't write fully qualified paths in the files within the build directory.
But up to now this is my solution for using Dropbox and not using a VCS:
exclude build-paths from Dropbox synchronisation
i hope this helps somebody.

Exporting as .apk & project files location not known when using LuaEclipse (beginner)

I am trying to create an .apk file. I see a new .apk saved on my desktop, but it is just a file with an extension with no data inside it.
I just recently moved from Corona SDK to LuaEclipse and what I need now is an explanation on how to combine all my files.
I have had a .lua file with other data such as images and sounds in a Project Files folder (when using Corona). Now I want to export these all files as .apk (to export by using Eclipse), but I can't because I don't know where to find the location of Project Files in LuaEclipse in order to put .lua file and other files in it.
I am a beginner so I apologize if the problem is not clear.
LuaEclipse is not a tool for writing Lua applications. Or at least, not in the way you're trying to use it. It is an IDE, but since Lua is a scripting language, you need a runtime to make Lua scripts actually work.
Or to put it another way, LuaEclipse and Corona do completely different things. You can't replace Corona with LuaEclispe. Corona is a runtime for writing applications with Lua. LuaEclispe is just an Eclipse plugin that provides support for the Lua language. It doesn't provide an actual runtime.

offline installation of an Android PLATFORM on Windows?

Okay so I have followed instructions on earlier questions in order to offline install the Android SDK, platform-tools and tools, and now I am trying to install an Android platform. (When I run "android list targets", it returns that there are no available targets, and the platforms folder is empty).
What types of files are actually IN the platforms directory? I have files from the repository like "system.img" and "kernel-qemu", but I don't know where to put them.
Could someone let me know what their C:\Android\platforms folder structure actually looks like for a working installation?
(NB: for background, I am able to get to the URL "dl-ssl.google.com" through my browser and even the Eclipse internal browser, but for some reason it can't be accessed from the SDK manager, so I can't download any components or platforms!!)
For what purpose you want to install android platform? If you want to develop apps, you need a lot of stuff from platform folder except "system.img" and "kernel-qemu": android.jar, ant tasks, tools and a lot of resources. If you want just to run emulator, you probably need not all of that...
This is contents of my platform folder: http://ccfit.nsu.ru/~izhovkin/list.txt

Categories

Resources