Android ION post request failing - android

I've tried to make a POST request using ION as showcased here but I'm getting the following errors.
2020-11-30 14:08:37.353 8610-8651/com.example.test_app E/AndroidRuntime: FATAL EXCEPTION: ion-ion
Process: com.example.test_app, PID: 8610
java.lang.AssertionError
at com.koushikdutta.async.AsyncSSLSocketWrapper.write(AsyncSSLSocketWrapper.java:492)
at com.koushikdutta.async.AsyncSSLSocketWrapper.handleHandshakeStatus(AsyncSSLSocketWrapper.java:378)
at com.koushikdutta.async.AsyncSSLSocketWrapper.handshake(AsyncSSLSocketWrapper.java:182)
at com.koushikdutta.async.http.AsyncSSLSocketMiddleware.tryHandshake(AsyncSSLSocketMiddleware.java:89)
at com.koushikdutta.async.http.AsyncSSLSocketMiddleware$2.onConnectCompleted(AsyncSSLSocketMiddleware.java:106)
at com.koushikdutta.async.http.AsyncSocketMiddleware.lambda$getSocket$3$AsyncSocketMiddleware(AsyncSocketMiddleware.java:217)
at com.koushikdutta.async.http.-$$Lambda$AsyncSocketMiddleware$glazjOxu-iNIRY4N890Wl1ngyGo.onCompleted(Unknown Source:12)
at com.koushikdutta.async.future.SimpleFuture.lambda$setCallback$0(SimpleFuture.java:212)
at com.koushikdutta.async.future.-$$Lambda$SimpleFuture$h_gK5Y1XHZI1H8JTE2xOg4dXbp8.onCompleted(Unknown Source:2)
at com.koushikdutta.async.future.SimpleFuture$FutureCallsite.loop(SimpleFuture.java:130)
at com.koushikdutta.async.future.SimpleFuture.handleCallbackUnlocked(SimpleFuture.java:153)
at com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:191)
at com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:174)
at com.koushikdutta.async.future.-$$Lambda$VNAuWcttAhMr3VsWCERbmWE6yR0.success(Unknown Source:2)
at com.koushikdutta.async.future.SimpleFuture.lambda$success$4(SimpleFuture.java:279)
at com.koushikdutta.async.future.-$$Lambda$SimpleFuture$DxIsaj7NQi76eWgOKS4iviWPLV0.onCompleted(Unknown Source:4)
at com.koushikdutta.async.future.SimpleFuture$FutureCallsite.loop(SimpleFuture.java:130)
at com.koushikdutta.async.future.SimpleFuture.handleCallbackUnlocked(SimpleFuture.java:153)
at com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:191)
at com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:178)
at com.koushikdutta.async.http.-$$Lambda$cBC5du-82c5EcL72rP5wNK7Y2Y4.onConnectCompleted(Unknown Source:2)
at com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:896)
at com.koushikdutta.async.AsyncServer.run(AsyncServer.java:717)
at com.koushikdutta.async.AsyncServer.access$800(AsyncServer.java:46)
at com.koushikdutta.async.AsyncServer$11.run(AsyncServer.java:671)
Any idea? Thanks.

I found the solution, the problem was that this library doesn't seem to work with Gradle versions newer than 4.0.1.

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"

Problem starting DJI simulation [dji-sdk]

I'm trying to implement the sample code of dji developer for android but i can't start the app, i add my com.dji.sdk.API_KEY and when i launch the app i get this errors:
2020-04-03 19:44:10.734 5567-5607/com.dji.sdk.sample E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.dji.sdk.sample, PID: 5567
java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String dji.midware.natives.SDKRelativeJNI.native_getUsbAccessoryAttachedString() (tried Java_dji_midware_natives_SDKRelativeJNI_native_1getUsbAccessoryAttachedString and Java_dji_midware_natives_SDKRelativeJNI_native_1getUsbAccessoryAttachedString__)
at dji.midware.natives.SDKRelativeJNI.native_getUsbAccessoryAttachedString(Native Method)
at dji.sdk.sdkmanager.DJISDKManager.<clinit>(Unknown Source:32)
at dji.sdk.sdkmanager.DJISDKManager.getInstance(Unknown Source:0)
at com.dji.sdk.sample.internal.controller.MainActivity$5.run(:241)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
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:919)
If you need code of any thing i can post it too. Thanks.
EDIT:
I can do it with an hardware Samsung, not in virtual device.
I'm using an emulator, but the MSDK doesn't support it.
It only works with a real device.

Why android studio not showing line where code error?

i'm debuging a running app and see logcat in android studio, when the app have a error usually android studio will showing some error detail in logcat with the line where the error happened. but i just get some error detail like this
2019-09-04 08:50:46.894 11148-11148/id.co.hallo.hallo
E/AndroidRuntime: FATAL EXCEPTION: main
Process: id.co.hallo.hallo, PID: 11148
java.lang.ClassCastException: java.lang.String cannot be cast to id.co.hallo.hallo.support.ap
at id.co.hallo.hallo.ui.view.residence.setting.SettingResidence$c.run(Unknown
Source)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6238)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
what should i do to get the detail error with line code where the error happened?
First, you need to make sure the code in build.gradle proguard is set to false.
Second, the code you called maybe in a SDK/plugin, so it reminded "unKnown"
Hope it helps.
Most of the times the LogCat shows the line of code where the exception is raised, i recommend to you look in the LogCat for the message starting with:
Caused by
but in this case the exception is pretty obvious, an incorrect cast:
java.lang.ClassCastException: java.lang.String cannot be cast to
id.co.hallo.hallo.support.ap
and this error occur in the class:
id.co.hallo.hallo.ui.view.residence.setting.SettingResidence

Fatal Exception at AnroidRuntime after releasing new update

After updating for a new release of my app I'm getting this error crash repeatedly on the opening of the app and nothing else. This crash happening after few seconds of the opening of the app.
Error Log:
E/AndroidRuntime: FATAL EXCEPTION: Thread-3
Process: com.company.app, PID: 13304
java.lang.NoSuchMethodError: No direct method <init>(Lorg/apache/http/c/c;Lorg/apache/http/conn/scheme/SchemeRegistry;)V in class Lorg/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager; or its super classes (declaration of 'org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager' appears in /system/framework/org.apache.http.legacy.boot.jar)
at com.a.g.c.c(Unknown Source:54)
at com.a.g.c.a(Unknown Source:4)
at com.a.e.b.a(Unknown Source:0)
at com.a.e.b.b(Unknown Source:23000)
at com.a.d.b.c(Unknown Source:5000)
at com.a.d.b.b(Unknown Source:0)
at com.a.d.b.a(Unknown Source:4000)
at com.a.c.f.a(Unknown Source:12000)
at com.a.c.f$1.run(Unknown Source:4)
at com.a.a.b.b.a(Unknown Source:8)
at com.a.e.a(Unknown Source:51031)
at com.a.e.a(Unknown Source:0)
at com.a.e$4.run(Unknown Source:1000)
at com.a.e.o(Unknown Source:31)
at com.a.e.a(Unknown Source:45000)
at com.a.c.a(Unknown Source:20)
at com.a.c.b(Unknown Source:27000)
at com.a.c$1.run(Unknown Source:7)
at com.a.a.b.c.run(Unknown Source:8)
at com.a.a.b.d.run(Unknown Source:2000)
This error is showing in Logcat not getting on Crashlytics.
What are the main causes of this happening and how to solve this problem?
What are the main causes of this happening and how to solve this problem?
This is due to your apache classes are stripped by your proguard obfuscation step. Try to add -keep options for those apache classes. E.g.
-keep class org.apache.http.** { *; }

FATAL EXCEPTION: GoogleApiHandler

In my project i'm using the monetization service(Vungle/AppLovin).
When I'm trying to load an ad, i get this exception
E/AndroidRuntime: FATAL EXCEPTION: GoogleApiHandler
Process: kz.ikar, PID: 3673
java.lang.NoSuchMethodError: No virtual method setChannelId(Ljava/lang/String;)Landroid/support/v4/app/NotificationCompat$Builder; in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes (declaration of 'android.support.v4.app.NotificationCompat$Builder' appears in /data/app/kz.ikar-2oCl4DY4J8w7wP-jirbYvA==/split_lib_dependencies_apk.apk)
at com.google.android.gms.common.GoogleApiAvailability.zza(Unknown Source:225)
at com.google.android.gms.common.GoogleApiAvailability.zza(Unknown Source:15)
at com.google.android.gms.common.api.internal.zzbm.zzc(Unknown Source:4)
at com.google.android.gms.common.api.internal.zzbo.onConnectionFailed(Unknown Source:104)
at com.google.android.gms.common.api.internal.zzbo.connect(Unknown Source:83)
at com.google.android.gms.common.api.internal.zzbo.zza(Unknown Source:47)
at com.google.android.gms.common.api.internal.zzbm.handleMessage(Unknown Source:283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
In my project I have two fragments in one activity. The user gets an ad in the second one. If I load an ad from the activity, it works well. What can be the cause of this issue?
By the way both ad networks(Vungle and AppLovin) return this exception
I had the same problem and I fixed it downgrading to firebase Google Play services 11.6.0
One reason you could be getting this error is if your buildToolsVersion in your app-level Gradle is less than 26. Either that or your v4 support is less than 26.0.0 seeing as NotificationCompat.Builder was added in API 26.

Categories

Resources