Using OkHTTP in my Android app, I have a lot of exception :
EX:
java.lang.AssertionError: libcore.io.ErrnoException: getsockname failed: EBADF (Bad file number)
at libcore.io.IoBridge.getSocketLocalPort(IoBridge.java:649)
at libcore.io.IoBridge.closeSocket(IoBridge.java:202)
at java.net.PlainSocketImpl.close(PlainSocketImpl.java:162)
at ...
Caused by: libcore.io.ErrnoException: getsockname failed: EBADF (Bad file number)
at libcore.io.Posix.getsockname(Posix.java)
at libcore.io.ForwardingOs.getsockname(ForwardingOs.java:69)
at libcore.io.IoBridge.getSocketLocalPort(IoBridge.java:645)
at libcore.io.IoBridge.closeSocket(IoBridge.java:202)
at java.net.PlainSocketImpl.close(PlainSocketImpl.java:162)
at java.net.Socket.close(Socket.java:319)
at ...
I can't catch this error because it's inside the OkHTTP library.
Any solution for me ?
Thanks
I finally discuss with the OkHttp Team, And now the fix is inside the current release !
OkHttp v2.5.0
OkIO v1.6.0
More information here :
https://github.com/square/okhttp/pull/1817
Root cause is a android 4 bug :
https://code.google.com/p/android/issues/detail?id=54072
Related
I've got a Xamarin.Forms app on the Google Play store for changing the pitch and speed of music and video. Its got a file read permissions problem on Android, but only for some users (stack trace shown below). I've set the external storage read permission:
uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
in the manifest.
For the majority of users, all is working correctly when selecting an audio/video file. But I'm getting notified via Rollbar https://rollbar.com/ of the file permissions issues for some users in android versions 8-11.
I'm using the https://www.nuget.org/packages/Xamarin.Plugin.FilePicker/ plugin to browse for music/video files in my app.
Rollbar error notification from my app:
Java.IO.FileNotFoundException: /storage/emulated/0/Download/Kev Hlub Tu Tag Nag Hmo (Lyric).mp4: open failed: ENOENT (No such file or directory) ---> Android.Systems.ErrnoException: open failed: ENOENT (No such file or directory)
Stack trace:
Java.IO.FileNotFoundException: /storage/emulated/0/Download/Kev Hlub Tu Tag Nag Hmo (Lyric).mp4: open failed: ENOENT (No such file or directory) ---> Android.Systems.ErrnoException: open failed: ENOENT (No such file or directory)
--- End of inner exception stack trace ---
at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <24e422c426e0468ca1fd74b59870ff08>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <24e422c426e0468ca1fd74b59870ff08>:0
at Android.Media.MediaPlayer.SetDataSource (Android.Content.Context context, Android.Net.Uri uri) [0x00053] in <4586a87d34754df7a521e11e2fd22040>:0
at FormsVideoLibrary.Droid.VideoPlayerRenderer.SetSource () [0x0003e] in <01a54421e2d344a3a06c7dbb0d52b8a1>:0
--- End of managed Java.IO.FileNotFoundException stack trace ---
java.io.FileNotFoundException: /storage/emulated/0/Download/Kev Hlub Tu Tag Nag Hmo (Lyric).mp4: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:492)
at java.io.FileInputStream.<init>(FileInputStream.java:160)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1259)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1230)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1147)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1072)
at crc646e83aba39dfdd46d.VideoPlayerRenderer.n_surfaceCreated(Native Method)
at crc646e83aba39dfdd46d.VideoPlayerRenderer.surfaceCreated(VideoPlayerRenderer.java:70)
at android.view.SurfaceView.updateSurface(SurfaceView.java:1284)
at android.view.SurfaceView$1.onPreDraw(SurfaceView.java:225)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1124)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3854)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2618)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9971)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)
at android.view.Choreographer.doCallbacks(Choreographer.java:809)
at android.view.Choreographer.doFrame(Choreographer.java:744)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8512)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8373)
at libcore.io.IoBridge.open(IoBridge.java:478)
... 24 more
My App on Google Play:
https://play.google.com/store/apps/details?id=com.darceysoft.mavsc&hl=en&gl=US
Thanks in advance for any help on this.
Cheers,
Wayne
I am making an ArCore app and when I build my ModelRenderable I am getting this exception thrown:
java.util.concurrent.CompletionException: java.io.FileNotFoundException: Coffee Cup_final.obj (No such file or directory)
at com.google.ar.sceneform.utilities.SceneformBufferUtils.inputStreamToByteBuffer(SourceFile:49)
at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0$LoadRenderableFromSfbTask(LoadRenderableFromSfbTask.java:119)
at com.google.ar.sceneform.rendering.-$$Lambda$LoadRenderableFromSfbTask$0DkaOpfpmr8DYlbaxWogZtUpKTw.get(Unknown Source:4)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1625)
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: java.io.FileNotFoundException: Coffee Cup_final.obj (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
But I can see this file exists. Here is the renderable followed by build gradle.
ModelRenderable.builder()
.setSource(this, Uri.parse("Coffee Cup_final.obj.obj"))
.build()
.thenAccept(this::onRenderableLoaded)
.exceptionally(throwable -> {
Log.i("Sceneform", "failed to load model");
return null;
});
sceneform.asset('sampledata/Coffee Cup_final.obj.obj',
'default',
'sampledata/Coffee Cup_final.obj.sfa',
'src/main/assets/Coffee Cup_final.obj')
Does it have to do with the uppercase naming of my 3D object?
The sceneform.asset() step in build.gradle converts the OBJ file to Sceneform's internal SFB file format. So the file that's created and copied to your assets folder is src/main/assets/Coffee Cup_final.obj.sfb . So if you change
ModelRenderable.builder().setSource(this, Uri.parse("Coffee Cup_final.obj.obj"))
to
ModelRenderable.builder().setSource(this, Uri.parse("Coffee Cup_final.obj.sfb"))
it should work.
I installed Andorid Studio and the first time I started a new project.
at compile time I got this error: "Connection refused: connect"
I tried to set proxy and I also tried to use local gradle, but it didn't help.
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'MyApplication2'.
[...]
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.
[...]
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.3.1.
Required by:
project :
[...]
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.3.1.
[...]
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
[...]e
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
[...]
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to xx.xxx.xx.xx:8080 [/xx.xxx.xx.xx] failed: Connection refused: connect
[...]
Caused by: java.net.ConnectException: Connection refused: connect
[...]
The issue can be because of proxy,
As an alternative, download the Gradle distribution and give the path to that zip file in gradle-wrapper.properties.
distributionUrl=../../../tools/gradle-4.10.1-all.zip
it reads:
Caused by: org.apache.http.conn.HttpHostConnectException:
Connect to xx.xxx.xx.xx:8080 [/xx.xxx.xx.xx] failed: Connection refused: connect
which seems to be a local repository or a local proxy server being at fault.
check the buildscript repositories and proxy settings.
I am using Crashlytics version 2.6.8 for my Android app. I have configured Crashlytics in base feature following answer here. Crashlystics is initialized with Fabric using following code snippet
Fabric.with(context, crashlyticsKit);
Crashlytics Answers throws this exception on startup of Android instant apps
E/Answers: Failed to enable events
java.io.IOException: ftruncate failed: EACCES (Permission denied)
at java.io.RandomAccessFile.setLength(RandomAccessFile.java:630)
at io.fabric.sdk.android.services.common.QueueFile.initialize(QueueFile.java:213)
at io.fabric.sdk.android.services.common.QueueFile.<init>(QueueFile.java:130)
at io.fabric.sdk.android.services.events.QueueFileEventStorage.<init>(QueueFileEventStorage.java:58)
at io.fabric.sdk.android.services.events.GZIPQueueFileEventStorage.<init>(GZIPQueueFileEventStorage.java:32)
at com.crashlytics.android.answers.AnswersFilesManagerProvider.getAnalyticsFilesManager(AnswersFilesManagerProvider.java:44)
at com.crashlytics.android.answers.AnswersEventsHandler$4.run(AnswersEventsHandler.java:121)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:818)
Caused by: android.system.ErrnoException: ftruncate failed: EACCES (Permission denied)
at libcore.io.Posix.ftruncate(Native Method)
at libcore.io.BlockGuardOs.ftruncate(BlockGuardOs.java:148)
at java.io.RandomAccessFile.setLength(RandomAccessFile.java:628)
Is it caused due to storage access? If so, Is it possible to configure Crashlytics from accessing storage in case of Instant apps?
It doesn't seem like you are initializing Answers itself, only Crashlytics?
Try something like this if you want Crashlytics and Answers from Fabric:
final Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics(), new Answers())
.debuggable(true)
.build();
Fabric.with(fabric);
I am receiving this exception while creation of signed apk of my application.
Proguard returned with error code 1. See console
java.io.IOException: Can't read [C:\Users\xx\Desktop\APP\xx\Users\imac\Amit\Workspace\xx\libs\universal-image-loader-1.9.4.jar] (No such file or directory)
at proguard.InputReader.readInput(InputReader.java:230)
at proguard.InputReader.readInput(InputReader.java:200)
at proguard.InputReader.readInput(InputReader.java:178)
at proguard.InputReader.execute(InputReader.java:100)
at proguard.ProGuard.readInput(ProGuard.java:196)
at proguard.ProGuard.execute(ProGuard.java:78)
at proguard.ProGuard.main(ProGuard.java:492)
Caused by: java.io.IOException: No such file or directory
at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:50)
at proguard.InputReader.readInput(InputReader.java:226)
... 6 more