Android Unable to access java files in library - java

After a lot of struggle and research I am writing this for help. Being a new in to Android and Java literally spent few days. I am sure I am missing something silly but need insight.
I am using Android studio and have added Zxing QR scanner in to my project. Now I want to edit few methods in the library to do some customisation. I have added the library via Gradle. This is the library I have used https://github.com/dm77/barcodescanner.
I have followed the basic instructions and added the library via gradle. Integration is successful. Now I want to customise the UI. So I got hold of the library here
When I got hold of ViewFindView and tried to edit the method, I wan not able to edit it. Then I realised it is a class and also auto generated. I am supposed to edit the Java files.
The respective java file with all the code in the methods is here
ViewFinderView.java
How do I use it?
Is there a way to get hold of the java files respect to those class files.
How can I edit those files so that I can customise them?
I think all the above questions are kind of same. What do I do?
I am happy to provide more information.
Greatly appreciate your time. Thanks in advance.

I have added the library via Gradle.
That is your problem. In order to add the library to your project you have to import it as a module instead.
Download the repository (either via git clone or download as zip from Github)
Import project as a module in Android Studio (File -> Import Module or File -> New -> Import Module)
Edit source files
You will need to make your changes to the files in the imported module not the ones found in the build directory.

Related

Export GitHub Repository Files to a Usable JAR executable file, issues

I am an enthusiast attempting to play around and add things to an app that I have been using for the past year which the source codes are available in GitHub. Problem is when I clone or download the repository and open it in Eclipse, I get a ton of error codes whenever I try to 'run as' Java app (in particular I am unable to find the 'main class/starting point' there's way too many files to chose from to find it and most don't work) and when I try to extract the files to an executable jar it gives me a JAR exe that is unusable :-(. I know that the files are workable since I do use the executable jar that is available from the developer and others have also toyed around with the source codes.
Can anyone assist me with this? Maybe I am using the wrong Java manipulator/application. The program I am using for opening these files is Eclipse IDE for Java Developers and my operating system is 64bit Windows 10.
Also, here is the GitHub URL for the repository, in case anyone asks: https://github.com/DraqueT/PolyGlot.
I thank anyone who can be of some assistance as I have been working on this forever and can't seem to find a solution.
The github project looks a lot like a utility library than a full application. But the following could help:
Try to study the README file attached to the github project. (There is one in the source code according to the author). This would help you to setup the project.
Make sure to download all the dependencies for that project. Again, the author has provided some of them in the github project (I could see some Apache POI libraries in there somewhere), but getting the required jars on the maven repository isn't that difficult.
It would also help to know what type of project it is. For example, having a main method in a web application doesn't do much for you, but a Java SE project would need a main method to run. So try to find out what kind of project it is.
If all else fails, you could try to contact the owner of the repository or one of its contributors to assist you.
Cheers!

Build and reuse android open source Dialer source code in my project

I have to integrate android opensource Dialer source code into my application and also need to do customizations on the same.
Currently I cloned the Dialer source code from https://android.googlesource.com/platform/packages/apps/Dialer/
It doesn't seems to be a gradle project. How can I build this project ?
I need to add this entire project as reusable module in my project. Could you please help me on this. How can I start with this ?
This Answer seems very informative https://stackoverflow.com/a/8668334/3020568 but I need to get some more help from guys those who tried to build this type of applications.
WE tried below steps.
Checked out source code from google source.
Tried to import the project in Android Studio.
It has dependencies outside the project which are not able to resolve. - Some classes and methods has no reference inside the source code.
Thanks in advance.
I know this is old but this is for future reference.
You cannot build the Dialer application without access to the rest of the source code. You need to first download the whole Android source (AOSP) and then build it because the Dialer application that comes with AOSP requires some framework files which is included in AOSP; hence the Dialer code may not actually work on all devices. Your best bet is using a tutorial to build a dialer application from scratch.

How to create libGdx based library

I want to create my own library which will use libgdx framework. As a result I want to get jar of my library which can be added to any other project which also uses libgdx.
The problem is that I can't find any tutorial how to do it. I can create normal libgdx project, but how I can get jar library from it? Maybe I need to create gradle based project and compile libgdx dependencies?
If somebody has experience in creating libgdx based libraries or extensions, please share your experience.
Question is a little old but for others that may stumble here; This is the best solution I've found for creating/using your own library project in another LibGDX project. Though I believe the HTML project requires further steps that I haven't investigated.
Using eclipse:
File->Export->Java->JAR File->Export Generated Class Files and Resources
AFAIK You can tell it not to package required libraries with the JAR.

Add Google Translate API in eclipse

I want to make a simple program using google translate API. I have an account and key already,but I am having trouble with the imports.
import com.google.api.GoogleAPI;
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
They cannot be resolved. I am trying to follow these instructions:
https://code.google.com/p/google-api-java-client/wiki/Setup#google-api-client
but after extracting the google-api-java-client-1.17.0-rc.zip file and trying to add only the jar files I need, I cannot find the following:
jackson-core-asl-1.9.4.jar
protobuf-java-2.2.0.jar
xpp3-1.1.4c.jar
I have tried adding the entire google-api-services-translate-v2-rev27-1.17.0-rc-sources.jar file with maven and manually without maven. It shows up under referenced libraries and in the build configuration, but still does not achieve anything. I do not know if I am missing something important. I want to use it in a simple application, not having to do with android or google app engine. Please help! Thank you so much in advance!
You have to download this: http://google-api-java-client.googlecode.com/files/google-api-java-client-1.17.0-rc.zip
It contains the required libraries.

Beginner Java Developer Netbeans/Eclipse IDE Questions

Im working on building a java application in windows vista using the Emotiv Epoc Neuroheadset, http://emotiv.com/index.php.
I'm new to java and having a really tough time getting started. I have some examples that came with the headset I'm trying to run in either eclipse or netbeans (at this point I really don't have a preference, suggestions?)
The user manual gives these directions:
*2. Package content: Jna.rar, Edk.java, EmoState.java, EDkErrorCode.java
Example 1: EEGLog
Example 2: EmoStateLog
Developer‘s guide: Step 1: Add the JNA library to your project. Step 2: Add Edk.java, EmoState.java, EdkErrorCode.java to your project. The classes in these files contain methods calling the APIs from Edk.dll using JNA library. You can find more information about the conversion between data types on the JNA's homepage.*
This is all Chinese to me! Can someone explain to me exactly how to do these steps (in a way a small child who have never used eclipse or netbeans before can understand!) Somebody from the Emotiv Epoc forum gave me these directions as well:
*To see how to Java wrapper examples work you should install Eclipse and open, compile them. You put edk_utils.dll and edk.dll into System32 or the same root directory of each example as EmoStateLog, CognitivExample,... before running them.*
My problem is I dont know enough about the IDEs to run these examples. Am I supposed to make a new project then add these files? Or do I open one of the examples, then add the .dll files and the JNA library? How do you add libraries to a project? Where do I put the .dll files?
Thanks in advance!
I know this is fairly simple stuff but its always the simple stuff thats hardest to figure out it seems!
-Eric
Based purely off of what you're saying here...
Developer‘s guide: Step 1: Add the JNA library to your project. Step 2: Add Edk.java, EmoState.java, EdkErrorCode.java to your project. The classes in these files contain methods calling the APIs from Edk.dll using JNA library. You can find more information about the conversion between data types on the JNA's homepage.*
Create a new project in Eclipse.
Add Edk.java, Emostate.java, EdkErrorCode.java into the src folder
Add the JNA library into the libs folder. (Make sure the library is in the project path, otherwise Eclipse won't detect it.)
Whether or not it will compile depends on if those are the only supporting files.

Categories

Resources