简体   繁体   English

如何将Balistica lib(.vala)导入Android Studio

[英]How to import Balistica lib (.vala) into Android Studio

does anyone know how to import this ( https://github.com/steveno/balistica ) lib into Android Studio ? 有谁知道如何将此( https://github.com/steveno/balistica )库导入Android Studio? How I understand it is written on Vala language and I have never worked with it. 我如何理解它是用Vala语言编写的,我从未使用过它。 Any kind of help will be appreciated. 任何帮助将不胜感激。

It is quite hard to achieve, since Vala code can't be compiled for Android easily. 由于Vala代码无法轻松为Android编译,因此很难实现。 But if you are adventurous, you can try to follow what is said in this article , event if it is a bit old, and I'm not sure it will be still working. 但是,如果您喜欢冒险,可以尝试遵循本文中所说的内容 ,如果事件有点陈旧,并且我不确定它是否仍会起作用。

Once you cross-compiled the library, just add the .so file in your project and try something like that: 跨库编译后,只需在项目中添加.so文件,然后尝试类似的操作:

public class MyActivity extends Activity {
    // This will load libmylibrary.so
    static { System.loadLibrary("mylibrary"); }

    // "Import" the foo method from the library
    private static native void foo ();
}

Vala automatically changes the names to camel case and the methods signatures to make it work in C, so you'll probably have to read the .h file to know how to call each method. Vala会自动将名称更改为驼峰式大小写和方法签名以使其在C语言中起作用,因此您可能必须阅读.h文件才能知道如何调用每个方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM