Creating extensions for Adobe air - android

I'm creating an Java extension for the Adobe AIR android app. I'm very new to Adobe flash. I don't have the flash builder, but only flashdevelop IDE. I follow the instructions from Adobe article to create extensions. The tutorial is very helpful, but unfortunately this is based on Flash Builder.
Step 1 : Create the jar file with the java code -> I did this.
Step 2 : Create an SWC file which is a wrapper to the jar file created in step 1. This is where I'm stuck. I tried to use the ExportSWC4.2 component, but this was not successful. Then now I'm trying to use the compc utility coming with the SDK. In both of these methods, I'm stuck with the problem that I don't know how to include the jar file created in step 1 in the build of the swc using compc. So, I always get the error in my extension as3 file from the wrapper project about the missing java package/extensions.
My current build command is something like :
compc -source-path . -include-classes .... -output ....
So my question is : How can I indicate the compc compiler that it should refer my .jar file?
Or is there a better way to do this?

You don't include a .jar in the build of the swc at all. The swc is only one part of the required components for creating a ANE. Once the swc is created you'll need to extract the library.swf from it. That library.swf needs to be included for each target platform (usually in its own folder) specified by the extension.xml.

Related

Linking C++ OpenCV to an app in Android Studio

I am integrating existing C++ code that uses OpenCV to an Android app, using Android studio. For this purpose, I have installed the package OpenCV-android-sdk and added it as a module to Android studio. I have also created a simple Kotlin app.
So far I have managed to integrate my C++ code into the project. After adding the paths to the OpenCV includes by means of an include_directories statement, the code compiles successfully.
My next step would be to link against the precompiled OpenCV library, to resolve the "undefined symbol" errors. I have no idea how to achieve this/where to specify it. I have tried to find resources on the web, but not two resources tell the same and the solutions seem overly complicated. I am lost in the jungle.
I finally managed. Here comes the recipe (validated under Windows).
Make sure to download the OpenCV Android SDK and copy it somewhere.
The project must be created as a Native C++ app (Phone and tablet). A cpp folder is automatically created with a native-lib.cpp source file and a CMakeLists.txt.
Add the following lines to the CMakeLists file, after the project line:
set(OpenCV_DIR $ENV{OPENCV_ANDROID}/sdk/native/jni)
find_package(OpenCV REQUIRED)
You must define the environment variable OPENCV_ANDROID and make it point to the folder .../OpenCV-android-sdk that you copied. (Alternatively, you can hard-code the path in the set command.)
Then insert at the bottom
target_link_libraries(app_name ${OpenCV_LIBS})
where OpenCV_LIBS points to the folder .../OpenCV-android-sdk/sdk/native/libs, and app_name is the name you gave when creating your app.
Finally, cross fingers and build.

Creating native shared library with Android studio

I am trying to build a Native (C++) share library in Android studio (it will be linked to another project). I created the Native project, but whatever I try, it seems I have to have at least one java file that calls a C++ API from that library, meaning I need another C++ file in my set of native files containing the function the Java file calls.
I do not want this additional file, because it will be part of the shared library. I just want to create a shared library. Any idea how to do it, or should I switch back to ndk_build and its set of makefiles?
Thanks.
you can implement that by using cmake in android studio, refer to the url of here : https://developer.android.com/studio/projects/configure-cmake
add c++ source file you needed to the directory where you want
modify the script in CMakeLists.txt to add the library you want to build:
add_library(
anyLibName
STATIC (or SHARED)
absolute path of some c++ source file
)
3.include the c++ header files:
include_directories(directory absolute path of your c++ headers file)
4.execute 'Sync' and 'Run app' in AndroidStudio's menu
5.after build finished,you can find the library(*.so or *.a) in the directory below:
{project dir}/app/build/intermediates/cmake/debug
attention that the library you build does not linked to any other library but only the c++ standard. if you want to do that you can using 'target_link_libraries' command

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

Referencing .so files from an Android library

I've built OpenSSL into an Android Library that I would like to reference from another Android project.
Unfortunately,
Yes, I do need OpenSSL, as I need to change the behaviour of dependant Android classes not in the public API. (not enough space here)
My experience with native code is non-existant.
The project is selected as a library in Preferences > Android
This library is referenced from a second Android project
My Questions are these
How can I reference the .so files in my Android library from Android.mk in my second project so that I can build dependant files there? I'd prefer not to put the .so files directly in my second project - but if that is the only solution I would accept reasons and directions as an answer.
How should I include/reference the .so file in files I am building in the second project?
Surely, it is something simple.
Thanks in advance.
once you generate (.so) library file, then make a folder in your applitcation's project folder named "libs/armeabi/" put (.so) file in this folder
and in your application write
System.loadLibrary("library_name");

Categories

Resources