有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

安卓在nativescript中编写java文件以使用本机java库

如何以及在哪里编写java文件?我在platforms/安卓/com/tns中写了我的,以使用本机插件NewPipeExtractor,它不识别库和java.lang.System的导入以及它返回的newpipenlib的导入。我该怎么办

应用程序。格拉德尔

compile 'com.github.newpipeextractor'

Java文件

 import org.schabi.newpipe.(some lib/class)
 import java.lang.System

错误:

JS: ERROR TypeError: _co.createVideoView is not a function
JS: ERROR CONTEXT {
JS:   "view": {
JS:     "def": {
JS:       "nodeFlags": 33734657,
JS:       "rootNodeFlags": 33554433,
JS:       "nodeMatchedQueries": 0,
JS:       "flags": 0,
JS:       "nodes": [
JS:         {
JS:           "nodeIndex": 0,
JS:           "parent": null,
JS:           "renderParent": null,
JS:           "bindingIndex": 0,
JS:           "outputIndex": 0,
JS:           "checkIndex": 0,
JS:           "flags": 33554433,
JS:           "childFlags": 180225,
JS:           "directChildFlags": 49153,
JS:           "childMatchedQueries": 0,
JS:           "matchedQueries": {},
JS:           "matchedQueryIds": 0,
JS:           "references": {},
JS:           "ngContentIndex": null,
JS:           "childCount": 3,
JS:           "bindings": [],
JS:           "bindingFlags": 0,
JS:           "outputs": [],
JS:           "element": {
JS:             "ns": "",
JS:             "name": "ActionBar",
JS:             "attrs": [
JS:               [
JS:                 "",
JS:                 "title",
JS:                 "Yt Download"
JS:               ]
JS:             ],
JS:             "template": null,
JS:             "componentProvider": {
JS:               "nodeInd...
JS: ERROR Error: java.lang.NullPointerException: downloader is null
JS:     org.schabi.newpipe.extractor.Extractor.<init>(Extractor.java:34)
JS:     org.schabi.newpipe.extractor.stream.StreamExtractor.<init>(StreamExtractor.java:44)
JS:     org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor.<init>(YoutubeStreamExtractor.java:93)
JS:     org.schabi.newpipe.extractor.services.youtube.YoutubeService.getStreamExtractor(YoutubeService.java:95)
JS:     org.schabi.newpipe.extractor.StreamingService.getStreamExtractor(StreamingService.java:288)
JS:     com.tns.Runtime.callJSMethodNative(Native Method)
JS:     com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242)
JS:     com.tns.Runtime.callJSMethodImpl(Runtime.java:1122)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:1109)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:1089)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:1081)
JS:     java.lang.Object_vendor_119474_32_ClickListenerImpl.onClick(Unknown Source:10)
JS:     安卓.view.View.performClick(View.java:6597)
JS:     androi...
JS: ERROR CONTEXT {
JS:   "view": {
JS:     "def": {
JS:       "nodeFlags": 33734657,
JS:       "rootNodeFlags": 33554433,
JS:       "nodeMatchedQueries": 0,
JS:       "flags": 0,
JS:       "nodes": [
JS:         {
JS:           "nodeIndex": 0,
JS:           "parent": null,
JS:           "renderParent": null,
JS:           "bindingIndex": 0,
JS:           "outputIndex": 0,
JS:           "checkIndex": 0,
JS:           "flags": 33554433,
JS:           "childFlags": 180225,
JS:           "directChildFlags": 49153,
JS:           "childMatchedQueries": 0,
JS:           "matchedQueries": {},
JS:           "matchedQueryIds": 0,
JS:           "references": {},
JS:           "ngContentIndex": null,
JS:           "childCount": 3,
JS:           "bindings": [],
JS:           "bindingFlags": 0,
JS:           "outputs": [],
JS:           "element": {
JS:             "ns": "",
JS:             "name": "ActionBar",
JS:             "attrs": [
JS:               [
JS:                 "",
JS:                 "title",
JS:                 "Yt Download"
JS:               ]
JS:             ],
JS:             "template": null,
JS:             "componentProvider": {
JS:               "nodeInd...

带有声明和用法的代码:

declare const org:any;

const Downloader = org.schabi.newpipe.Downloader;
const NewPipe =  org.schabi.newpipe.extractor.NewPipe;
const YoutubeStreamExtractor =  org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
const Stream = org.schabi.newpipe.extractor.stream;
const Localization = org.schabi.newpipe.extractor.utils.Localization;
const YouTube = org.schabi.newpipe.extractor.ServiceList.YouTube;

downloadVideoInit(){
  let extractor;
  extractor = YouTube.getStreamExtractor("https://www.youtube.com/watch?v=YQHsXMglC9A");
  extractor.fetchPage(); 
  extractor.getAudioStreams();
 }

例如,使用lib转到here


共 (0) 个答案