can't load images from url with Picasso - android

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)

Related

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!

Picasso failed to load images in android kitkat

I'm using Picasso to download images I get from a web service that I display in a listview.
It works fine on devices running above kitkat 5+.
In kitkat it fails to load some images.
My config is set like below
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
defaultConfig {
applicationId ""
minSdkVersion 17
targetSdkVersion 24
}
}
dependencies {
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
}
I'm calling Picasso in my listAdapter
Picasso.with(main)
.load(main.articles.get(position).image)
.into(holder.image);
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"
android:background="#fff"
>
<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"
/>
<TextView
android:id="#+id/categoryname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:textSize="26dp"
android:layout_below="#id/articleimage"
android:layout_alignParentStart="true"
android:layout_marginTop="280dp"
android:layout_alignParentTop="true"
android:textColor="#ff48b0"
android:background="#FFFFFF"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textStyle="bold"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/title"
android:gravity="center_vertical"
android:paddingStart="10dp"
android:paddingBottom="5dp"
android:clickable="false"
android:textColor="#3D3838"
android:textStyle="bold"
android:textSize="33dp"
android:focusable="false"
android:layout_below="#id/articleimage"
android:layout_marginTop="8dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="122dp"
android:id="#+id/excerpt"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textSize="26dp"
android:lineSpacingExtra="8dp"
android:textColor="#4c4d4e"
android:layout_below="#id/title"
/>
</RelativeLayout>
my logs
Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
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)
"Picasso-/wp-content/uploads/Vous-consommez-chaque-jour-cet-aliment-qui-endommage-votre-cerveau-et-votre-foie.jpg" prio=5 tid=613 RUNNABLE
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: | group="main" sCount=0 dsCount=0 obj=0xb20862a8 self=0xb98f6fd0
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: | sysTid=18174 nice=10 sched=3/0 cgrp=[fopen-error:2] handle=-1186417376
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: | state=R schedstat=( 0 0 0 ) utm=2 stm=1 core=0
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:613)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:589)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at com.squareup.picasso.BitmapHunter.decodeStream(BitmapHunter.java:142)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:217)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at java.lang.Thread.run(Thread.java:841)
08-11 06:52:44.326 28898-18174/com.s I/dalvikvm: at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)
08-11 06:52:44.346 28898-18174/com.s D/skia: --- decoder->decode returned false
08-11 06:52:44.366 28898-28898/com.s W/System.err: java.lang.RuntimeException: ===============BEGIN PICASSO STATS ===============
08-11 06:52:44.366 28898-28898/com.s W/System.err: Memory Cache Stats
08-11 06:52:44.366 28898-28898/com.ss W/System.err: Max Cache Size: 9586980
08-11 06:52:44.366 28898-28898/com.s W/System.err: Cache Size: 0
08-11 06:52:44.366 28898-28898/com.s W/System.err: Cache % Full: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Cache Hits: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Cache Misses: 1
08-11 06:52:44.376 28898-28898/com.s W/System.err: Network Stats
08-11 06:52:44.376 28898-28898/com.s W/System.err: Download Count: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Total Download Size: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Average Download Size: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Bitmap Stats
08-11 06:52:44.376 28898-28898/com.s W/System.err: Total Bitmaps Decoded: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Total Bitmap Size: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Total Transformed Bitmaps: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Total Transformed Bitmap Size: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Average Bitmap Size: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: Average Transformed Bitmap Size: 0
08-11 06:52:44.376 28898-28898/com.s W/System.err: ===============END PICASSO STATS ===============
08-11 06:52:44.376 28898-28898/com.s W/System.err: at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:180)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at java.lang.Thread.run(Thread.java:841)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)
08-11 06:52:44.376 28898-28898/com.s W/System.err: Caused by: java.lang.OutOfMemoryError
08-11 06:52:44.376 28898-28898/com.s W/System.err: at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:613)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:589)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at com.squareup.picasso.BitmapHunter.decodeStream(BitmapHunter.java:142)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:217)
08-11 06:52:44.376 28898-28898/com.s W/System.err: at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159)
08-11 06:52:44.376 28898-28898/com.s W/System.err: ... 6 more
Try this and print exception
Picasso.Builder builder = new Picasso.Builder(this);
builder.listener(new Picasso.Listener()
{
#Override
public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception)
{
exception.printStackTrace();
}
});
builder.build().load(URL).into(imageView);

GcmPubSub subscribe Invalid appInstanceToken:

i'm recently tried new TOPICs API of Google Cloud Messaging Service. but i always got the error Invalid appInstanceToken:
here is the logcat
java.lang.IllegalArgumentException: Invalid appInstanceToken:
11-10 22:28:34.674 15742-15983/com.SimDetail W/System.err: at com.google.android.gms.gcm.GcmPubSub.subscribe(Unknown Source)
11-10 22:28:34.674 15742-15983/com.SimDetail W/System.err: at com.SimDetail.MainActivity$3.doInBackground(MainActivity.java:265)
11-10 22:28:34.674 15742-15983/com.SimDetail W/System.err: at com.SimDetail.MainActivity$3.doInBackground(MainActivity.java:255)
11-10 22:28:34.674 15742-15983/com.SimDetail W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:292)
11-10 22:28:34.674 15742-15983/com.SimDetail W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-10 22:28:34.674 15742-15983/com.SimDetail W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
11-10 22:28:34.674 15742-15983/com.SimDetail W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
11-10 22:28:34.674 15742-15983/com.SimDetail W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
11-10 22:28:34.674 15742-15983/com.SimDetail W/System.err: at java.lang.Thread.run(Thread.java:818)
can anyone tell me what i'm doing wrong?
Thanks.
Solved. :)
The GCM Token should be obtain vie new
InstanceID API.
otherwise it throws invalid instance token.
it is not valid with `
GCM.register()
although it receives PUSH but can not subscribe.

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.

jGit fetch error: cannot open git-upload-pack

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

Categories

Resources