Thursday, May 16, 2013

Re: [android-developers] Re: JNI on SDCard?

Thanks for the help.
 
Using the hint on "getApplicationInfo().nativeLibraryDir" I could confirm it is a problem on this specific HTC. Probably a bug.
On AVD and on a Samnsung it works correctly and I confirmed the existence of the lib files in getApplicationInfo().nativeLibraryDir.
On the HTC they are not there when I move the app.
 
Thanks


On Thu, May 16, 2013 at 2:42 PM, bob <bob@coolfone.comze.com> wrote:
You may want to take a look here:


In particular:

                                                                                         

Beginning with API Level 8, you can allow your application to be installed on the external storage (for example, the device's SD card). This is an optional feature you can declare for your application with the android:installLocation manifest attribute. If you do not declare this attribute, your application will be installed on the internal storage only and it cannot be moved to the external storage.


                                                                                         


It seems like the obvious solution is to just disallow people to move your app to the external storage.

Thanks.


On Thursday, May 16, 2013 4:19:20 AM UTC-5, Filipe wrote:
Hi,
 
Thanks for the help.
The problem is that I don't know where the libraries go to when I move the app to SD on my HTC for me to use System.load().
 
So the only workaround I found is to check for the existance of the .so file in the predefined folder "/data/data/your_package_name/lib".
If it is not there, then I unzip it from the package APK file to "/data/data/your_package_name/files" folder and load it from there.
 
Thanks
 


On Wed, May 15, 2013 at 11:29 PM, Piren <gpi...@gmail.com> wrote:
That's actually the same person making pretty much the same reply :-)
 

On Thursday, May 16, 2013 1:02:10 AM UTC+3, bob wrote:
I found this one using Google:


It says:

You must use System.load() if you want to specify the full path name 
of the file, System.loadLibrary() is only for ones in the default 
location. 

Also you should not be able to load an .so off the SDCARD on an ARM 
system by normal means, as ARM supports non-executable pages and 
android's implementation of mmap() refuses to map executable pages 
backed by a noexec file system.  To load from such a file system you 
would have to map anonymous executable pages and manually load the .so 
into them, doing appropriate interpretation of the contents and all 
fixups normally performed by the runtime linker. 

Thanks.


On Wednesday, May 15, 2013 4:32:37 PM UTC-5, Piren wrote:
That's what bing got me :)
 

On Wednesday, May 15, 2013 12:00:50 PM UTC+3, Filipe wrote:
Hi,
 
I had only used Bing up till now ;)
Thanks for your great tutorial on this new thing called Google.
I tryed it, but still did not find the answer.
 
The libs are under the "/data/data/your_package_name/lib" folder.
When I move the App I start getting java.lang.UnsatisfiedLinkError: findLibrary returned null
 
I found some new things
This works without problems on AVD. But I noticed that even if I move the App to the sdcard on the AVD, the lib remains in the same folder.
 
So maybe the problem is specific to my HTC.
Using "adb shell" I can find the libs in this folder. After moving to sdcard, when I use "adb shell" I get "permission denied" trying to access the lib folder !!!
So I'm gessing that on my HTC the libs are moved, I just don't know where to.
 
 
Thanks

Terça-feira, 14 de Maio de 2013 23:51:21 UTC+1, Lew escreveu:
Filipe wrote:
I have a project in Eclipse that uses some jni [sic] libraries that I load using System.loadLibrary("myNativeLib").

Those libraries are native to what platform?
 
 
This works great, but if I move my app to the SDCard it stops working, because it can't load the library.

Did you take note of this from the Javadocs for 'System.loadLibrary()'?
"The mapping of the specified library name to the full path for loading the library is implementation-dependent." 

Where did you put the library on the device. Is this where the system expects to find libraries?

 Are there any limitations on moving the app to SDCard when using jni? Or do I have to change my call to System.loadLibrary ?


Also, I see some potentially useful links here:

-- 
Lew
 

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-d...@googlegroups.com

To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Android Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-developers/SmKVuQU0zN8/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Android Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-developers/SmKVuQU0zN8/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment