Error while importing library in android studio - java

i'm using android studio to make a chatbot but i get error while importing alice libraries " Can't resolve alicebot"
import org.alicebot.ab.Bot;
import org.alicebot.ab.Chat;

you have to adde the jar files in the lib folder to the library of your android project.
lib folder containing: Ab.jar, commons-codec-1.6.jar, commons-logging-1.1.1.jar, hamcrest-all-1.3.jar, httpclient-4.2.1.jar, httpclient-cache-4.2.1.jar, httpcore-4.2.1.jar, httpmime-4.2.1.jar, jgoodies-common.jar, jgoodies-forms.jar, joda-time-2.1.jar, json-20090211.jar, junit-4.11.jar, sanmoku-0.0.5.jar, sanmoku-feature-ex-0.0.1.jar

The steps below helped me in resolving this similar issue which I was facing in importing these library (to build a chat bot) in Android Studio.
Download this program-ab distribution link
https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/program-ab/program-ab-0.0.4.3.zip
(found this link on this site https://howtodoinjava.com/ai/java-aiml-chatbot-example/)
Unzip this to a convenient folder(It did not matter in my case much because we need to later copy and paste but it might depend from pc to pc).
Click on lib folder, you will find Ab.jar file.
Copy this Ab.jar file and follow the next steps available on this link.
How to add a jar in External Libraries in android studio
this did help me. Hope it helps you too.

Related

Can't install Dropbox plugin for Android Studio

I'm trying to add the latest (v5.1.1) Dropbox plugin to my Android Studio install (Bumblebee 2021.1.1) on Win10. I downloaded the .jar file from releases/v5.1.1 folder to an empty folder, then tried to install it using this method: from the Studio main menu I chose Plugins, selected the gear icon followed by Install Plugin From Disk, browsed to the .jar file location, selected it then pressed OK. I got an error message: "Fail to load plugin from file dropbox-sdk-java-5.1.1.jar". I tried installing the -5.1.1-javadoc.jar file using the same method, with the same result. I don't need the sources, I just want to use the SDK. Any ideas? TIA!
First, I think you meant "Android Studio" instead of "Visual Studio"?
If so, it sounds like you're attempting to install the Dropbox Java SDK as a plugin to Android Studio itself. The Dropbox Java SDK is not an Android Studio plugin though. It is a package for connecting to the Dropbox API from your Java app.
To install the Dropbox package in your app, you should use Maven or Gradle, as instructed here.
The Dropbox Java SDK also comes with an example Android app that uses the Dropbox package.
Thanks, Greg; your answer pointed me in the right direction. I had already added an 'implementation' directive to my Gradle file as per the directions on GitHub. However, I took the instruction to add the directive by editing my "project's build.gradle" too literally; I added it to the Project build.gradle file instead of adding it to the Module build.gradle. Problem solved!

Downloading a libgdx Project Gradle Problems

So my friends and I are making a game for Android and we are using Android studio. We are using libgdx. We are also learning how to use github. Anyways, using Android Studio, I uploaded the basic libgdx setup. The one that just displays the Bad Logic image. My friend downloads it from github using Android studio but there are errors everywhere. It says that it can't find the badlogic package and it gives the following error:
This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.
I know that libgdx uses gradle. So what is the problem? Why can't we simply upload and then download a simple project?
Thanks!
Try to remove the .gradle directory and re-import the project or use the Setup App Installer from here to create a new gradle project.
Thanks for the help! I finally figured it out.
Basically, when I imported the project, I was just importing with existing project files. These are the steps I took to get it fixed.
Check out from Version Control using Android Studio and the welcome screen.
When asked to open, say NO.
Go to the folder that is associated with the repo.
Create a local.properties file there and in that file it should have
sdk.dir = /YOUR/PATH/TO/SDK/HERE
Then go back to Android Studio.
Click Import Project and select the folder that has it in there.
From then on, it should work forever as the .gitignore file that is generated by libgdx will ignore the local.properties file when pushed. I hope this helps someone!

How to import android support library in eclipse on mac?

I am trying to set up android sdk in eclipse on my mac.
I have downloaded the Android Support Library, however, there is nothing i can import to the eclipse.
I have already read through related post, and "Support Library Setup" as well.
Most people are having problems after importing the support library to eclipse and link to their own android application project, but thats not my case.
I had been stuck for days and will be really appreciated if someone can help me to solve this out.
Screen cap of SDK Manager
Screen cap of of ../android-sdks/extras/android/m2repository/com/android/support/
You can find the *.aar file (this is archive file ).And unzip it and find jar files along with ressources files.after that you can add it to libs directory in your project.

Android Studio doesnt recognize content of imported jar archive

I read all over the net on how to import a jar file to android studio because I want to import parts of a java program I previously wrote into my android app.
So I already tried the following:
Put the jar into the libs folder and add compile files('libs/my-jar.jar') to the build.gradle (actually I tried both files, the one in app and the one in ´appname´).
Rightclick the jar and clicked "Add as Library"
Cleaned and rebuild (both via commandline and from within Android Studio)
Added the jar via "Project Structure -> Dependencies"
I litterally tried every suggestion on simmilar posts here on stackoverflow I found by googling "use jar in android studio" or "import java archive android studio" etc.
My Problem is, that Android Studio doesnt find the classes within my jar.
It still underlines my code whenever I try to create an Object of one of my classes. Im currently using Android Studio 1.2.1.1.
Do I somehow have to import them in Java Syntax (eg. import my-jar.jar.ClassXY?
I have no experience with java archives. I just exported my Java project from Eclipse by hitting "Export -> As Jar Archive". I also tried exporting as runnable jar file. Is that theoretically enough? When I searched the web it seemed to me this is enough.
Thank you for answers :)

android-support-v7-appcompat library project won't work

I am trying to add Support Library v7 to my clean android project as support library (with resources). I followed every instruction here: http://developer.android.com/tools/support-library/setup.html#download and android.support.v7.* package is not visible in my main project.
Here is library reference in main project:
Support library project tree:
Support library project build path:
And finally, my main project tree
I don't see any errors in Problems tab, app compiles and runs normally but i cannot import android.support.v7 package which apparently isn't in build path in main project. I went through instruction twice in clean projects/workspace. I cleaned project, restarted Eclipse and nothing... All resources from library project are unreachable too.
Thanks in advance :)
Copy the library project to the folder where your android project is.
Select File > Import.
Select Existing Android Code Into Workspace and click Next.
Browse and import the same to eclipse
Once the library project is imported you can refer the same in your android project.
This is similar to setting up google play services in eclipse described here. Check the 4th step
http://developer.android.com/google/play-services/setup.html
It looks like android-support-v7-appcompat.jar is missing from your libs folder.
When you download the Android Support Library through the Android SDK Manager it makes the support .jar files you need available under {SDK Location}\extra\android\support.
To use the v7 files, copy these to your project's /libs folder.
android-support-v4.jar
android-support-v7-appcompat.jar
android-support-v7-gridlayout.jar (*if needed)
android-support-v7-mediarouter.jar (*if needed)
Typical gotchas (this looks OK in your setup):
Make sure the min SDK is at least API 7
Make sure the project target build is at least API 17
For more information about using the support V7 package (including running the v7 samples) can be found at the RHM Guide to Android Support Lib.
The issue seems to be in Absolute path in case of Windows base machine. I faced the issue of referencing support libraries When I moved Eclipse and related libraries to different drive than where the project was.
Copy paste the libraries to folder on same derive in a way that it can pick by relative path.
..\androidCommonlib\appcompat
android.library

Categories