I have been using the older version of Skobbler maps for a fair while now, and have found it to be quite successful. I have recently began upgrading to version 2.4, to gain some of the extra functionality provided in this version ('via points' being the main feature I am interested in).
I can get the AndroidSDKDemo project running. I can get my own project running. But as soon as I add an offline package, the app crashes every time on start up, with a "Fatal Signal 11 0x00000004".
After I have added the offline maps package to the SKMaps.zip file, it does not matter if I set the connectivity mode to online or offline, the app still crashes, just based on the presence of the files in the preinstalled maps folder.
I downloaded the offline maps package via the AndroidSDKDemo project. I then used the android "adb backup -noapk" command to create a compressed version of the app's files, and extracted the SKMaps folder. I then moved the "v1" folder from "Maps" into "PreinstalledMaps", and zipped the file, and then added this file to my test application (the one that crashes) in the assets folder.
It also appears that the crashing may have something to do specifically with the SKMaps.zip... If I take the SKMaps.zip file from the demo project (unchanged, just downloaded straight off the web), and place it in my test app - the app works fine. If I take the SKMaps folder that was made in the backup (and therefore contains information in the "Maps" folder, and without moving ANYTHING in this file (not even moving anything to "/PreinstalledMaps"), and put this folder in my test project, the app crashes.
Does anyone have any ideas on how I can fix this problem? It's been hugely frustrating for me, as I can't really figure out why things aren't working. I may be doing something wrong, but I am lost as to what this might be.
Thanks in advance for your help
I have had a similar problem when loaded maps in sdk 2.3.
I solved it by executing this thread before initializing the Maps.
final SKPrepareMapTextureThread prepThread = new SKPrepareMapTextureThread(this, mapResourcesDirPath, zip, this);
prepThread.start();
When the method:
#Override
public void onMapTexturesPrepared(boolean arg0) {
}
"onMapTexturesPrepared" is called, you can initialize the Maps with preinstalled maps:
initMapSettings.setPreinstalledMapsPath(mapResourcesDirPath+"/PreinstalledMaps");
(....)
SKMaps.getInstance().initializeSKMaps(getApplicationContext(), initMapSettings, API_KEY);
I hope that helps, it worked for me.
Turns out I was being slightly stupid. I was compressing the SKMaps folder, instead of the files inside of the SKMaps folder. This means my zip looked like this:
SKMaps.zip/SKMaps/PreinstalledMaps/...
It needed to look like this:
SKMaps.zip/PreinstalledMaps/...
Simple solution, but it was not immediately apparent to me.
Apologies for the waste of time.
The structure from the SKMaps.zip has to be the same as in the demo, modifying or deleting any files might lead to some unexpected behavior in the worse case app crashes.
For using offline maps you first have to set the preinstalledMapsPath (In our AndroidSDKDemo DemoUtils method initializeLibrary uncomment initMapSettings.setPreinstalledMapsPath(app.getMapResourcesDirPath()
+ "/PreinstalledMaps"); ) and then there are 2 ways
Change the assets in the following way: Decompress SKMaps zip and add a .skm map for 2.4, in the folder PreinstalledMaps/v1/20141230/package/ Re-make the archive in assets<- this method unfortunately is not very reliable for big map packages
Another option would be to add packages manually. In our AndroidSDKDemo by default and if there is space the map resources are placed on the internal memory, but this can be changed in SplashActivity in the method chooseStoragePath so that the method returns just context.getExternalFilesDir(null).toString(). Use a file manager app (e.g.Astro File Manager) copy the files to [external storage]/Android/data/com.skobbler.sdkdemo/files/SKMaps/PreinstalledMaps/v1/20141230/package/
Related
I am developing an Android application that has a NDK .so file which I need to iterate on and fix + improve.
The current workflow has me having to generate a APK and install it every iteration which updates a whole plethora of non NDK elements in the process really slowing things down.
The question is how could I access the installation folder of my own APK? I have both a rooted and unrooted device.
Is there some change I could make to install the app in an unprotected location for development purposes even. The installation data is my own application after all so feels like should be a way...
Help greatly appreciated :)
EDIT1:
I found Unity3D has some sort of patching mode, maybe this is a sign that with the correct ADB commands it may be possible... https://docs.unity3d.com/Manual/android-AppPatching.html
EDIT2: I found the location of the .so I am building in... checked on unrooted device and don't have permission.
If your app is not a native-only app (has a Java/Kotlin part) then your so library should be loaded at the moment using a call to System.loadlibrary(..).
What is interesting on this method is, that calls to this method are ignored if the library to be loaded has already been loaded. So if you modify the Java code of the development build of your app to manually load your library before the original loadLibrary call is executed you can end up with a different library loaded.
The only problem is that System.loadLibrary(..) does not accept a file-name or path as argument. But using System.load(..) which uses a full path as argument you should be able to specify a full path to a file e.g. in the app's data directory. That way you can replace the library as often as you want and then just restart the app to load the updated library.
I was looking for a way to add some such folder in my Android Project that do no get compiled up to my apk file.
Why I need it :-
We need to maintain proper documentation for project (that actually
everybody needs to ;) nothing new),
but I find it very irritating to look out for that documentation
folder again and again.
.
I am open for any way i can make dcocumentain folder easily one
click accessible (I am already doing it thru taskbar sortcut. ) But
I want it to get the ease of version control thru Eclipse likewise we
do it for our project
IDE :- Eclipse
I got a way myself :-
I had an idea that if I create a folder in my application project with
some anonymous name that actually android has not listed in its
directories ("I am talking about the default one like "res", "src",
"anim"......)
Then either it should "raise an error" or should "ignore" it while compiling to form apk file
luckily it ignores any such folder. now i can put all the documentation in my project.
NOTE:-
My answer empirically driven
I had tested it by creating a "Docs" folder and then copied 1 GB of
random data (includes almost all type of files we came across from
multimedia to zipped ones).
Then I build the apk and the size of the apk was in-effective of all
this..
but when i copied the same data to assets it was showing a huge change
in size of my apk file..
Consider using Javadoc in addition or, if possible, instead of any other documentation.
I've been not able to solve my problem, I look around and I couldn't find a good solution.
The things is that I have an Android app that must be system app. I have my own devices so I'm able to install them on system app.
I'm doing this using a pre-installed app on system app. This app takes the .apk file from assets save it on the data/data and the move it to system/app/ folder.
Everything goes good, except when I launch it, it gets an exception java.lang.ExceptionInInitializerError, this means that the jni lib is not found. Probably because it has not been installed in the /system/lib directory.
Anyone know how can I solve this?
I know one solution is to look for the jni lib in the system and move it to system/lib but I would like to avoid this.
thank you.
So, currently there is no way on Android, but to manually preload dependent shared libs. That's fine with me, not a big deal.
There is also some problem with android buildsystem (prebuild libraries feature), and for that reason I had to name differently different builds of my dependent shared library: libsal.so and libsal-slim.so. Depending on build settings one of these two makes it into the final apk. Then, on java side, I try to load libsal.so and if it fails, then I try to load libsal-slim.so.
It worked all fine, until we stumbled upon a phone that ships that libsal.so in default firmware installed into /system/lib. For that reason, my app stopped working on that phone if it's built with libsal-slim.so, since it tries to load libsal.so first and it loads wrong library from /system/lib.
Question: how can I ensure that only library from my install folder gets loaded? Maybe I can somehow retrieve install folder of my app and "calculate" full path of my shared lib? How can I do that java voodoo magic? I'm big time noob in java and android in general, if this questions looks too naive :) and yes, I don't speak English (or how they say), please rely in c++ [end-of-joke]
libsal.so isn't actual name, I used it only for example.
Using System.load(fullpath_of_the_lib)can probably solve your problem.
But your problem is to get the fullpath_of_the_lib. In fact the android API don't allow you to get the path of a resource. You can only get a stream to read it.
To workaround this limitation, what you can do is the following:
put your lib in your app assets folder.
open a InputStream on your lib : getAssets().open("libsal.so")
create a file named "libsal.so" (or whatever) in your sdcard
copy bytes from the inputstream to the file just created
get the absolute filepath of your "libsal.so" on the sdcard
call System.load(fullpath_of_the_lib_on_the_sd_card)
Of course you only need the last step in the lib is already on the sdcard.
An simpler alternative is maybe renaming your lib to something like libMyVeryUncommonLibraryName.so so that it won't conflict with another library name.
I'm programming an application in android which uses OCR. I'm using the tesseract ocr and I want to ask where should I put the language files in my project, so that when I install my app in my phone(Samsung Galaxy S) the files be somewhere for the app to use them for the ocr process. I think that it should be in a place like: /mnt/sdcard/tesseract/tessdata, but how this can be done without putting them myself in my device and let the installation to do this.
You'll have to include the files with your project in the assets folder.
See AssetManager to learn how to access your files from your activity. Also I would suggest that you don't copy them to the SDCard. Unfortunately since your files are going to have to be included with your project, and thus will be present in your apk file you're going to end up with a larger application size. But also unfortunately I don't believe that there is a way to delete the files from your apk at runtime, so even if you copy them over to the SD your app is still going to be the same size. For that reason I see no reason to copy them to the SD card, just access them from the AssetManager when you need to get them. Doing it that way also means that your application will not break if the SD card is removed / unmounted.
Simply put them under Assets in a "tessdata" folder. That is in your project.
You can use Xamarin and the Tesseract for Xamarin nuget package, they're really easy to use, just bear in mind that you probably will have to install older version of the nugget if the latest version doesn't work. (2.10 was the working one as far as i remember)