_From @meSmashsta on July 5, 2018 10:18_
I've been everywhere, articles, your documentation (even read how the metadata works), issues relavant to mine but to no avail!
I wanted to use my declared java libraries in app/App_Resources/Android/app.gradle but it's undefined even if I call the complete name i.e console.dir(de.mannodermaus.rxbonjour.BonjourEvent). The libraries are declared in my app.gradle file and I did run the nts build android command. I can access the JDK and ADK though i.e console.dir(android.view.View)
I can't access the libraries I have in my app.gradle, it's undefined.
Android--I don't use IOS
tns --version 4.1.2
node_modules/tns-core-modules/package.json: "version": "4.1.0"
"tns-android": {
"version": "4.1.3"
}
No tns-ios--my target platform is Android
No plugins
All I did was generate a simple nativescript typescript project, changed the app.gradle e.g min Sdk version to 19, target Sdk to 26., compile sdk version to 26, you can see my app.gralde here oh and I also changed the android manifest which can be seen here.
_Copied from original issue: NativeScript/nativescript-cli#3730_
@meSmashsta For your convenience, I have created this test project that is accessing the very same library. You can use it as a reference to compare your codebase with the test one. Let me know if you need further assistance.
_From @meSmashsta on July 5, 2018 11:50_
Brooooooooo, thank you!!!
So... There's a bit of an issue... How do I make this work for NS + Angular? I forgot to mention that the project that I generated was nativescript angular............... 馃槩
After viewing the source code (configurations and files that might be able to help me) and running it to see it works, I still can't get it to work for my project. So sorry...
@meSmashsta there should be no conceptual differences in the steps needed. Are you receiving some kind of error? Make sure that you have cast the main namespace to any as Angular is using TypeScript as first-class citizen language and TS won't allow using variables that are not explicitly typed (example here).
Yah, there should be no conceptual differences so I figured there must be something wrong with my setup. Here is my code and when I tns run android it doesn't compile and display this message
ERROR ReferenceError: de is not defined
JS: ERROR CONTEXT {
JS: "view": {
JS: "def": {
JS: "nodeFlags": 33669121,
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": 114688,
JS: "directChildFlags": 114688,
JS: "childMatchedQueries": 0,
JS: "matchedQueries": {},
JS: "matchedQueryIds": 0,
JS: "references": {},
JS: "ngContentIndex": null,
JS: "childCount": 1,
JS: "bindings": [],
JS: "bindingFlags": 0,
JS: "outputs": [],
JS: "element": {
JS: "ns": "",
JS: "name": "ns-items",
JS: "attrs": [],
JS: "template": null,
JS: "componentProvider": {
JS: "nodeIndex": 1,
JS: "parent": "[Circular]",
JS: "renderParent": "[Circular]",
JS: "bindingIndex": ...
@NickIliev I did the Intellisense and access to native APIs via TypeScript as instructed. Maybe you know an open source NS + Agular project that uses native java third party library. Or any possible tries that I could do, currently I'm just reading and reading and reading the doucmentation repeatedly, currently I'm thinking maybe I did a wrong install???
And yes I'm using the declare var name: any;
@meSmashsta the code looks fine and should work - I've recreated the whole scenario in an Angular based project and it works on my side. Try to reset the platform just to make sure that the gradle dependency is respected and that the metadata is generated.
rm -rf platforms
tns platform add android
tns run android
@NickIliev MY BROOOOOOO IT WORKED!!!! I AM NOT GONNA GET FIRED TODAY THANK YOU!!! 馃槶馃槶馃槶
I did your instructions and it bam!!! Wohooo!!!
Hi,
I have used/added 3rd party mozilla components in my nativescript. But i don't know how to use that classes in my ts files. Please help me on this.
see my app.gradle file content below
repositories {
jcenter()
google()
maven { url 'https://maven.mozilla.org/maven2' }
}
dependencies {
implementation 'org.mozilla.components:support-base:62.0.0'
implementation 'org.mozilla.components:browser-awesomebar:62.0.0'
implementation 'org.mozilla.components:browser-errorpages:62.0.0';
}
Most helpful comment
@NickIliev MY BROOOOOOO IT WORKED!!!! I AM NOT GONNA GET FIRED TODAY THANK YOU!!! 馃槶馃槶馃槶
I did your instructions and it bam!!! Wohooo!!!