Failed resolution of: Ljavax/imageio/stream/FileImageInputStream when using Java library - java

I'm trying to make an app which creates a DICOM file. There is a java library called PixelMed. I tried to use it in my Android project but when accessing methods from the library I get
Failed resolution of: Ljavax/imageio/stream/FileImageInputStream
From what I found I get this because javax is not a part of Android SDK. My question is: Is there a way to somehow import this library or make the PixelMed work on Android?
Thanks in advance.

Related

CameraX and barcodes scanning in java

I'm trying to use CameraX and MlKit to read barcodes but I get the following error when I try to build my app :
Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Does anyone know where this problem could come from and how to solve it?
And could anyone tell me where I could find a comprehensive CameraX doc using Java and not Kotlin?
Check out this site for the java coding of camerax:
https://learntodroid.com/how-to-create-a-qr-code-scanner-app-in-android/.
I use ML-Kit instead of zxing and it works well.

How to combine a standalone application with an Android application?

How do I combine a standalone Java application with an Android application?
I have a piece of code taken from the Google quick start examples that perform a task that I can't seem to be able to combine with my activity source code.
I'm of course talking about the following Google example: Sheet API, if I just add it as a standalone class and tell Android Studio to run this application, before my Android application, then it will produce what the code is suppose to do.
If I try to copy and paste the exact code into one of my activities it will give a couple of problems. One is that it can not find my keystore, another is a threading issue which I understand, another being that it can not find the credentials (even if the file is present), the newTrustedTransport-method call will be an issue, the setDataStoreFactory-method call will be an issue, file creation even with the correct uses-permissions and so on.
What is going on in the background that would make exactly the same source code work in one instance and not the other? What do I not know about Android Studio, and how an Android project works in the background for me having these issues?
I had an idea that I could just keep this standalone application as it is and store a file with the result that this Sheet example would provide me. But, since I do not have enough experience with Android Studio I have no idea if the result will be available for the actual Android application once it was made into a release. Will it? I can't save the output file generated by the Sheet example, under the res-folder, under the app module for some reason (scope?).
With other words... Can I have a standalone application, that is tasked to run before the Android application, to gather data and it will be doing this EACH time the Android application is run on a client? I feel like it would be stupid if the IDE would present this like this would actually work but then when the application is made into a release then the standalone application will not "follow" and be part of the release...
If I could just combine the source codes, I will not be having this issue at all. No examples online, neither Github or Youtube can provide me with answers on how to do this. Many examples online provide me with source code that is either out of date or just not what I'm looking for, and I really hate Google's way of explaining things. Just look at how they give code examples under this page: Google API Client Library for Java, and not give a full example where they would fit into the a project. Maybe all I need to make everything work is to use the code under "The library runs on Android 4.0 or higher (#Beta)."

NativeScript : Adding native android project to nativescript

i have a question on how to add existing native android project to Nativescript/typescript project.
I have a source code for native android and try to use/call their java classses (eg: MainActivity.java) as an intent in my nativesript project.
I already read a documentation on [Extending the native application][1]
[1]: https://docs.nativescript.org/guides/integration-with-existing-ios-and-android-apps/extend-existing-android-app but its only explain how to add nativescript to existing android-app and not vice versa.
I try to google it but can't find a solution.
I need a guide on where to copy to source code and to which folder and how to call it as an intent. Do i need to change the AndroidManifest.xml and add the class as an activity (Activity tag) or application (Application tag).
If you have a link/documentation which i can refer to, hope you mind to share.
Your help is very much appreciated.
Sorry, i'm quite noob in nativescript.
Thanks in advance
You may convert your native project as an AAR library, copy that to your App_Resources/Android/lib then you should be able to access everything in it.
Here are docs that explains how you can access the native Java apis from JavaScript / TypeScript.

Create shapefile on Appengine preferably on Java

Hi i would like to create a shapefile(.shp .shx .prj .dbf) based on a KML file on appengine. My project is on java.
I tried to use geotools, and was able to create .shp .shx .prj on Appengine (with some changes on geotools to save on Google Cloud) but was not able to create a .dbf with it. Geotools depends on AWT for creating the dbf, and Appengine restricts AWT.
Any sugestion on this? I´m starting even to consider calling a python module or something(never did anything like this). Or even creating just a dbf from a kml.
Thanks
Edit 1:
When i call ShapefileDatastore.createSchema() i have to pass a SimpleFeatureType as argument.
When i try to create a SimpleFeatureType or even use a BasicFeatureTypes.POLYGON it gave me error:
Caused by:
java.lang.NoClassDefFoundError: java.awt.RenderingHints is a restricted class.
Please see the Google App Engine developer's guide for more details.
at java.awt.RenderingHints.<clinit>(RenderingHints.java)
at org.geotools.factory.FactoryFinder.<clinit>(FactoryFinder.java:35)
at org.geotools.data.store.ContentDataStore.<init>(ContentDataStore.java:173)
at org.geotools.data.shapefile.ShapefileDataStore.<init>
(ShapefileDataStore.java:124)
at org.geotools.data.shapefile.ShapefileDataStoreAppengine.<init>
(ShapefileDataStoreAppengine.java:74)
at brandeira.morholt.web.shared.util.ShapefileHelper.createShapefile(ShapefileHelpe
r.java:121)
I twisted a bit replacing RenderingHints by a non awt RenderingHints and them got another error:
Caused by:
java.lang.NoClassDefFoundError: javax.imageio.spi.ServiceRegistry is a
restricted class. Please see the Google App Engine developer's guide for more details.
at javax.imageio.spi.ServiceRegistry.<clinit>(ServiceRegistry.java)
at
org.geotools.factory.CommonFactoryFinder.getServiceRegistry(CommonFactoryFinder.java:76)
at org.geotools.factory.CommonFactoryFinder.lookup(CommonFactoryFinder.java:346)
at org.geotools.factory.CommonFactoryFinder.getFilterFactory(CommonFactoryFinder.java:300)
at org.geotools.feature.AttributeTypeBuilder.<init>(AttributeTypeBuilder.java:192)
at org.geotools.feature.simple.SimpleFeatureTypeBuilder.<init>(SimpleFeatureTypeBuilder.java:196)
at org.geotools.feature.simple.SimpleFeatureTypeBuilder.<init>(SimpleFeatureTypeBuilder.java:186)
at org.geotools.feature.type.BasicFeatureTypes.<clinit>(BasicFeatureTypes.java:101)
at brandeira.morholt.web.shared.util.ShapefileHelper.createShapefile2(ShapefileHelper.java:290)
It seems to use a lot of this factory methods of AWT (graphics is not the problem here in this case, just the use of AWT things).
I replaced that also and got:
Caused by:
java.lang.NoSuchMethodError:
org.geotools.factory.FactoryRegistry.getServiceProvider(Ljava/lang/Class;Lcom/google/apphosting/runtime/security/shared/stub/javax/imageio/spi/ServiceRegistry$Filter;Lorg/geotools/factory/Hints;Lorg/geotools/factory/Hints$Key;)Ljava/lang/Object;
at org.geotools.factory.CommonFactoryFinder.lookup(CommonFactoryFinder.java:346)
at org.geotools.factory.CommonFactoryFinder.getFilterFactory(CommonFactoryFinder.java:300)
at org.geotools.feature.AttributeTypeBuilder.<init>(AttributeTypeBuilder.java:192)
at org.geotools.feature.simple.SimpleFeatureTypeBuilder.<init>(SimpleFeatureTypeBuilder.java:196)
at org.geotools.feature.simple.SimpleFeatureTypeBuilder.<init>(SimpleFeatureTypeBuilder.java:186)
at org.geotools.feature.type.BasicFeatureTypes.<clinit>(BasicFeatureTypes.java:101)
at brandeira.morholt.web.shared.util.ShapefileHelper.createShapefile2(ShapefileHelper.java:290)
I could not yet find where this javax.imageio.spi.ServiceRegistry (i have replaced all i found) is coming from and am thinking that i twisted this a lot and it doesn´t seem to be the way..

R.java file isn't being generated if I add the Facebook SDK to my app (that uses Parse)

I am working on an android project and wanted to integrate FB into it.
Using the FB SDK tutorial, I imported the FB SDK into my workspace along with a sample project. The sample project seems to have no problem with the FB library. But when I try to go to stick the library into my app, my app refuses to generate R.java. If I remove it, the R.java gets generated again.
I did a lot of googling and tried the common tricks like cleaning my project, checking for XML errors, etc.
I am now thinking it might be a problem with having both Facebook and Parse. Parse used to have Facebook SDK integrated, but they changed that recently and they now want you to import the Facebook SDK. I tried both not updating and updating Parse, but either way still not generating R.java.
I have set it so my min SDK is level 8 and the max is level 17. I tried raising and lowering the max, but it made no difference.
I have been working on this for the whole day but cannot figure out what is going on. Anyone having similar issues or have insight into the problem, I would very much appreciate feedback.
Edit: I do get this on the console: WARNING: unable to write jarlist cache file /Users/.../facebook-android-sdk-3.6.0/facebook/bin/jarlist.cache
Edit 2: I think I figured out the reason: http://www.reddit.com/r/androiddev/comments/1xajcp/too_many_methods_for_dalvik_help/

Categories