So the app I'm building has to use a specific library. Unfortunately this library uses bouncycastle in it. As is known this will not work with Android. Are there any ways to get around this? I was suggested to build a service layer to interact with the library SDK but I have no idea where to begin or what that really is.
If the library comes in a packed .jar file you can import it to your Android project by right clicking on the project > Properties > Java Build Path > Libraries tab and pressing the Add external JAR button
This is valid for Eclipse, there way to do it on Android Studio might be different.
This post may also solve your issue: BouncyCastle on Android
I ended up finding and modifying the source code of the SDK to implement spongycastle
Related
I just add external jar(android support.v4.jar) to my project using eclipse IDE.
But it show empty packages.Can anyone guide me how to solve this.?
External jar show empty packages:
I just add external jar(android support.v4.jar) to my project using eclipse IDE.
Not quite. You added support-v4-23.1.1-sources.jar. The key part of that filename, with respect to your problem, is sources. This JAR contains Java source code, not compiled Java classes.
Can anyone guide me how to solve this.?
Google is no longer supporting Eclipse. There is no official distribution of any of the support libraries as simple JARs, or even Eclipse-style library projects.
The simple solution is to move to Android Studio, or possibly IntelliJ IDEA, instead of using Eclipse.
I am trying to build a library which will be having some activities of it's own that will be included as a part of another Host App.
I want to integrate Facebook SDK inside this library for sharing some content. When I try to include the FB SDK as a library project and then include the library into the host app, I get the
Dalvik cache with error 1 error
while compiling the Host project.
Am I doing something wrong here?
It's hard to tell what the issue is without more information, but working with the FacebookSDK, I know I've had a similar issue.
Make sure that the support libraries, android-support-v4.jar, or whatever you're using, isn't in both your project and the FacebookSDK project. If you have to pick one or the other, put the .jar in the FacebookSDK so both projects can reference it.
Other than that, if you're using eclipse, make sure you clean 17 times, and restart eclipse a few times too. ;)
I am trying to get the OpenCV library working with android. I imported this library project into eclipse and made a new android project (the one I will develop) and just. I set the build path to include the OpenCV project in eclipse. However, when I run my new project, it says
[2014-10-13 19:41:57 - OpenCV Library - 2.4.10] Could not find OpenCV Library - 2.4.10.apk!
From what I understand, my new project should automatically pull in the library project and install it. I am wondering if I am missing any steps (because it doesn't seem to be pulling in the project)? Does it have to be the same target sdk? I am quite sure I followed all of the OpenCV installation guide and have no compile errors in the projects. Also if I load up the sample projects by directly installing the apks they seem to work fine. I even tried it with the OpenCV Manager app already installed but that didn't work either. Thanks for any help.
Just add the OpenCV library project as shown below, the problem will go.
Project -> Properties -> Android
and press OK.
You should check "Library" build option in Eclipse for OpenCV android project.(Not your project)
Clean your OpenCV library,build it again and check in OpenCv library->bin->opencv library -X.X.XX.jar if there is a file (X==> VERSION)(see picture).See this for .jar file. If this file does not exist then your library is not generated then check the video it might help This should help if your library is not built.
My personal experience:I wasn't able to generate the jar file for some reasons using OpenCv2.4.10 .If the same happens to you consider using OPENCVTEGRA library it works at least for me.
Answering 1st time. Hope this helps
I am new in android. I see a lot of android libraries out there like github.com but when I download them none of them are a *.jar file like this one:
NumberProgressBar
It seems that all these libraries are for android studio NOT eclipse (Am I correct? This is important).
My question is: How do I use these libraries in eclipse?
I tried to import the downloaded library as an android project and then mark it as "is library" and then add to my project, but that did not work.
That library is designed to be built with Gradle for Android (with or without Android Studio), producing an AAR.
Eclipse does not have native AAR support. I have published a recipe and a Ruby script to convert an AAR into a library project that Eclipse can use, though I have not tested it much.
Or, you can download the source code and attempt to reorganize it into an Eclipse-style library project.
I just downloaded it and add it as library project and everything looks fine. How do you do it, it's extremely simple. Let us know in which step you have a problem so we can figure out what is wrong.
You have to build the library first.
For your example, read the Readme file, section 'Build'.
I'm just getting started in Android development, and use Netbeans with NBAndroid and SDK 17.
I'd like to use the same Java source code in my Java and Android app.
http://developer.android.com/guide/developing/projects/projects-eclipse.html says how to do it in Eclipse (although it is sketchy on the .JAR connection thing), but I can't seem to make it work in NB.
Based on that link, My understanding is that the correct setup for the Android app is an Android Application project which references an Android Library project which in turn references a .JAR library produced by a Java Library project. I could then also have a Java Application project referring to the same Java Library project.
So, I've set up this project structure... I have an AndroidApp project which is a basic HelloAndroid Activity in a com.ex package. This project includes an AndroidLib library project in the Libraries folder. I also have a LibClass.java file which defines a simple LibClass class which has one function getText() that just returns a String to be displayed. The MainActivity in the AndroidApp calls this to get the String to output.
When I put LibClass.java directly into the AndroidLib project, everything is fine.
But what I want to do is to share the source code with Java.
So I want to move the LibClass.java into the JavaLib library, whose .JAR file is included in the AndroidLib project. However, when I tried that, I get an error in the MainActivity class, complaining it can't find LibClass. Looking at the Projects window, I can see LibClass.class inside the com.ex package in the JavaLib.jar in the Libraries folder of the AndroidLib project. And AndroidLib is visible in the Libraries folder of the AndroidApp project, but it doesn't show any packages or other contents there.
So I feel like I'm just one step away from making this work. Do I need to do something with one or other of the AndroidManifest files perhaps? Or do something with the build.xml files? Or am I on the wrong track altogether?
I'd be really grateful if someone could post a how-to for this.
I'm trying something similar; I've got Java EE projects, built using Eclipse, and I'm trying to utilize some of that code from my Android projects. This should give me a shared codebase rather than a bunch of confusing SVN externals which I've had to endure before.
Rather than creating JAR files I've found that working with the source and building for the platform works best (well, it has been working but I've got a problem with it at the moment). So, what I'm doing is:
c:\MySvnFolderStructure\MyJavaProjectFolder\src\ (and then all the source under that)
c:\MySvnFolderStructure\MyJavaProjectFolder\android\ (and all the Eclipse Android project gubbins)
c:\MySvnFolderStructure\MyJavaProjectFolder\jee\ (and all the Eclipse JEE project gubbins)
The Android and Java EE projects do not have their own src folders, they both link to the src folder in their parent folder. What this means is that each of the Java implementations is building its own byte code version from the source, and using its own external libraries (like the Apache HTTP ones, for example).
Naturally they can't share stuff like awt (as mentioned in another post), but there's plenty of stuff that does cross-over especially if it's core Java classes that are being used.
Also, it's proving a bit tricky writing JUnit tests as there needs to be some duplication of the test code at the moment because the Android ones need extra instrumentation, but I'm working on it.
Also, see this post about relative paths in Eclipse, which means the folders can be checked-out to different places on different machines (like we all do with our version control check-outs) and still be shared.
if I understand your situation correct, you are trying to use a custom java library for both your android and java applications.
For this scenario, you can build the java library first. Instead of adding the java library jar as android library, you can drop the jar directly inside the libs folder of android project and add it to android project's build path.
If you are using ANT scripts for building the java library jar , you can consider adding the source files also as part of jar. This will help you get code assistance when you develop the android part. But this part is purely optional.
The problem is that the Java platform in Android is different from the JDK platform.
In particular, the .JAR library CANNOT refer to anything that is not icluded in the Android platform. An example of things you can't refer to is java.awt.* (except you can have java.awt.fonts).
There is also a difference between JDK String and Android String -- Android does not implement the isEmpty() method.