Android can't reach URL using Volley library - android

Hi I write my app and have many problems but this is really strange.
All connections to mysql by php was working good. Today I everything was ok but suddenly i couldn't reach URL.
Here is the logcat:
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie I/System.out: AsyncTask #8 calls detatch()
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.20 refused
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:248)
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:172)
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:130)
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.impl.client.DefaultRequestDirector.executeOriginal(DefaultRequestDirector.java:1337)
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:705)
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:579)
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:503)
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:481)
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at com.example.dawid.logowanie.JSONParser.makeHttpRequest(JSONParser.java:51)
05-18 19:06:00.310 21093-21353/com.example.dawid.logowanie W/System.err: at com.example.dawid.logowanie.AddBookActivity$CreateNewProduct.doInBackground(AddBookActivity.java:197)
05-18 19:06:00.320 21093-21353/com.example.dawid.logowanie W/System.err: at com.example.dawid.logowanie.AddBookActivity$CreateNewProduct.doInBackground(AddBookActivity.java:156)
05-18 19:06:00.320 21093-21353/com.example.dawid.logowanie W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:295)
05-18 19:06:00.320 21093-21353/com.example.dawid.logowanie W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-18 19:06:00.320 21093-21353/com.example.dawid.logowanie W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
05-18 19:06:00.320 21093-21353/com.example.dawid.logowanie W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
05-18 19:06:00.320 21093-21353/com.example.dawid.logowanie W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
05-18 19:06:00.320 21093-21353/com.example.dawid.logowanie W/System.err: at java.lang.Thread.run(Thread.java:818)
05-18 19:06:00.320 21093-21353/com.example.dawid.logowanie W/System.err: Caused by: java.net.ConnectException: failed to connect to /192.168.1.20 (port 80): connect failed: ETIMEDOUT (Connection timed out)
05-18 19:06:00.330 21093-21353/com.example.dawid.logowanie W/System.err: at libcore.io.IoBridge.connect(IoBridge.java:124)
05-18 19:06:00.330 21093-21353/com.example.dawid.logowanie W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
05-18 19:06:00.330 21093-21353/com.example.dawid.logowanie W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:452)
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: at java.net.Socket.connect(Socket.java:884)
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:124)
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:193)
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: ... 16 more
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: Caused by: android.system.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: at libcore.io.Posix.connect(Native Method)
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:111)
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: at libcore.io.IoBridge.connectErrno(IoBridge.java:137)
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: at libcore.io.IoBridge.connect(IoBridge.java:122)
05-18 19:06:00.340 21093-21353/com.example.dawid.logowanie W/System.err: ... 21 more
In other cases pDialog shows I wait and wait and get nothing only:
05-18 19:10:05.850 27036-27036/com.example.dawid.logowanie E/RegisterActivity: Blad Rejestracji: null
05-18 19:10:05.900 27036-27036/com.example.dawid.logowanie D/ViewRootImpl: #3 mView = null
05-18 19:10:05.920 27036-27036/com.example.dawid.logowanie D/Volley: [1] Request.finish: 7625 ms: [ ] http://192.168.1.20/android_login_api/Check.php 0x676929da NORMAL 1
05-18 19:10:05.920 27036-27036/com.example.dawid.logowanie D/ViewRootImpl: #1 mView = android.widget.LinearLayout{4c07063 V.E...... ......I. 0,0-0,0 #102039d android:id/toast_layout_root}
05-18 19:10:05.930 27036-27036/com.example.dawid.logowanie E/ViewRootImpl: sendUserActionEvent() mView == null
Like I said earlier everything was working fine but suddenly stopped. I restarted my phone many times, I change phone and nothing. I did Invalidate Caches/Restart but still have the problem.

Solved! It was because of my home wifi network. I turned on hotspot on another phone and connect my laptop and phone to test and worked. I still don't understand how earlier everything was working on my home wifi and suddenly stopped.
Someone know how is it possible?

Related

AzureSpatialAnchors basic demo not saving

I just checked out the spatial anchors demo from GitHub, changed the keys and deployed it to my Samsung S8 successfully.
But when I try to save an anchor I get an IllegalStateException:
05-18 12:17:32.667 5536-6285/com.microsoft.sampleandroid E/CBindingAutoGen: exception causing failure: std::exception
05-18 12:17:32.670 5536-6286/com.microsoft.sampleandroid W/System.err: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: std::exception.Request CV: . Response CV: .
05-18 12:17:32.674 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.FutureTask.report(FutureTask.java:123)
05-18 12:17:32.675 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.FutureTask.get(FutureTask.java:193)
05-18 12:17:32.677 5536-6286/com.microsoft.sampleandroid W/System.err: at com.microsoft.sampleandroid.AzureSpatialAnchorsManager.lambda$toEmptyCompletableFuture$2(AzureSpatialAnchorsManager.java:147)
05-18 12:17:32.680 5536-6286/com.microsoft.sampleandroid W/System.err: at com.microsoft.sampleandroid.-$$Lambda$AzureSpatialAnchorsManager$8SSZbzB3fyFTuS1Rv6e_KEvy8B8.run(Unknown Source:2)
05-18 12:17:32.682 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1661)
05-18 12:17:32.684 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
05-18 12:17:32.686 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
05-18 12:17:32.687 5536-6286/com.microsoft.sampleandroid W/System.err: at java.lang.Thread.run(Thread.java:764)
05-18 12:17:32.690 5536-6286/com.microsoft.sampleandroid W/System.err: Caused by: java.lang.IllegalStateException: std::exception.Request CV: . Response CV: .
05-18 12:17:32.692 5536-6286/com.microsoft.sampleandroid W/System.err: at com.microsoft.azure.spatialanchors.NativeLibraryHelpers.checkStatus(NativeLibraryHelpers.java:65)
05-18 12:17:32.693 5536-6286/com.microsoft.sampleandroid W/System.err: at com.microsoft.azure.spatialanchors.CloudSpatialAnchorSession$3.call(CloudSpatialAnchorSession.java:393)
05-18 12:17:32.695 5536-6286/com.microsoft.sampleandroid W/System.err: at com.microsoft.azure.spatialanchors.CloudSpatialAnchorSession$3.call(CloudSpatialAnchorSession.java:390)
05-18 12:17:32.696 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
05-18 12:17:32.697 5536-6286/com.microsoft.sampleandroid W/System.err: ... 3 more
05-18 12:17:32.700 5536-6286/com.microsoft.sampleandroid W/System.err: java.util.concurrent.CompletionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: std::exception.Request CV: . Response CV: .
05-18 12:17:32.701 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:276)
05-18 12:17:32.701 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:282)
05-18 12:17:32.702 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1664)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
05-18 12:17:32.703 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
05-18 12:17:32.703 5536-6286/com.microsoft.sampleandroid W/System.err: at java.lang.Thread.run(Thread.java:764)
05-18 12:17:32.704 5536-6286/com.microsoft.sampleandroid W/System.err: Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: std::exception.Request CV: . Response CV: .
05-18 12:17:32.705 5536-6286/com.microsoft.sampleandroid W/System.err: at com.microsoft.sampleandroid.AzureSpatialAnchorsManager.lambda$toEmptyCompletableFuture$2(AzureSpatialAnchorsManager.java:150)
05-18 12:17:32.705 5536-6286/com.microsoft.sampleandroid W/System.err: at com.microsoft.sampleandroid.-$$Lambda$AzureSpatialAnchorsManager$8SSZbzB3fyFTuS1Rv6e_KEvy8B8.run(Unknown Source:2)
05-18 12:17:32.706 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1661)
... 3 more
05-18 12:17:32.707 5536-6286/com.microsoft.sampleandroid W/System.err: Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: std::exception.Request CV: . Response CV: .
at java.util.concurrent.FutureTask.report(FutureTask.java:123)
05-18 12:17:32.708 5536-6286/com.microsoft.sampleandroid W/System.err: at java.util.concurrent.FutureTask.get(FutureTask.java:193)
at com.microsoft.sampleandroid.AzureSpatialAnchorsManager.lambda$toEmptyCompletableFuture$2(AzureSpatialAnchorsManager.java:147)
05-18 12:17:32.709 5536-6286/com.microsoft.sampleandroid W/System.err: ... 5 more
05-18 12:17:32.710 5536-6286/com.microsoft.sampleandroid W/System.err: Caused by: java.lang.IllegalStateException: std::exception.Request CV: . Response CV: .
05-18 12:17:32.711 5536-6286/com.microsoft.sampleandroid W/System.err: at com.microsoft.azure.spatialanchors.NativeLibraryHelpers.checkStatus(NativeLibraryHelpers.java:65)
at com.microsoft.azure.spatialanchors.CloudSpatialAnchorSession$3.call(CloudSpatialAnchorSession.java:393)
05-18 12:17:32.713 5536-6286/com.microsoft.sampleandroid W/System.err: at com.microsoft.azure.spatialanchors.CloudSpatialAnchorSession$3.call(CloudSpatialAnchorSession.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 3 more
I just used the normal code and did nothing else
Check the credentials… Error occurs if trying to access with wrong credentials.

Connection refused in Android M while trying httprequest from Android Service

IOException
01-11 18:28:25.304 W/System.err: org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.42 refused
01-11 18:28:25.306 W/System.err: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:193)
01-11 18:28:25.306 W/System.err: at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:169)
01-11 18:28:25.306 W/System.err: at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:124)
01-11 18:28:25.306 W/System.err: at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:370)
01-11 18:28:25.306 W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:560)
01-11 18:28:25.306 W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:492)
01-11 18:28:25.307 W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:470)
01-11 18:28:25.307 W/System.err: at com.aceuat.sms.ACESMSGService.connectServerTeachr(ACESMSGService.java:213)
01-11 18:28:25.307 W/System.err: at com.aceuat.sms.ACESMSGService$1$1.run(ACESMSGService.java:103)
01-11 18:28:25.307 W/System.err: at java.lang.Thread.run(Thread.java:818)
01-11 18:28:25.307 W/System.err: Caused by: java.net.ConnectException: socket failed: EACCES (Permission denied)
01-11 18:28:25.307 W/System.err: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
01-11 18:28:25.307 W/System.err: ... 9 more
01-11 18:28:25.307 W/System.err: Caused by: java.net.SocketException: socket failed: EACCES (Permission denied)
01-11 18:28:25.313 W/System.err: at libcore.io.IoBridge.socket(IoBridge.java:619)
01-11 18:28:25.313 W/System.err: at java.net.PlainSocketImpl.create(PlainSocketImpl.java:198)
01-11 18:28:25.314 W/System.err: at java.net.Socket.checkOpenAndCreate(Socket.java:689)
01-11 18:28:25.314 W/System.err: at java.net.Socket.connect(Socket.java:849)
01-11 18:28:25.314 W/System.err: at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:124)
01-11 18:28:25.314 W/System.err: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:149)
01-11 18:28:25.314 W/System.err: ... 9 more
01-11 18:28:25.314 W/System.err: Caused by: android.system.ErrnoException: socket failed: EACCES (Permission denied)
01-11 18:28:25.314 W/System.err: at libcore.io.Posix.socket(Native Method)
01-11 18:28:25.314 W/System.err: at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:282)
01-11 18:28:25.314 W/System.err: at libcore.io.IoBridge.socket(IoBridge.java:604)
01-11 18:28:25.314 W/System.err: ... 14 more
01-11 18:28:40.280 I/ACES: Service is still running
Its Working fine in android lower versions.
As the Problem shows: You need to add internet access permission in the app.
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.INTERNET" />
<application ...
</manifest>
And at last when app asks for internet access in popup allow the app to use internet!

Connection to IP is refused when trying to connect from android application

I am trying to connect my android app with server which is running in same PC,ip is 192.168.1.129,and tomcat port is 8081,getting below issue,Can any one help me to resolve this?
10-07 15:51:45.672 29710-5937/com.net.app W/System.err: org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.129:8081 refused
10-07 15:51:45.673 29710-5937/com.net.app W/System.err: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:188)
10-07 15:51:45.673 29710-5937/com.net.app W/System.err: at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:169)
10-07 15:51:45.673 29710-5937/com.net.app W/System.err: at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:124)
10-07 15:51:45.673 29710-5937/com.net.app W/System.err: at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:379)
10-07 15:51:45.673 29710-5937/com.net.app W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:580)
10-07 15:51:45.673 29710-5937/com.net.app W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:503)
10-07 15:51:45.674 29710-5937/com.net.app W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:481)
10-07 15:51:45.679 29710-5937/com.net.app W/System.err: at com.chronicwatch.app.utils.WebRequest.post(WebRequest.java:72)
10-07 15:51:45.679 29710-5937/com.net.app W/System.err: at com.chronicwatch.app.utils.WebRequest.loadDataFromNetwork(WebRequest.java:54)
10-07 15:51:45.679 29710-5937/com.net.app W/System.err: at com.octo.android.robospice.request.CachedSpiceRequest.loadDataFromNetwork(CachedSpiceRequest.java:48)
10-07 15:51:45.680 29710-5937/com.net.app W/System.err: at com.octo.android.robospice.request.DefaultRequestRunner.processRequest(DefaultRequestRunner.java:150)
10-07 15:51:45.680 29710-5937/com.net.app W/System.err: at com.octo.android.robospice.request.DefaultRequestRunner$1.run(DefaultRequestRunner.java:217)
10-07 15:51:45.680 29710-5937/com.net.app W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
10-07 15:51:45.680 29710-5937/com.net.app W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-07 15:51:45.681 29710-5937/com.net.app W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
10-07 15:51:45.681 29710-5937/com.net.app W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
10-07 15:51:45.681 29710-5937/com.net.app W/System.err: at java.lang.Thread.run(Thread.java:818)
10-07 15:51:45.681 29710-5937/com.net.app W/System.err: Caused by: java.net.ConnectException: failed to connect to /192.168.1.129 (port 8081) after 15000ms: isConnected failed: EHOSTUNREACH (No route to host)
10-07 15:51:45.682 29710-5937/com.net.app W/System.err: at libcore.io.IoBridge.isConnected(IoBridge.java:238)
10-07 15:51:45.682 29710-5937/com.net.app W/System.err: at libcore.io.IoBridge.connectErrno(IoBridge.java:171)
10-07 15:51:45.683 29710-5937/com.net.app W/System.err: at libcore.io.IoBridge.connect(IoBridge.java:122)
10-07 15:51:45.683 29710-5937/com.net.app W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
10-07 15:51:45.683 29710-5937/com.net.app W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:456)
10-07 15:51:45.683 29710-5937/com.net.app W/System.err: at java.net.Socket.connect(Socket.java:882)
10-07 15:51:45.683 29710-5937/com.net.app W/System.err: at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:124)
10-07 15:51:45.683 29710-5937/com.net.app W/System.err: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:149)
10-07 15:51:45.685 29710-5937/com.net.app W/System.err: ... 16 more
10-07 15:51:45.685 29710-5937/com.net.app W/System.err: Caused by: android.system.ErrnoException: isConnected failed: EHOSTUNREACH (No route to host)
10-07 15:51:45.686 29710-5937/com.net.app W/System.err: at libcore.io.IoBridge.isConnected(IoBridge.java:223)
10-07 15:51:45.686 29710-5937/com.net.app W/System.err: ... 23 more
There can be two problems. First the firewall can prevent access. Switch it off for a test. Second: Maybe Tomcat is bound to localhost/127.0.0.1 only. Have a check in its settings.
Fixed,My public IP of my PC is different,Public IP of android phone is different(connected to another wi-fi),But both should be same

can't load images from url with Picasso

i'm using Picasso to download images into a listview in my android app.
it's working like a charm except when running on Kitkat environment.
My layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<ImageView
android:id="#+id/articleimage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="5dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:layout_alignParentTop="true"
/>
</RelativeLayout>
My logs
08-11 06:30:19.406 28898-28898/com.s W/System.err: com.squareup.picasso.Downloader$ResponseException: 404 Not Found
08-11 06:30:19.406 28898-28898/com.s W/System.err: at com.squareup.picasso.UrlConnectionDownloader.load(UrlConnectionDownloader.java:96)
08-11 06:30:19.406 28898-28898/com.s W/System.err: at com.squareup.picasso.NetworkRequestHandler.load(NetworkRequestHandler.java:47)
08-11 06:30:19.406 28898-28898/com.s W/System.err: at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:206)
08-11 06:30:19.406 28898-28898/com.s W/System.err: at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159)
08-11 06:30:19.406 28898-28898/com.s W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
08-11 06:30:19.406 28898-28898/com.s W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-11 06:30:19.406 28898-28898/com.s W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
08-11 06:30:19.406 28898-28898/com.s W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
08-11 06:30:19.406 28898-28898/com.s W/System.err: at java.lang.Thread.run(Thread.java:841)
08-11 06:30:19.406 28898-28898/com.s W/System.err: at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)
my config
compileSdkVersion 23
buildToolsVersion '23.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
using ImageLoader i get an error in downloading the images
http://url/uploads/Vous-êtes-cerveau-droit-ou-cerveau-gauche-300x160.jpg
08-15 10:05:09.042 1915-2474/com.s W/System.err: java.io.FileNotFoundException: http://url/uploads/Vous-êtes-cerveau-droit-ou-cerveau-gauche-300x160.jpg
08-15 10:05:09.042 1915-2474/com.s W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186)
08-15 10:05:09.042 1915-2474/com.s W/System.err: at java.net.URL.openStream(URL.java:470)
08-15 10:05:09.042 1915-2474/com.s W/System.err: at com.s.ArticleActivity$DownloadImageTask.doInBackground(ArticleActivity.java:446)
08-15 10:05:09.042 1915-2474/com.s W/System.err: at com.s.ArticleActivity$DownloadImageTask.doInBackground(ArticleActivity.java:436)
08-15 10:05:09.042 1915-2474/com.s W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:288)
08-15 10:05:09.042 1915-2474/com.s W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-15 10:05:09.042 1915-2474/com.s W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
08-15 10:05:09.042 1915-2474/com.s W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
08-15 10:05:09.042 1915-2474/com.s W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
08-15 10:05:09.042 1915-2474/com.s W/System.err: at java.lang.Thread.run(Thread.java:841)

Android open failed: EACCES (Permission denied) in implementing PDF Reader library

I am implementing this library for PDF reader. I've implemented the code as explained in the link. but when I am running I am getting following exception. here's the logcat:
10:43:56.429 32577-32577/com.example.fahad.testpdfreaderlibrary I/PDFVIEWER: Intent { cmp=com.example.fahad.testpdfreaderlibrary/.TestPDFActivity (has extras) }
11-05 10:43:56.431 32577-32577/com.example.fahad.testpdfreaderlibrary I/PDFVIEWER: ST='file '/storage/emulated/0/pdf.pdf' has 433994 bytes'
11-05 10:43:56.432 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: java.io.FileNotFoundException: /storage/emulated/0/pdf.pdf: open failed: EACCES (Permission denied)
11-05 10:43:56.432 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at libcore.io.IoBridge.open(IoBridge.java:452)
11-05 10:43:56.432 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at java.io.RandomAccessFile.<init>(RandomAccessFile.java:117)
11-05 10:43:56.432 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at net.sf.andpdf.pdfviewer.PdfViewerActivity.openFile(PdfViewerActivity.java:841)
11-05 10:43:56.432 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at net.sf.andpdf.pdfviewer.PdfViewerActivity.parsePDF(PdfViewerActivity.java:815)
11-05 10:43:56.432 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at net.sf.andpdf.pdfviewer.PdfViewerActivity.setContent(PdfViewerActivity.java:221)
11-05 10:43:56.432 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at net.sf.andpdf.pdfviewer.PdfViewerActivity.onCreate(PdfViewerActivity.java:212)
11-05 10:43:56.433 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at android.app.Activity.performCreate(Activity.java:6237)
11-05 10:43:56.433 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
11-05 10:43:56.433 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
11-05 10:43:56.433 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
11-05 10:43:56.433 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at android.app.ActivityThread.-wrap11(ActivityThread.java)
11-05 10:43:56.433 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
11-05 10:43:56.433 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
11-05 10:43:56.433 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at android.os.Looper.loop(Looper.java:148)
11-05 10:43:56.433 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5417)
11-05 10:43:56.434 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at java.lang.reflect.Method.invoke(Native Method)
11-05 10:43:56.434 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-05 10:43:56.434 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-05 10:43:56.434 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
11-05 10:43:56.434 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at libcore.io.Posix.open(Native Method)
11-05 10:43:56.434 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
11-05 10:43:56.434 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: at libcore.io.IoBridge.open(IoBridge.java:438)
11-05 10:43:56.434 32577-32577/com.example.fahad.testpdfreaderlibrary W/System.err: ... 17 more
also I've added in my AndroidManifest.xml following lines:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
but still getting the same exception
Simple solution: set your target SDK back to 22
Clean Solution: Request the Runtime Permissions
Check this out for more informations.

Categories

Resources