简体   繁体   English

从原生android模块创建Titanium Appcelerator模块

[英]Create Titanium Appcelerator module from native android module

I am trying to create a Appcelerator module from a native android module located here. 我正在尝试从位于此处的本地android模块创建Appcelerator模块。 https://github.com/jaredrummler/ColorPicker Are there any tutorials online that will guide me in this process. https://github.com/jaredrummler/ColorPicker在线上有任何教程可以指导我这一过程。 This is my first attempt at this, so any kind of guidance will be very helpful. 这是我的第一次尝试,因此任何指导都将非常有帮助。 Is there anyway i can use a native module AS IS using Hyperloop? 无论如何,我可以使用Hyperloop按原样使用本机模块吗?

Yeah this is possible. 是的,这是可能的。 From that page it references the AAR file. 它从该页面引用AAR文件。 AAR is similar to a JAR file, but with a few cavaets. AAR与JAR文件类似,但具有一些音符。 So to do this you will probably want Titanium SDK v6.0+, and the higher version the better. 因此,您可能需要Titanium SDK v6.0 +,并且版本越高越好。 Probably 6.2.2 is recommended, if not 6.3. 如果不是6.3,建议使用6.2.2。

So you will have to first enable Hyperloop for the project (google it), then place the AAR in a (probably newly created) folder: /app/platform/android/the-color-aar.aar . 因此,您必须首先为该项目启用Hyperloop(将其谷歌搜索),然后将AAR放在(可能是新创建的)文件夹中: /app/platform/android/the-color-aar.aar Then you'll have to know how to invoke the classes. 然后,您将必须知道如何调用这些类。 That discussion and more you can find referencs to here: https://github.com/shouse/awesome-hyperloop-titanium/ . 有关讨论以及更多内容,请参考这里: https : //github.com/shouse/awesome-hyperloop-titanium/

From there you'll do a var colorpicker = require('com.jaredrummler.android.colorpicker') then figure out the proper syntax to invoke the classes in the AAR. 从那里,您将执行var colorpicker = require('com.jaredrummler.android.colorpicker')然后找出正确的语法来调用AAR中的类。

Join us at http://tislack.org/ and find the Hyperloop channel to hit me up in real time, along with other devs who work with HL. http://tislack.org/上加入我们,并找到Hyperloop频道以及其他与HL合作的开发人员实时为我服务。 Reference this url. 引用此URL。

I've also just started using https://github.com/google/android-classyshark to get more info from AARs, JARs, and APKs to be able to understand what the functions are on those libs. 我还刚刚开始使用https://github.com/google/android-classyshark从AAR,JAR和APK中获取更多信息,从而能够了解这些库中的功能。 Here's a screenshot: https://imagebin.ca/v/3j1PZzSxP6SI 这是屏幕截图: https : //imagebin.ca/v/3j1PZzSxP6SI

Finally if it might make sense to use the 7.0.0 beta Titanium SDK so that you can do proper debugging via Chrome Inspector. 最后,如果可以使用7.0.0 beta Titanium SDK以便您可以通过Chrome Inspector进行适当的调试, If you build with appc ti build --platform android --debug-host localhost:9222 -l trace this will start a debugging session. 如果使用appc ti build --platform android --debug-host localhost:9222 -l trace构建,这将启动调试会话。 After not long you'll see in the console something like: 不久之后,您将在控制台中看到类似以下内容的内容:

[WARN] JSDebugger: (main) [26,831] Debugger listening on ws://127.0.0.1:9222/a361771c-2273-4b1e-800f-0e8e9f0d74ec [WARN] JSDebugger: (main) [1,832] To connect Chrome DevTools, open Chrome to chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9222/a361771c-2273-4b1e-800f-0e8e9f0d74ec [WARN] JSDebugger: (main) [0,832] Waiting for debugger to connect for next 60 seconds... [WARN] JSDebugger :(主要)[26,831]侦听ws://127.0.0.1:9222 / a361771c-2273-4b1e-800f-0e8e9f0d74ec的调试器[WARN] JSDebugger :(主要)[1,832]要连接Chrome DevTools,请打开铬到chrome-devtools://devtools/bundled/inspector.html?experiments = true&v8only = true&ws = 127.0.0.1:9222 / a361771c-2273-4b1e-800f-0e8e9f0d74ec [WARN] JSDebugger :(主要)[0,832]等待调试器在接下来的60秒内连接...

Copy that URL into a newish version of Chrome and you'll be set to do a lot deeper introspection that will help your life outside of Hyperloop too. 将该URL复制到最新版本的Chrome中,您将需要进行更深入的自省,这也将有助于您在Hyperloop之外的生活。

Cheers! 干杯!

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

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