I am facing a problem in Samsung Galaxy J5 device
it always gives me an error can't save image when try to take image from camera, also when try to load image from URI I got an exception
Here is example of the URII That I am trying to open
file:///storage/emulated/0/DCIM/Tango/image.jpg
and here is the exception that I got
E/MediaStore: Failed to insert image
java.io.FileNotFoundException: No such file or directory
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)
at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:620)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:943)
at android.content.ContentResolver.openOutputStream(ContentResolver.java:690)
at android.content.ContentResolver.openOutputStream(ContentResolver.java:666)
at android.provider.MediaStore$Images$Media.insertImage(MediaStore.java:961)
at com.forsale.forsale.controller.manager.ForSaleServerManager.getImageUri(ForSaleServerManager.java:3641)
at com.forsale.forsale.controller.manager.ForSaleServerManager.getFileObject(ForSaleServerManager.java:3627)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2514)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2492)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
java.lang.NullPointerException: uriString
at android.net.Uri$StringUri.<init>(Uri.java:471)
at android.net.Uri$StringUri.<init>(Uri.java:461)
at android.net.Uri.parse(Uri.java:433)
at com.forsale.forsale.controller.manager.ForSaleServerManager.getImageUri(ForSaleServerManager.java:3642)
at com.forsale.forsale.controller.manager.ForSaleServerManager.getFileObject(ForSaleServerManager.java:3627)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2514)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2492)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getName()' on a null object reference
at com.forsale.forsale.controller.manager.MultipartUtility.addFilePart(MultipartUtility.java:54)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2515)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2492)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
You must check your path first. and if it is correct then look for the image naming as 'image.jpg'. this might solve the problem.
Related
I made a mistake after proguard the code, please help me.
This is my error:
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at b.b.c.o.run(ScheduledAction.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IncompatibleClassChangeError: Expected 'long b.b.a.b.am.a' to be a static field rather than a instance field (declaration of 'b.b.a.b.ae' appears in /data/app/com.cfdaic.app-1/base.apk)
at b.b.a.b.ae.a(SpscArrayQueue.java:177)
at b.b.a.b.ae.offer(SpscArrayQueue.java:119)
at b.b.d.qs.c(OperatorObserveOn.java:159)
at b.b.d.mt.b(OnSubscribeTimerOnce.java:49)
at b.b.c.ag.b(EventLoopsScheduler.java:189)
at b.b.c.o.run(ScheduledAction.java:55)
... 7 more
I am using the docx4j android code from this link.
https://github.com/plutext/AndroidDocxToHtml/tree/master/libs
I am getting this error. Anyone has idea , i am not able to figure it out.
java.lang.RuntimeException:
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.Error:
at ae.com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.init(RuntimeBuiltinLeafInfoImpl.java:906)
at ae.com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(RuntimeBuiltinLeafInfoImpl.java:900)
at ae.com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:65)
at ae.com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:134)
at ae.com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:86)
at ae.com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:156)
at ae.com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:94)
at ae.com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:451)
at ae.com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:299)
at ae.com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:142)
at ae.com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1164)
at ae.com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:146)
at ae.com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:237)
at java.lang.reflect.Method.invoke(Native Method:0)
at java.lang.reflect.Method.invoke(Method.java:372)
at ae.javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186)
at ae.javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:146)
at ae.javax.xml.bind.ContextFinder.find(ContextFinder.java:348)
at ae.javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:446)
at ae.javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:409)
at org.docx4j.jaxb.NamespacePrefixMapperUtils.getPrefixMapper(NamespacePrefixMapperUtils.java:47)
at org.docx4j.jaxb.Context.<clinit>(Context.java:67)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:651)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
My app has started crashing during the google sign in process.
It wasn't crashing like this before.
Could it be connected to changing the Google Play services version?
What else could cause this crash?
I was able to stop it before by delaying when I implement my OneSignal initialization in the Application class. But, I am not sure how they are connected and have only come across the connection because of trial and error. Changing my OneSignal implementation doesn't seem like a proper solution as it sidesteps a problem that wasn't occurring before and may occur again if I don't find a more specific cause for it.
Also, the crash doesn't always occur during the sign in process.
The main clues from the logcat seem to be:
An error occurred while executing doInBackground()
Caused by: java.util.ConcurrentModificationException
at com.google.android.gms.auth.api.signin.internal.zzb.zzafx(Unknown Source)
at com.google.android.gms.auth.api.signin.internal.zzb.loadInBackground(Unknown Source)
Here is the full logcat:
UncaughtException: java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:142)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.util.ConcurrentModificationException
at java.util.WeakHashMap$HashIterator.next(WeakHashMap.java:165)
at com.google.android.gms.auth.api.signin.internal.zzb.zzafx(Unknown Source)
at com.google.android.gms.auth.api.signin.internal.zzb.loadInBackground(Unknown Source)
at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:296)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:54)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:42)
at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:128)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818) `11-11 00:35:53.023 11247-11903/com.example.package E/AndroidRuntime: FATAL EXCEPTION: ModernAsyncTask #1
Process: com.example.package, PID: 11247
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:142)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.util.ConcurrentModificationException
at java.util.WeakHashMap$HashIterator.next(WeakHashMap.java:165)
at com.google.android.gms.auth.api.signin.internal.zzb.zzafx(Unknown Source)
at com.google.android.gms.auth.api.signin.internal.zzb.loadInBackground(Unknown Source)
at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:296)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:54)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:42)
at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:128)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
` at java.lang.Thread.run(Thread.java:818)
Thanks in advance.
I have got error in android version 4
E/ExcelSheet: null
org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:456)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:162)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:271)
at com.example.vinove.excelsheetapp.Poi.ExcelSheet.readExcelSheet(ExcelSheet.java:63)
at com.example.vinove.excelsheetapp.Activities.MainActivity$MyTask.doInBackground(MainActivity.java:137)
at com.example.vinove.excelsheetapp.Activities.MainActivity$MyTask.doInBackground(MainActivity.java:107)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:456)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:162)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:271)
at com.example.vinove.excelsheetapp.Poi.ExcelSheet.readExcelSheet(ExcelSheet.java:63)
at com.example.vinove.excelsheetapp.Activities.MainActivity$MyTask.doInBackground(MainActivity.java:137)
at com.example.vinove.excelsheetapp.Activities.MainActivity$MyTask.doInBackground(MainActivity.java:107)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.NoClassDefFoundError: org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument$Factory
at org.apache.poi.xssf.model.ThemesTable.<init>(ThemesTable.java:46)
at java.lang.reflect.Constructor.constructNative(Native Method)
Apache POI will not work out of the box on Android, there are various problems that you will run into.
There are some projects that make it possible to use parts of Apache POI on Android:
https://github.com/andruhon/android5xlsx (for Android 5) and https://github.com/andruhon/AndroidReadXLSX (for Android 4) which is based on Apache POI 3.12
https://github.com/centic9/poi-on-android/ (for Android 5, maintained by me), which can be used with any version of POI, e.g. 3.15 currently
I have a news app that gets its content via JSON and at times it parses very large strings. I have an object that holds all the article's data which is then saved to a database.
However, at times, I get an out of memory exception with the object class. The following is the logcat:
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:137)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 230 byte allocation with 96 free bytes and 96B until OOM
at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:163)
at java.lang.StringBuilder.append(StringBuilder.java:288)
at com.android.internal.os.LoggingPrintStream.append(LoggingPrintStream.java:333)
at com.android.internal.os.LoggingPrintStream.append(LoggingPrintStream.java:36)
at java.lang.Throwable.printStackTrace(Throwable.java:315)
at java.lang.Throwable.printStackTrace(Throwable.java:282)
at java.lang.Throwable.printStackTrace(Throwable.java:236)
at com.radioafrica.mpasho.object.Article.(Article.java:31)
at com.radioafrica.mpasho.loader.FeedsLoader.loadInBackground(FeedsLoader.java:50)
at com.radioafrica.mpasho.loader.FeedsLoader.loadInBackground(FeedsLoader.java:24)
at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:242)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40)
at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
The error occurs when i try to load the data via an asynctaskloader before passing the data to the adapter.