Open AbolfaZlRezaEe opened 1 year ago
Thanks for reporting this. SDK tries to load native part of the SDK automatically before any MapView
method is accessed, but in this particular case the loading has failed. Why this happens is unclear, as the device list contains very common devices plus the Android versions are all relatively new. My guess is that this is related to APK packing but I can not confirm this for sure. To get further insights I suggest adding the following snippet BEFORE calling MapView.registerLicense
:
try {
System.loadLibrary("carto_mobile_sdk");
} catch (Throwable t) {
// TODO: log the details of thrown exceptions to some central repository
}
This snippet tries to manually preload the native part and will log the issues. Once you have some additional details from the logs, please share them with us.
but in the MapView
class we load SDK like this before we do anything...
static {
try {
System.loadLibrary("carto_mobile_sdk");
AndroidUtils.attachJVM(MapView.class);
} catch (Throwable t) {
android.util.Log.e("carto_mobile_sdk", "Failed to initialize Carto Mobile Maps SDK, native .so library failed to load?", t);
}
}
why we would load it again before registerLicense
function?
@AbolfaZlRezaEe Because it fails but the logging of the event is 'local' and you do not see the message. The beforehand loading is just for getting the exception info to a server so we can see the details.
Ok. We will do this for our next application version and report the issue here(if we see it in the console)
Well, after a release that We had, We received these stack traces from our crash report. We hope that these are good points enough to catch this exception:
it's good to mention that some of these exceptions same as each other on some points. but We preferred to send all of them to you.
java.lang.UnsatisfiedLinkError: Couldn't load carto_mobile_sdk from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/me.project-1.apk", zip file "/data/data/me.project/code_cache/secondary-dexes/me.project-1.apk.classes2.zip", zip file "/data/data/me.project/code_cache/secondary-dexes/me.project-1.apk.classes3.zip"],nativeLibraryDirectories=[/data/app-lib/me.project-1, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:378)
at java.lang.System.loadLibrary(System.java:525)
at me.project.BaseApplication.onCreate(BaseApplication.java:85)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4444)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:546)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(NativeStart.java)
--------------------
java.lang.UnsatisfiedLinkError: Native method not found: com.carto.utils.AndroidUtilsModuleJNI.AndroidUtils_setContext:(Landroid/content/Context;)V
at com.carto.utils.AndroidUtilsModuleJNI.AndroidUtils_setContext(AndroidUtilsModuleJNI.java)
at com.carto.utils.AndroidUtils.setContext(AndroidUtils.java:49)
at com.carto.ui.MapView.registerLicense(MapView.java:70)
at me.project.BaseApplication.onCreate(BaseApplication.java:89)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4444)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:546)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(NativeStart.java)
------------------
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.runner.jar", zip file "/data/app/me.project-_3NcjEutBh-lzuasXb_GdQ==/base.apk"],nativeLibraryDirectories=[/data/app/me.project-_3NcjEutBh-lzuasXb_GdQ==/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libcarto_mobile_sdk.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
at java.lang.System.loadLibrary(System.java:1657)
at me.project.BaseApplication.onCreate(BaseApplication.java:85)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
at android.app.ActivityThread.-wrap1
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
-----------------
java.lang.UnsatisfiedLinkError: No implementation found for void com.carto.utils.AndroidUtilsModuleJNI.AndroidUtils_setContext(android.content.Context) (tried Java_com_carto_utils_AndroidUtilsModuleJNI_AndroidUtils_1setContext and Java_com_carto_utils_AndroidUtilsModuleJNI_AndroidUtils_1setContext__Landroid_content_Context_2)
at com.carto.utils.AndroidUtilsModuleJNI.AndroidUtils_setContext(AndroidUtilsModuleJNI.java)
at com.carto.utils.AndroidUtils.setContext(AndroidUtils.java:49)
at com.carto.ui.MapView.registerLicense(MapView.java:70)
at me.project.BaseApplication.onCreate(BaseApplication.java:89)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
at android.app.ActivityThread.-wrap1
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
----------------
java.lang.UnsatisfiedLinkError: dlopen failed: library "libcarto_mobile_sdk.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
at java.lang.Runtime.loadLibrary0(Runtime.java:998)
at java.lang.System.loadLibrary(System.java:1656)
at me.project.BaseApplication.onCreate(BaseApplication.java:85)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1229)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6763)
at android.app.ActivityThread.access$1500(ActivityThread.java:256)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2091)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
-----------------
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/me.project-1/base.apk"],nativeLibraryDirectories=[/data/app/me.project-1/lib/x86_64, /system/lib64, /vendor/lib64]]] couldn't find "libcarto_mobile_sdk.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:984)
at java.lang.System.loadLibrary(System.java:1562)
at me.project.BaseApplication.onCreate(BaseApplication.java:85)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5405)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:890)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:780)
-------------------
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/me.project-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libcarto_mobile_sdk.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:988)
at me.project.BaseApplication.onCreate(BaseApplication.java:85)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
--------------------
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.runner.jar", zip file "/data/app/me.project-Ya3ahXDk1zZuLOhgbHEbqw==/base.apk"],nativeLibraryDirectories=[/data/app/me.project-Ya3ahXDk1zZuLOhgbHEbqw==/lib/arm64, /system/lib64, /system/vendor/lib64]]] couldn't find "libcarto_mobile_sdk.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1030)
at java.lang.System.loadLibrary(System.java:1673)
at me.project.BaseApplication.onCreate(BaseApplication.java:85)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5761)
at android.app.ActivityThread.access$2000(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1658)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6518)
at java.lang.reflect.Method.invokeImpl(Method.java)
at java.lang.reflect.Method.invoke(Method.java:411)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:808)
------------------
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/me.project-1/base.apk"],nativeLibraryDirectories=[/data/app/me.project-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libcarto_mobile_sdk.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at me.project.BaseApplication.onCreate(BaseApplication.java:85)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4711)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5421)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
---------------
java.lang.UnsatisfiedLinkError: No implementation found for int com.carto.vectorelements.BillboardModuleJNI.Billboard_getRemSize(long, com.carto.vectorelements.Billboard) (tried Java_com_carto_vectorelements_BillboardModuleJNI_Billboard_1getRemSize and Java_com_carto_vectorelements_BillboardModuleJNI_Billboard_1getRemSize__JLcom_carto_vectorelements_Billboard_2)
at com.carto.vectorelements.BillboardModuleJNI.Billboard_getRemSize(BillboardModuleJNI.java)
at com.carto.vectorelements.Billboard.getRemSize(Billboard.java:170)
at me.project.activity.MainActivity.lambda$initOverMapLayout$45$MainActivity(MainActivity.java:2805)
at me.project.activity.-$$Lambda$MainActivity$3D-xNQKCjQN7g1N5P5zroqBhs8o.run
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
------------------
@AbolfaZlRezaEe It seems that there are packaging issues, as the native part of the SDK can not be loaded. Can you share your build.gradle file (assuming you are using Android Studio/gradle)?
@mtehver I think it's good to mention all of our steps for building and using Carto in our application:
python{YOUR_PYTHON_VERSION} build-android.py --profile standard --build-aar --configuration Release --gradle {YOUR_GRADLE_DIRECTORY}
aar
file into the project. first, with putting aar
file into libs
section, so the code in build.gradle
file is like this:
dependencies {
implementation fileTree(dir: 'libs')
implementation files('libs/carto-4.3.5.aar')
}
or with our Maven
repository. for using that, we edited the build-android.py
file and changed the Gradle section into this:
if not gradle(args, '%s/scripts' % baseDir,
'-p', 'android',
'--project-cache-dir', buildDir,
'--gradle-user-home', '%s/gradle' % buildDir,
'assembleRelease'
'artifactoryPublish'
):
return False
also, we changed the publish.gradle
file. but it doesn't matter right now for our problem I think. so, after we publish the aar
file and sent it to our Maven, we import SDK into our project like other libraries:
dependencies {
implementation 'org.projects:carto:4.4.3.'
}
after We build the application for the Store, We have four libs files of CARTO-SDK .so
file in our application. like this:
We have a guess that the Store sometimes gives the wrong architecture to the users and this is one of the problems that these exceptions are thrown. but we are not sure. so after all these, any idea?
@AbolfaZlRezaEe Looks good based on the description, all architectures seems to be present in your APK. No idea why the issue occurs on on some devices. One thing you can try - experiment with 'split ABI' settings (described here: https://developer.android.com/studio/build/configure-apk-splits).
We have an exception in our application that is from CART SDK. unfortunately, we couldn't find any scenario for reproducing this crash on our phones. the stack trace that Google console gives us is this:
this crash happens around 86K for our users! and that isn't good for our application. also, we found an issue that mentions this exception in 2019 in this link with some details. but there is still no good solution for this issue yet. we found this issue in these SDKs much more than the others:
also, this crash happens much more in these devices:
We highly need help for this crash and we have no idea that this crash when happening and why it happens. can somebody help us?