IBluetoothGatt.java in Android Studio - java

I am trying to create a Bluetooth application in Android Studio. I am using BluetoothGatt.java which requires IBluetoothGatt.java which is not in the sources folder in my android studio install.
I downloaded IBluetoothGatt.java from grepcode and saved it in the sources folder (where BluetoothGatt.java is located) but when I try to import IBluetooth.java it can't find it.
Is there a step I'm missing? I've never done anything like this before so I'm not familiar with how to import a downloaded file into my project.

Related

How to call base non static class function from Native Android SDK in Unity C# after importing Native Android Studio project as AAR fie in Unity?

I have an SDK from Thermal Expert(which is a company that makes thermal cameras) and a thermal camera.
and its for Android Studio
so, it works perfectly in android studio project, and also in build apk(no issues)
now, what I am trying to do is, to make a .jar or AAR file, from the android project , and import it to unity, so I can make it work similar as in Android Studio.
for now, I can successfully export AAR file of the android project and can import it to unity, under Assets/Plugins/Android/samplename.aar
and I did a simple android studio project for learning(on how to export as AAR file to unity), and it was a simple class, i am able to run it properly in unity after importing it as AAR file.
As I am confused/doubtful at this point, how to call base non static class function, from Native Android SDK, which processes the frame, in Unity C# after importing Native Android Studio project as AAR fie in Unity?
I want to know if this is possible, if yes, how?
also, would like to know, if using Unity as a library in Android Studio is feasible for the same?
Thanks

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!

Error while importing library in android studio

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.

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 :)

Categories