How to create a java package that lives outside the android project - java

My android project is called MyPlaces. I want to create a library (package) with commomTools classes that LIVES outside the MyPlaces directory; however, every time I open MyPlaces project and create a new module, Android Studio creates a directory INSIDE MyPlaces called commontools. I want to create this commonTools directory outside, as it is shown in the screenshot and I prefer it not to be an android project.
I just want to be able to import the classes from the package from different Android Applications.
How can I do that?
Thank you for your help.

Create a new project and and a module which is library.
Then you can use jitpack.io to import it from Gradle.
Good luck
Emre

Related

Is it possible to rename imported library in android studio?

i have imported some libraries to my project in android studio
some libraries i want to rename it as i want.
Forexample
com.google.firebase:firebase-database
i want to change it to com.google.anyname:anothername-database
is it possible to rename it?
also in the head of class rename
import com.google.firebase.database.Database;
change to
import com.google.anyname .myname.databse

Can't import class from jar file although it's visible among IntelliJ External Libraries

Like screenshot shows. I have project party-management that uses common-lending-lib. common-lending-lib then uses math2 library.
When I open common-lending-lib project, it can easily detect math2 dependency and use it.
When I open party-management-project, it can detect common-lending-lib, and math2, but during runtime, it fails on functionality that common-lending-lib takes from math2.
What can be the reason? These projects are in Spring Boot, if it matters at all. I use IntelliJ 2017.1.5 and Java 1.8
Can package name be the reason? I have:
party management in org.kd package
common lending lib in org.kd package
math2 in org.kd.math package
Details of the project can be found on https://github.com/LendingBusiness

How to make package inside master package in Android project using Eclipse?

I read here - How to create new packages in an Android project how to make a package, but I need to make a package inside master package com.example.me.
Every time I try to make new package there, it makes package in src folder, not in com.example.me package.
I mean something like this:
<com.example.me
<package1
<Class1
<package2
if you want to create a package inside the com.example.me , you need to write the new package name as com.example.me.Package1 while adding the New Package

Integrating a Java Class into a PyDev Project (Jython) in Eclipse

I have a Java class that i would like to import into my Jython script. Unfortunately, eclipse won't let me create a Java class inside my Jython project.In the window, where you create and name your Java class, I get a message at the top (alongside a red cross) saying, "Source folder is not a Java project" when I type the name of the would be class. How do I rectify this? I need the Java Class to call C code using the JNI (declaring the native method,loading and then calling it). Thank You !!!!!!!
What you can do is to create second module which would be java project. Anyhow, logically it should be that way. Please check out other similar question - PyDev: Jython modules & Java classes in the same project.
Other links that might help - http://pydev.org/manual_101_project_conf2.html
So what nefo_x suggested is correct. You need to create a new Java project that will contain your Java class. Then import the Java package as you would a python module. But there are a few things to watch out for in eclipse to make it work. I list the whole process below:
Your Java class (or classes) should not be in the default package. You need to create a new package and make/put your java class files there.
Export the package as a jar file to some place on your computer.
Add the jar file (located at some place on your computer) to your python path.
Import the package by writing "import PackageName".
The problem for me was that I had my java class in the default package. That does not work due to some naming issues. Anyhow, hope that this helps.

Issues in Integrating Authorize.net API's for android

I want to integrate my app with Authorize.Net. I have followed the Steps given in tutorial http://developer.authorize.net/integration/fifteenminutes/android/.
my library project anet_android_sdk showing no error. But when I created a new project as in step 3. I am getting error.
import net.authorize.android.AuthNet;
import net.authorize.android.AuthNetActivityBase;
import net.authorize.android.SimpleActivity;
import net.authorize.android.button.AuthNetButton;
Within the anet_android_sdk folder you will find the src folder and within that you will find some packages and classes.Just take the necessary packages and classes like
net.authorize.android.aim,net.authorize.android.arb,net.authorize.android.button,net.authorize.android.cim,net.authorize.android.notification etc. in your project.Maintain them within different packages as in the src folder.
The full source code can be found here:
https://drive.google.com/file/d/0B5tCy5V7jKsdOEdPS3c1VTc2MTA/edit?usp=sharing

Categories