jGit fetch error: cannot open git-upload-pack - android

So I'm working with legacy code in an app I'm fixing up. The code uses jGit to pull a repo on startup. During the fetch call, I'm passing in the URL which is something like:
https://thisone#git.hungry.androider.com/myrepo.git
Problem is, when I make the fetch call, I get an error saying:
cannot open git-upload-pack
I noticed a few SO answers say to use a ProxySelector, but I noticed that in the ProxySelector, the select(Uri) call is being passed the following URI:
https://thisone#git.hungry.androider.com/myrepo.git/info/refs?service=git-upload-pack
My question is, where and why is
/info/refs?service=git-upload-pack
being added to my url/uri?
And how can I overcome this error?
Below is the full stack trace:
10-14 10:45:28.469 25237-25462/com.atimi.sportsapp W/System.err: org.eclipse.jgit.api.errors.TransportException: https://fugutest#git.sports.atimi.com/ahl-hershey-bears-qa.git: cannot open git-upload-pack
10-14 10:45:28.481 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
10-14 10:45:28.492 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:261)
10-14 10:45:28.504 25237-25462/com.atimi.sportsapp W/System.err: at com.atimi.caviar.CaviarGitRepo$UpdateRunnable.update(CaviarGitRepo.java:577)
10-14 10:45:28.515 25237-25462/com.atimi.sportsapp W/System.err: at com.atimi.caviar.CaviarGitRepo$UpdateRunnable.run(CaviarGitRepo.java:441)
10-14 10:45:28.526 25237-25462/com.atimi.sportsapp W/System.err: at java.lang.Thread.run(Thread.java:818)
10-14 10:45:28.541 25237-25462/com.atimi.sportsapp W/System.err: Caused by: org.eclipse.jgit.errors.TransportException: https://fugutest#git.sports.atimi.com/ahl-hershey-bears-qa.git: cannot open git-upload-pack
10-14 10:45:28.562 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:524)
10-14 10:45:28.571 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:309)
10-14 10:45:28.580 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
10-14 10:45:28.589 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
10-14 10:45:28.597 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
10-14 10:45:28.606 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
10-14 10:45:28.611 25237-25462/com.atimi.sportsapp W/System.err: ... 4 more
10-14 10:45:28.625 25237-25462/com.atimi.sportsapp W/System.err: Caused by: java.net.UnknownHostException: Unable to resolve host "/ahl-hershey-bears-qa.git/info/refs": No address associated with hostname
10-14 10:45:28.659 25237-25462/com.atimi.sportsapp W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:457)
10-14 10:45:28.668 25237-25462/com.atimi.sportsapp W/System.err: at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
10-14 10:45:28.677 25237-25462/com.atimi.sportsapp W/System.err: at java.net.InetAddress.getAllByName(InetAddress.java:215)
10-14 10:45:28.686 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
10-14 10:45:28.697 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
10-14 10:45:28.706 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
10-14 10:45:28.715 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
10-14 10:45:28.724 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
10-14 10:45:28.735 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:382)
10-14 10:45:28.746 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
10-14 10:45:28.757 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
10-14 10:45:28.769 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
10-14 10:45:28.780 25237-25462/com.atimi.sportsapp W/System.err: at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
10-14 10:45:28.790 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.transport.http.JDKHttpConnection.getResponseCode(JDKHttpConnection.java:98)
10-14 10:45:28.799 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:168)
10-14 10:45:28.808 25237-25462/com.atimi.sportsapp W/System.err: at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:475)
10-14 10:45:28.813 25237-25462/com.atimi.sportsapp W/System.err: ... 9 more
10-14 10:45:28.830 25237-25462/com.atimi.sportsapp W/System.err: Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
10-14 10:45:28.899 25237-25462/com.atimi.sportsapp W/System.err: at libcore.io.Posix.android_getaddrinfo(Native Method)
10-14 10:45:28.909 25237-25462/com.atimi.sportsapp W/System.err: at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
10-14 10:45:28.919 25237-25462/com.atimi.sportsapp W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
10-14 10:45:28.923 25237-25462/com.atimi.sportsapp W/System.err: ... 24 more

Related

Android 5.0 (API 21) UnknownHostException:

I am getting these error logs when the API is called from any device running Android 5 (API 21). Not sure if it's related to the networking library or any legacy issue with Android version 5 and below.
Log:
Before Android 4.1, method android.graphics.PorterDuffColorFilter
androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
2022-10-19 10:23:48.519 4653-4716/com.app E/Mint: NetSender: Transmitting Exception Unable to resolve host "f78bc3d7.api.splkmobile.com": No address associated with hostname
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: java.net.UnknownHostException: Unable to resolve host "f78bc3d7.api.splkmobile.com": No address associated with hostname
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:457)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at java.net.InetAddress.getAllByName(InetAddress.java:215)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:106)
2022-10-19 10:23:48.519 4653-4716/com.app W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:208)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:25)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: at com.splunk.mint.NetSender.sendBlocking(NetSender.java:99)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: at com.splunk.mint.ActionEvent.send(ActionEvent.java:101)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: at com.splunk.mint.Mint$2.run(Mint.java:189)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: at java.lang.Thread.run(Thread.java:818)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: at libcore.io.Posix.android_getaddrinfo(Native Method)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
2022-10-19 10:23:48.520 4653-4716/com.app W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
Some more logs:
java.net.UnknownHostException: Unable to resolve host
"f78bc3d7.api.splkmobile.com": No address associated with hostname
2022-10-20 08:50:16.207 4711-4774/com.ap W/System.err: at
java.net.InetAddress.lookupHostByName(InetAddress.java:457)
2022-10-20 08:50:16.207 4711-4774/com.ap W/System.err: at
java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
2022-10-20 08:50:16.207 4711-4774/com.ap W/System.err: at
java.net.InetAddress.getAllByName(InetAddress.java:215)
2022-10-20 08:50:16.207 4711-4774/com.ap W/System.err: at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
2022-10-20 08:50:16.207 4711-4774/com.ap W/System.err: at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
The log suggests that there is something to do with either Graphics or Network call.
There's no f78bc3d7.api.splkmobile.com host. Probably you've made a typo or were given a wrong address.
% ping f78bc3d7.api.splkmobile.com
ping: cannot resolve f78bc3d7.api.splkmobile.com: Unknown host

Android firebase UNAUTHENTICATED error after user was idle for about an 30 min

I'm building a multi chatrooms app. Inside the chatroom Activity i have few registered listeners (That are added/removed depends if Activity is on running state or not).
The user is always logged in (if didn't requested to log out).
When user is minimizing the app for an about 30 minutes and returns, I register all listeners back but no data is returned and this exception is thrown:
.889 6473-6518/com.dev.dnlgby.connectaround D/FirebaseAuth: Notifying id token listeners about user ( yhKHCsi997gYU9qcCSzGI8NJxU92 ).
2019-08-29 03:22:16.894 6473-6586/com.dev.dnlgby.connectaround W/Firestore: (20.2.0) [FirestoreCallCredentials]: Failed to get token: com.google.firebase.firestore.FirebaseFirestoreException: getToken aborted due to token change.
2019-08-29 03:22:16.909 6473-6473/com.dev.dnlgby.connectaround W/System.err: com.google.firebase.firestore.FirebaseFirestoreException: UNAUTHENTICATED
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.google.firebase.firestore.util.Util.exceptionFromStatus(com.google.firebase:firebase-firestore##20.2.0:121)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.google.firebase.firestore.remote.FirestoreChannel.exceptionFromStatus(com.google.firebase:firebase-firestore##20.2.0:273)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.google.firebase.firestore.remote.FirestoreChannel.access$100(com.google.firebase:firebase-firestore##20.2.0:42)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.google.firebase.firestore.remote.FirestoreChannel$3.onClose(com.google.firebase:firebase-firestore##20.2.0:202)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:700)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:399)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:500)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:65)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:592)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:508)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:632)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run(com.google.firebase:firebase-firestore##20.2.0:205)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at java.lang.Thread.run(Thread.java:764)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: Caused by: io.grpc.StatusException: UNAUTHENTICATED
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at io.grpc.Status.asException(Status.java:541)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.google.firebase.firestore.util.Util.exceptionFromStatus(com.google.firebase:firebase-firestore##20.2.0:119)
2019-08-29 03:22:16.910 6473-6473/com.dev.dnlgby.connectaround W/System.err: ... 25 more
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: Caused by: com.google.firebase.firestore.FirebaseFirestoreException: getToken aborted due to token change
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.google.firebase.firestore.auth.FirebaseAuthCredentialsProvider.lambda$getToken$1(com.google.firebase:firebase-firestore##20.2.0:94)
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.google.firebase.firestore.auth.FirebaseAuthCredentialsProvider$$Lambda$2.then(Unknown Source:4)
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.google.android.gms.tasks.zzd.run(Unknown Source:5)
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at android.os.Handler.handleCallback(Handler.java:873)
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at android.os.Looper.loop(Looper.java:193)
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6718)
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
2019-08-29 03:22:16.911 6473-6473/com.dev.dnlgby.connectaround W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
What could be the reason?
Do I need to refresh tokens somehow?
Thank you.
After updating to firebase auth version to "19.0.0", the problem is solved. Thanks

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.

jcodec Permission Denied for NIOUtils.readableFileChannel

I'm trying to use JCodec to get all the frames from an MP4 on my emulator. I have the following permissions in my manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
The file through my adb shell looks like this:
root#generic_x86_64:/sdcard/Download # pwd
/sdcard/Download
root#generic_x86_64:/sdcard/Download # ls -la
-rwxrwx--x root sdcard_rw 19967250 2015-10-12 16:39 Hummingbird.MP4
I've tried doing a chmod 777 Hummingbird.MP4, but that doesn't change the last set of permissions for some reason?
The following code produces the exception below.
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
String fn = baseDir + "/Download/Hummingbird.MP4";
// test dir to make sure I'm in right place
String dir = baseDir + "/Download";
File fDir = new File(dir);
Log.i("TAG", "fDir.isDir()=" + fDir.isDirectory()); // this is true
fileMp4 = new File(fn);
try {
ch = NIOUtils.readableFileChannel(fileMp4); // line 220 in trace below
} catch (FileNotFoundException e) {
e.printStackTrace();
}
I also did a fileMp4.exists() which returns true.
Exception
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: java.io.FileNotFoundException: /storage/1F1A-300C/Download/Hummingbird.MP4: open failed: EACCES (Permission denied)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at libcore.io.IoBridge.open(IoBridge.java:452)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at java.io.FileInputStream.<init>(FileInputStream.java:76)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at org.jcodec.common.NIOUtils.readableFileChannel(NIOUtils.java:336)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at medloh.com.mp4frames.MainActivity.onActivityResult(MainActivity.java:220)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at android.app.Activity.dispatchActivityResult(Activity.java:6428)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at android.app.ActivityThread.-wrap16(ActivityThread.java)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at android.os.Looper.loop(Looper.java:148)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5417)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at java.lang.reflect.Method.invoke(Native Method)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at libcore.io.Posix.open(Native Method)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: at libcore.io.IoBridge.open(IoBridge.java:438)
10-14 23:32:27.090 4595-4595/medloh.com.mp4frames W/System.err: ... 14 more
See any problems with this code/configuration?
I was able to get the 'NIOUtils.readableFileChannel(fileMp4)' statment working by creating the file at /data/tmp/Hummingbird.MP4 (adb push). Not sure if it's something about /sdcard and its symbolic links, or maybe I just needed to make sure all the directories and file were owned by system instead of root.
Anyway, I'm now on to other issues and problems decoding the MP4 but that's another story.

Categories

Resources