android


Native application crashes on Android L


I have a native application that always worked on Android KitKat with both Dalivik and ART runtimes, but it now crashes on Android L with the following trace:
E/art(12810): dlopen("/data/app-lib/com.mylib.example", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "issetugid" referenced by "mylib.so"...
D/AndroidRuntime(12810): Shutting down VM
E/AndroidRuntime(12810): FATAL EXCEPTION: main
E/AndroidRuntime(12810): Process: com.mylib.example, PID: 12810
E/AndroidRuntime(12810): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "issetugid" referenced by "mylib.so"...
E/AndroidRuntime(12810): at java.lang.Runtime.loadLibrary(Runtime.java:364)
E/AndroidRuntime(12810): at java.lang.System.loadLibrary(System.java:610)
Is ART runtime in Android L different from KitKat? There is no new NDK available yet, therefore, how to avoid this crash, because it seems that the function issetugid is no longer supported.
The issue has been fixed in the final Android 5.0 release. There is no need to re-compile existing binaries.
However, if the native lib is compiled with target android-21, it fails on previous Android versions (< 5.0)
I think i may have the answer, please correct me if iam wrong.I had faced similar issue and now its fixed (or i have found a workaround rather)
while registering native method to JNI, there are two ways of doing it.
1) Implement JNI_OnLoad() method in your .cpp file and register your native methods with the
appropriate classes.
Check- http://developer.android.com/training/articles/perf-jni.html#native_libraries
example - https://android.googlesource.com/platform/development/+/master/samples/SimpleJNI/jni/native.cpp
2) there is a particular naming convention to follow for the native methods, where the class path (including package) have to be added.
Check - http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp615
Here we need not implement any method. The JVM discovers the native method from the symbol names it self from the binary.
The first method doesn't seem to work in Android ART runtime (ART is Optional in kitkat and it will be the only runtime in Lolipop).I am not not sure why it doesnt work. but i think the reason is because the way ART performs.(The bytecodes are converted and cached during install time itself instead of runtime, so that app runs faster). So since the native libs are not loaded (on_load is not called) the conversion to machine code fails at some point
Use the second method to register natives. it should work.
Only disadvantage is now your function names will be and long and will look horrible (i bet none of the function will fit in 100char limit).bye bye function name readability.
Hope this helps
Cheers,
Shrish

Related Links

When displaying database items in ListView, it's being multiplied every time i change my tabs
Android for dummies example error
I want to set height of Spinner programmatically like setHeight available on other widgets
Android : Pager Title Strip and WebView
arrayadapter error when created outside onCreate
Android: cannot install app saved to the internal memory
Android app launch performance
Dividing Google Map Into sectors
Appcelerator Titanium background service geolocation for Android
Tabris Example Android Bug?
Add Line Break in text file android
How can i find distance between two GeoPoints
How to get testDevice ID for Android AdMob ads [duplicate]
Android popup with checkboxes
XML Parsing (Moving data from XML to a list)
RSS reader with alert

Categories

HOME
google-cloud-platform
delphi-7
prism
linkedin
ns-3
youtube-data-api-v3
static
serialization
gradient
replace
bitbucket-api
ado.net
echo
mapbox
pattern-matching
augeas
ibeacon-android
fhir
ycsb
datastage
jxl
google-form
speech-synthesis
onedrive-api
zerobrane
smartclient
identity-management
lilypond
asciidoctor-pdf
guzzle
cgbitmapcontext
ember-cli
visual-studio-extensions
object-storage
roundup
perlbrew
expressionengine3
windows-server-2003
data.stackexchange.com
fat
bulletphysics
jasmine-node
bringtofront
gitlab-api
turfjs
playstation-portable
jett
sharding
sql-delete
least-squares
fiware-cygnus
docfx
alphabetical
wurfl
timing
node-mssql
spring-mvc-test
naming
oracle-service-bus
android-exoplayer
drupal-theming
flask-login
oim
dapper-simplecrud
getchar
jboss-4.2.x
magento-2.0.7
sonarlint-eclipse
zenhub
page-replacement
subnet
pocketsphinx-android
stax
microstation
adafruit
jboss-tools
mapinfo
kango-framework
lz77
cortex-m
design-principles
coda
ocra
skspritenode
mirror
mraid
j-security-check
bcache
ghcjs
big-ip
genymotion-call
gii
visual-studio-express
jammer
kogrid
ui-select2
scmmanager
video-codecs
virtual-pc
resource-management
web-notifications
panda3d
nokia-s40
veracity
paginator
failing-tests
procedures
xcelsius
uipagecontrol
dataform
metaweblog
lobo-cobra
visualj#
scrubyt
change-management
online-storage

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App