How do you add existing header-only source files to android studio? - android

This has to be the dumbest question I've had to ask in a while:
How do I add existing C/C++ source headers to the project listing in android studio?
I have a project for android I'm working on, and I'd like to add some header-only libraries to the project. However, I can't for the life of me figure out how to get them into android studio for easier browsing.
I can add C/C++ files by adding them to the corresponding CMake file, but I have no idea how Android Studio decides which header files should be in the application source tree, and it's not finding all the headers I'm actually using.
Frankly, I'm not sure how android studio found the C header files it does show, since they're not listed in any of the project files you're supposed to edit.
Doing a bulk text-search of the entire project directory for one of the headers that are found finds a single mention of the file in the .idea/workspace.xml file, but I experimented adding the additional file headers there, and as soon as I open android studio, it removes the added filename, and it doesn't get shown in the UI anyways.
How the heck are you supposed to do this?

Android Studio 3.0 and lower do not do a good job showing header files in C++. I'm working on improving this for a future release.
Here's how it works today. If Android Studio is given a .cpp or .c file then it will display a .h file that has the exact same base name (if it exists). So if project contains basename.cpp the basename.h will be in the Android view as well.
One way to see all the files in your project is to switch from Android view to Project Files view. This may not be what you're looking for.

Related

How to set the local cpp source path in Android studio for prebuild library

I created an App which includes our source code as a native lib (so-file). I'm able to step into it and everything works fine so far with this code.
This native lib links against another native lib which was pre-build on a different machine and which I copied into the jni-abi-folder. I have checked out the svn-repository of this so-file in a different folder parallel to my project and need to be able to debug also into it.
When I now do a break, I can see the method names in the callstack so I assume that the symbols can be loaded, but Android Studio doesn't know where to find the source files.
Under Visual Studio, when I did a break, I could specify the symbols in the symbol path and then an error was displaced that I should navigate to the corresponding source file. Then I only needed to navigate to the folder and it was working.
How can this be done with Android Studio - I have the newest version 3.2.1 installed.
I finally found the solution.
I got a stripped version from my colleague, he basically gave me the version inside his apk which is stripped. Now he gave me directly the build version (I think it is located somewhere in the intermediate directory or so, just search for the name of the lib).
Under Run\Edit Configurations\Debugger\LLDB startup commands the original source directory can be mapped to the source directory on my computer which is different. To achieve this, enter "settings set target.source-map or-dir cur-dir"
There should be a way to find out the original source directory from the so file, but I don't know it right now.
I hope this can help somebody else

How can I make my Android app dependent on a library of custom UI views? Where can I found those after Importing?

I have some points with me!!
1) Where can I found custom Android UI View library's in the web. I have searched a lot and failed obtaining a working one.
2) I haven't got any *.jar files inside the *zip I've downloaded.
3) Android studio can't support zip library's but Eclipse can.
4) Where is Graddle file located in Eclipse.
Now my question is...
Even I've added one custom UI library and built. The layout editor palette window's CUSTOM VIEW Tab in Eclipse will not shows any VIEWS from that added library? Why so? Do I manually write the XML? Please help me..!!! Also where can I find good attractive and colorful UI element library in web?
1) Where can I found custom Android UI View library's in the web. I have searched a lot and failed obtaining a working one.
ans : It depends on what type of custom ui want. You have got search specific custom ui widgets. Ex : button,TextView etc. You get it library project most of the time so you have advantage customise further as per your need. Jar will be very less.
2) I haven't got any *.jar files inside the *zip I've downloaded.
Ans : As my previous ans zip what you got is library project. Its not jar project. And im sure sure you have got more zip from github repository.
3) Android studio can't support zip library's but Eclipse can.
Ans : You have to unzip and add it as dependency library to project.
4) Where is Gradle file located in Eclipse
Ans : Gradle file is nothing but build.gradle file or settings.gradle
1) Good point to start is Android Arsenal
2) A lot of library can be add to Android Studio Project manually as Module or providing single file with aar extension.
Jar file is not very useful for custom control, because it cant store android xml resources file, so you cant declare strings or attributes. Best choice is aar library format.
3) If library contain only class files just rename it from zip to jar and add it to project as usually.
4) Eclipse does`t support graddle build system at all.
In any case, be sure that you add library to Eclipse project and press refresh button on custom view tab.

JNI folder is not picked up by Android studio after headers are generated

I am working on building an Android Library which is part of a larger Android app project. I am using Android Studio.
I created the Android library as a module in the Android app project. I created my native methods, and then I put the .class through javah -jni and I was able to see the jni folder created and the header file generated.
However, Android Studio is not picking up the jni folder and showing it in the project view.
Anybody have any idea, what am I missing?
After hours of looking through docs, and posts, and tutorials, I remembered to check the simplest of things. Make sure your jni folder is in src/main

Connection with SQLLite on Unity3D using Javascript in Android

How can connect with SQLLite from Android using Unit3D and Javascript?
Someone can'i help me?
Here are the specific steps to getting SQLite set up in your project.
Download SQLite - you'll want the ZIP file with the DLL inside
that's in the Precompiled Binaries for Windows section.
Important Copy sqlite3.dll into your into your project's Plugins folder (make a folder called Plugins if you don't have one).
You won't get a warning if you don't do this, and your project will run fine in the editor, however, it will fail to work when you actually build your project, and will only provide information about this in the log file.
This will give you a License Error if you're using Unity Indie, but it doesn't seem to have an effect on the actual play in the editor, nor does it seem to effect the ability to build stand-alone versions.
Alternately, you can leave it out of your project entirely, but when you build your application, you'll need to include a copy of sqlite3.dll in the same directory as the .exe in order for it to work.
In your project, add in the dbAccess.js file: http://wiki.unity3d.com/index.php/SQLite#dbAccess.js
You should be good to go!
Source (and the above is pretty much copied word-for-word from):
http://wiki.unity3d.com/index.php/SQLite

Allow the same project to be opened and built with Android Studio OR IntelliJ IDEA

I develop an SDK, and would like to be able to check in module files for both IntelliJ IDEA and Android Studio. I've devised the following solution, with one missing piece:
Create module files ending in -intellij-idea for the main project, and each module.
Create build.gradle files, and use the "sourceset" directive to use the old style src and res directory structure.
The problem is that the project information is always stored in a directory called ".idea". Before, I could have two IPR files, such as my-project-android-studio.ipr and my-project-intellij-idea.ipr. I could then open one in Android Studio, and the other in Intellij IDEA, but the actual source would remain the same.
How can I accomplish this? If there is a way to force Android Studio to generate IPR files instead of the ridiculous .idea directory, that would be optimal.

Categories

Resources