Android Runtime Error using Scala and libGDX with Gradle - android

I want to build android apk in my libGdx project but I got this error shows up
My other projects with libgdx and scala works well.
I have it on this part of the code:
tempArray = stage.getActors.items.array.filter(_ != null).filter(_.getName == "ball1")
W/com.scala.gdx: Accessing hidden method Ljava/lang/invoke/VarHandle;->releaseFence()V (blacklist, reflection, denied)
E/AndroidRuntime: FATAL EXCEPTION: GLThread 456
Process: com.scala.gdx, PID: 8618
java.lang.ExceptionInInitializerError
...
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1557)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)
Caused by: java.lang.NoSuchMethodException: java.lang.invoke.VarHandle.releaseFence []
at java.lang.Class.getMethod(Class.java:2072)
at java.lang.Class.getDeclaredMethod(Class.java:2050)
at java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:782)
...
at a.a.a.p.a.l.onSurfaceChanged(:310) 
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1557) 
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272) 

Related

TFlite object detector app crashes just before making predictions

I tried several methods to deploy the tflite model on android, flutter, kotlin, etc, but andriod app keeps crashing when I want to make predictions. This was an error I got trying out the object detection codelab:
2022-01-01 15:52:55.965 2971-3034/org.tensorflow.codelabs.objectdetection E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
Process: org.tensorflow.codelabs.objectdetection, PID: 2971
java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
at android.content.res.AssetManager.nativeOpenAssetFd(Native Method)
at android.content.res.AssetManager.openFd(AssetManager.java:938)
at org.tensorflow.lite.task.core.TaskJniUtils.createHandleFromFdAndOptions(TaskJniUtils.java:65)
at org.tensorflow.lite.task.vision.detector.ObjectDetector.createFromFileAndOptions(ObjectDetector.java:147)
at org.tensorflow.codelabs.objectdetection.MainActivity.runObjectDetection(MainActivity.kt:127)
at org.tensorflow.codelabs.objectdetection.MainActivity.access$runObjectDetection(MainActivity.kt:48)
at org.tensorflow.codelabs.objectdetection.MainActivity$setViewAndDetect$1.invokeSuspend(MainActivity.kt:150)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
2022-01-01 15:52:56.014 2971-3034/org.tensorflow.codelabs.objectdetection I/Process: Sending signal. PID: 2971 SIG: 9
This issue was caused by android compressing the tflite model during the build. To solve this issue i had to instruct aapt not to compress the file.
go to build.gradle, at the app level, inside the andriod{} block, add
aaptOptions {
noCompress "model.tflite"
}
please rename model.tflite to your custom name if your tflite model is not named "model.tflite"

React native App is getting crashed. Logcat logs are as described below-

2020-11-13 16:35:41.850 27509-27525/? E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.sehat, PID: 27509
java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'app.bundle' is packaged correctly for release.
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:235)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:259)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1243)
at com.facebook.react.ReactInstanceManager.access$1000(ReactInstanceManager.java:132)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:996)
at java.lang.Thread.run(Thread.java:764)

Android-Native library (com/sun/jna/android-x86/libjnidispatch.so) not found in resource path (.)

I am developing my android App with MongoDB Stitch, which has a pre-requisite that I need to install MongoDB Mobile Tarball.Installation Structure
After installation I run the program, getting this exception:
08-09 13:01:34.308 20251-20278/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: io.datats.datatungshing.app, PID: 20251
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: com.mongodb.embedded.client.MongoClientEmbeddedException: Failed to load the mongodb library: 'mongo_embedded_capi'.
Native library (com/sun/jna/android-x86/libjnidispatch.so) not found in resource path (.)
Please set the library location by either:
- Adding it to the classpath.
- Setting 'jna.library.path' system property
- Configuring it in the 'MongoEmbeddedSettings.builder().libraryPath' method.
at com.mongodb.embedded.client.MongoDBCAPIHelper.init(MongoDBCAPIHelper.java:60)
at com.mongodb.embedded.client.MongoClients.init(MongoClients.java:38)
at com.mongodb.stitch.core.services.mongodb.local.internal.CoreLocalMongoDbService.getClient(CoreLocalMongoDbService.java:36)
at com.mongodb.stitch.android.services.mongodb.local.LocalMongoDbService.access$000(LocalMongoDbService.java:35)
at com.mongodb.stitch.android.services.mongodb.local.LocalMongoDbService$1.getClient(LocalMongoDbService.java:50)
at com.mongodb.stitch.android.services.mongodb.local.LocalMongoDbService$1.getClient(LocalMongoDbService.java:41)
at com.mongodb.stitch.android.core.internal.StitchAppClientImpl.getServiceClient(StitchAppClientImpl.java:105)
at io.datats.datatungshing.forboledts.SecondActivity$getTrendFromDB.doInBackground(SecondActivity.java:57)
at io.datats.datatungshing.forboledts.SecondActivity$getTrendFromDB.doInBackground(SecondActivity.java:37)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 4 more
Caused by: java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/android-x86/libjnidispatch.so) not found in resource path (.)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:962)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922)
at com.sun.jna.Native.<clinit>(Native.java:190)
at com.sun.jna.Native.loadLibrary(Native.java:544)
at com.mongodb.embedded.client.MongoDBCAPIHelper.init(MongoDBCAPIHelper.java:58)
... 14 more
The highlighted code is in my AsyncTask, which is just creating a MongoClient in my java program:
final StitchAppClient client =
Stitch.initializeDefaultAppClient("APP-ID");
final MongoClient mobileClient =
client.getServiceClient(LocalMongoDbService.clientFactory);
MongoCollection<Document> localCollection =
mobileClient.getDatabase(databaseName).getCollection("CollectionName");
/*Document doc = localCollection.find().first();
this.keywordList = (List<String>) doc.get("list");*/
return true;
I have also created and included a jniLibs directory in my src/main/, which contains the following components:
jniLibs
In my jniLibs I also have the file libjnidispatch.io included. Please help me on this strange bug. The emulator I used is Nexus 6 API 28. Thank you!!!

Unable to get provider DummyContentProvider after upgrading gradle dependencies

I am updating com.google.android.gms and firebase gradle dependencies to fix the error described here: Unable to start receiver com.google.firebase.iid.FirebaseInstanceIdInternalReceiver. I was using
compile 'com.google.android.gms:play-services:9.8.0'. Using versions above that seems to cause the following stack trace during adb logcat.
Why is this error caused?
FATAL EXCEPTION: main
05-15 12:21:11.721 11491 11491 E AndroidRuntime: Process: com.netbeast.yeti.debug,
PID: 11491 05-15 12:21:11.721 11491 11491 E AndroidRuntime:
java.lang.RuntimeException: Unable to get provider
com.marianhello.bgloc.sync.DummyContentProvider:
java.lang.ClassNotFoundException: Didn't find class
"com.marianhello.bgloc.sync.DummyContentProvider"
on path: DexPathList[[zip file "/data/app/com.netbeast.yeti.debug-2/base.apk"],
nativeLibraryDirectories=[/data/app/com.startup.app.debug-2/lib/arm,
/data/app/com.startup.app.debug-2/base.apk!/lib/armeabi-v7a,
/vendor/lib, /system/lib]]
For more info: the error comes from a library used in the native side. This is a project with react native that has a package called react-native-mauron85-background-geolocation

AdaptiveCard native method on android not found

i'm tring to launch the basic adaptive card example using maven central depencdency but i'm having an error because native method impl is not being found.
I have just add the dependency to my build.gradle:
compile 'io.adaptivecards:adaptivecards-android-arm:1.0.0'
This is the error:
11-13 18:19:55.944 16684-16970 E/zygote: No implementation found for long com.microsoft.adaptivecards.objectmodel.AdaptiveCardObjectModelJNI.AdaptiveCard_DeserializeFromString(java.lang.String) (tried Java_com_microsoft_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_AdaptiveCard_1DeserializeFromString and Java_com_microsoft_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_AdaptiveCard_1DeserializeFromString__Ljava_lang_String_2)
11-13 18:19:55.945 16684-16684 D/AndroidRuntime: Shutting down VM
11-13 18:19:55.949 16684-16684 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tuenti.messenger, PID: 16684
java.lang.UnsatisfiedLinkError: No implementation found for long com.microsoft.adaptivecards.objectmodel.AdaptiveCardObjectModelJNI.AdaptiveCard_DeserializeFromString(java.lang.String) (tried Java_com_microsoft_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_AdaptiveCard_1DeserializeFromString and Java_com_microsoft_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_AdaptiveCard_1DeserializeFromString__Ljava_lang_String_2)
at com.microsoft.adaptivecards.objectmodel.AdaptiveCardObjectModelJNI.AdaptiveCard_DeserializeFromString(Native Method)
at com.microsoft.adaptivecards.objectmodel.AdaptiveCard.DeserializeFromString(AdaptiveCard.java:105)
I have checked the generated APK and it contains the SO for adaptive cards but still does not work.
Try adding a static ctor before accessing the API and see if that helps.
static {
System.loadLibrary("adaptivecards-native-lib");
}

Categories

Resources