FileNotFoundException with Universal Image Loader on Android 7+ - android

I use Universal Image Loader for image loading inside our android app. It works well with usual links, however, since our API has changed, now this link doesn't work: https://img.anews.com?url=https://img.anews.com/media/posts/images/20180419/89413447.jpg&w=1080&h=735
This is the error log:
04-19 11:08:11.717 16501-16779/anews.com E/ImageLoader: https://img.anews.com?url=https://img.anews.com/media/posts/images/20180419/89413447.jpg&w=1080&h=735
java.io.FileNotFoundException: https://img.anews.com?url=https://img.anews.com/media/posts/images/20180419/89413447.jpg&w=1080&h=735
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:250)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java)
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromNetwork(BaseImageDownloader.java:124)
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:88)
at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.getImageStream(BaseImageDecoder.java:98)
at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.decode(BaseImageDecoder.java:74)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeImage(LoadAndDisplayImageTask.java:265)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:238)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
I seem to have this problem only on Android 7+. On all previous versions, images load just fine. Any help or suggestions appreciated.

Related

Getting file not found exception while trying to connect with url in android studio.How to solve this?

I am trying to connect to mysql using wampp and the following error is thrown how to solve this?
W/System.err: java.io.FileNotFoundException: http://192.168.2.198/login.php
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:250)
at com.example.mysqltest.BackgroundWorker.doInBackground(BackgroundWorker.java:46)
at com.example.mysqltest.BackgroundWorker.doInBackground(BackgroundWorker.java:19)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
There are following possibility to occur this issue
maybe your project or file location is not perfect
maybe because of the port number or IP not match time of calling
First, try to run this page in your mobile browser web browser and it will work in mobile browser then it will work in API definitely if not work then you need to change in your config

Buffer Overflow - No available Space crash in Android

So, I'm constantly getting this buffer overflow crash (393238).
One example, I've just fixed is, when I run Log.d("test", null) I get the crash.
If I remove this line of code, there's no crash.
As far as I know, every single bug in my code, whether it's an ArrayOutOfBounds, Incorrect Type, Null Exceptions, etc. are all causing Buffer Overflow crashes.
I don't know why this is happening. Why is Android not gracefully handling and returning Exception messages, rather than crashing the program with a Buffer Overflow message all the time?
Also, I've tried running on my own phone through usb debugging, Nexus emulator, etc. Still happens.
Here is the exact message:
W/ErrorProcessor: onFatalError, processing error from engine(4)
com.google.android.apps.gsa.shared.speech.a.g: Error reading from input stream
at com.google.android.apps.gsa.staticplugins.recognizer.i.a.a(SourceFile:342)
at com.google.android.apps.gsa.staticplugins.recognizer.i.a$1.run(SourceFile:1367)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85)
Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
at com.google.android.apps.gsa.speech.audio.Tee.g(SourceFile:2531)
at com.google.android.apps.gsa.speech.audio.ap.read(SourceFile:555)
at java.io.InputStream.read(InputStream.java:101)
at com.google.android.apps.gsa.speech.audio.al.run(SourceFile:362)
at com.google.android.apps.gsa.speech.audio.ak$1.run(SourceFile:471)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
at java.lang.Thread.run(Thread.java:761) 
at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85) 
I had the same thing. My app ran fine on my main computer from android studio on both a real android tablet and the tablet emulator. When I did the exact same thing on my laptop I got this crash, for both real device and emulator.
I ended up 'fixing it' by deleting the project build directory, and doing a Tools->AVD Manager->Actions Wipe Data. I then rebuilt/ran the project and it worked. Go figure...

GsaIOException Buffer overflow, no available space

I have a MediaPlayer app with a live streaming function. When I test the app with a physically device(API 22 Lollipop and API 23 Marshmallow) there are no problems with starting of the stream.
Today I want to test the application with a Emulator (API 25 Nougat). Stream is not working and I get the following error:
(SourceFile:139)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
at java.lang.Thread.run(Thread.java:761) 
at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85) 
02-23 23:58:09.834 2166-3554/com.google.android.googlequicksearchbox:search W/ErrorProcessor: onFatalError, processing error from engine(4)
com.google.android.apps.gsa.shared.speech.a.g: Error reading from input stream
at com.google.android.apps.gsa.staticplugins.recognizer.i.a.a(SourceFile:342)
at com.google.android.apps.gsa.staticplugins.recognizer.i.a$1.run(SourceFile:1367)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85)
Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
at com.google.android.apps.gsa.speech.audio.Tee.g(SourceFile:2531)
at com.google.android.apps.gsa.speech.audio.ap.read(SourceFile:555)
at java.io.InputStream.read(InputStream.java:101)
at com.google.android.apps.gsa.speech.audio.al.run(SourceFile:362)
at com.google.android.apps.gsa.speech.audio.ak$1.run(SourceFile:471)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
at java.lang.Thread.run(Thread.java:761) 
at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85) 
I can recognize only one thing where I think it is important.
GsaIOException: Error code: 393238 | Buffer overflow, no available space
But I don't know what it could mean. Can anyone explain what kind of Exception it is. And where I can search at the code to find the problem?
I had a similar issue, for me it was crashing on devices too, with the same error. This is how I fixed it for devices:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
More details here: Looping Error on Android Emulator
To make the app work on simulator, after applying the fix from the above link, I had to create a new simulator based on x86 architecture (not x86_64 as before) and it worked.
I was getting these exact messages while trying to debug my device with logcat. Could not figure out where they were coming from. Finally realized that a preceding debug session with the emulator was generating these. I simply quit the emulator to stop them.
I did receive the same issue, and i did the following things to make this crash occurs.
Few api's that i wrote needed to allocate some memory since a file needed to be parsed and kept in that buffer. I started parsing the file without allocating the buffer hence received that message.
So you could look into similar code where you might be doing the same.
I've resolved this by deleting the apk files that i have created before and they still remain in Project Files list.

Volley UnknownHostExeption

I have a problem with using Volley. I'm trying to send request to site http://lawbite_api.codebnb.me but results differ from phone to phone (depends on Android version). For some reason on Android 6 all OK, but on Android 4.4 I'm getting java.net.UnknownHostException.
Here is stacktrace:
com.android.volley.NoConnectionError: java.net.UnknownHostException: http://lawbite_api.codebnb.me/api/login
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:151)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
Caused by: java.net.UnknownHostException: http://lawbite_api.codebnb.me/api/login
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:279)
at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197)
at com.android.volley.toolbox.HurlStack.addBodyIfExists(HurlStack.java:264)
at com.android.volley.toolbox.HurlStack.setConnectionParametersForRequest(HurlStack.java:234)
at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:107)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
The simple answer is to not use an underscore in the subdomain part of the hostname. It's probably something to do with the hostname rules in Android 4.4 (and probably lower).
I don't think url will change as per API level in Volley. I have already use same URL for all devices with API greater than Android 4.4 and there is no issue regarding to URL there is something else. Please provide Volley request code

Android 4.2 Lockscreen Widget image bitmaps won't load

I'm trying to enable my widget in my app on the Android 4.2 lockscreen and it works fine, however it is unable to resolve any of the image uris. The error I get is this:
java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.tvshowfavs/cache/22kifo7sdmyet7x7kphdgch69: open failed: EACCES (Permission denied)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileInputStream.<init>(FileInputStream.java:78)
at java.io.FileInputStream.<init>(FileInputStream.java:105)
at android.content.ContentResolver.openInputStream(ContentResolver.java:447)
at android.widget.ImageView.resolveUri(ImageView.java:636)
at android.widget.ImageView.setImageURI(ImageView.java:381)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.widget.RemoteViews$ReflectionAction.apply(RemoteViews.java:1146)
at android.widget.RemoteViews.performApply(RemoteViews.java:2304)
at android.widget.RemoteViews.apply(RemoteViews.java:2263)
at android.widget.RemoteViewsAdapter$RemoteViewsFrameLayout.onRemoteViewsLoaded(RemoteViewsAdapter.java:286)
at android.widget.RemoteViewsAdapter$RemoteViewsFrameLayoutRefSet.notifyOnRemoteViewsLoaded(RemoteViewsAdapter.java:335)
at android.widget.RemoteViewsAdapter$4.run(RemoteViewsAdapter.java:993)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)
Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:400)
Anyone have any idea why it can't open an image that is stored on the emulated storage? This image was previously downloaded and cached using the Environment.getExternalStorageDirectory(), so it should be properly written to the storage directory. This is on a Nexus 10 that I'm receiving this exception when any of the images are attempted to be loaded. Any help is appreciated.
Alright, I figured out the problem. I was using the RemoteView method setImageUri(), which it looks as though won't work since the different process can't access the file. The solution is to use setImageViewBitmap() and to decode the bitmap yourself, like this, for example: BitmapFactory.decodeFile(Uri.parse(uri).getPath())
I find it strange that the setImageUri() works fine with launchers but not on the lockscreen, however.
Tomáš was right; using a content: Uri instead of a file: Uri fixed the problem for me.
See this sample project demonstrating how to serve Files via a ContentProvider from this SO answer.

Categories

Resources