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
Related
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
I want to import project A to eclipse(GGTS),but I already have A which is an old version but of same name. When I use import existing project, it automatically combine two version together but I don't want this happen.
I also use git so I'm not sure what make this happen.
It's a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=40493
But you can try to change the name tag in the .project file in the project before importing it.
I'm trying to import the BigDecimalMath class into my current project. I created a new library by going to Tools -> Libraries -> New Library. I called the library BigDecimalMath, as you can see below. I added a new JAR/Folder and then selected the download from Cornell's website, here. Direct download.
I'm unsure of how to import it into my class now. This library is part of my current project. I've tried import org.nevec.rjm and some other things, but I think I'm doing something wrong. Any advice appreciated. Thanks!
You appear to have a source version of that library. Your window displays a jar containing org.nevec.rjm.BigDecimalMath.java. I think you need to download a binary version of the jar and add that to your class-path. Then you would import that one class with,
import org.nevec.rjm.BigDecimalMath;
or the entire package with,
import org.nevec.rjm.*;
Alternatively, you might be able to build the library from your src jar.
I have a library I want to add to my Android Application. But the problem is that the library is separated into .java files. Now I have tried to add a module to do the job but it does not work. My problem is I do not know how to add a bunch of .java files to my Android project to use throughout my app. I am new to Android dev and I have looked around but cannot find a clear explanation of how to add my type of library to an Android project.
I can see a couple of problems in the screenshot that you just posted above.
1) It seems that you're not telling Gradle (and therefore Android Studio) that you have Java files that need to be compiled. You can fix that by adding this to the build.gradle of the TMDB-Lib module:
sourceSets {
main {
java {
srcDir 'libs'
}
}
}
and then adding the module to your settings.gradle.
2) It seems that the Tmdb classes don't have a package (i.e. their first line isn't a package declaration) so the right way to import them into your Java code is by using just their class name:
import TmdbApi;
instead of:
import TMDB-lib.libs.TmdbApi;
The problem is that the Eclipse compiler do not see any layout or ids, or even strings and values in res folder, though R class is generated well (I've opened it, but of course didn't change enything). So I've tried to Clean and Build project and even restart Eclipse, compare the ids - the problem is still Eclipse don't see anything from res.
What should I do? May be someone solved this yet?
The SDK generates resource classes in the root package of your project. So, if your root package is com.project, and you're trying to use it from some other package (which is or is not directly under the root package), you need to import com.project.R.
i think importing import android.R; you can't see any ids or layouts or strings
change it in import com.companyname.projectname.R;
Get package name from android manifest file.and import like import packageName.R;