When I'm working on an Android app, I can control+click on a function call in editor to navigate to the function source. This works well for classes in the project and classes in Android SDK. However, if I control click on a function call that is from an Android Support Library (say: android-support-v13.jar), I'm taken to a file that has the function signature but the contents say "compiled code".
I tried adding the path to the support library's source to Project Structure->Sources but looks like that didn't make any difference.
How do I set this up right.
Navigate to Project Structure | Libraries
If you haven't already, create a library and add the android-support-v13.jar
In the same library, click "Attach Files or Directories..." and select the Android Support Library's src directory (<android-sdk>\extras\android\support\v13\src)
Add this library as a project dependency
Your library should look something like this:
Related
I have followed the NativeScript documentation on adding Objective-C code to a NS project although I am struggling to call the Objective-C code in my iOS project. I am only trying to implement appPlugin.h and appPlugin.m files into my project.
My folder structure for the Objective-C files are as follows:
Project/app/App_Resources/iOS/src/...
I have also tried creating a NativeScript plugin that gets added to the dependencies in the projects package.json.
Are there any additional files that need to be added to make the Objective-C code compatible with the NS project. The documentation simply says run "If you run 'tns prepare ios' you will see that the files are now part of the project."
Link to the documentation I have been following:
https://www.nativescript.org/blog/adding-objective-c-code-to-a-nativescript-app
https://docs.nativescript.org/plugins/building-plugins
SOLVED: Files are added to the TNSNativeSource folder (Check in Xcode) and are available to use like any JS object.
I already create an .aar (android library) files in android studio and want to call/use it in nativescript-vue project.
I have placed the aar file in "app/App_Resources/Android/libs" folder.
Based on my reading, in typescript the way to call the method in aar files is by calling com.package.MyClass.
My question is , how to call it in .vue files. I have tried to call the method using the same approach but its produce an error :
Module not found: Error: Can't resolve com.package.MyClass
Can someone please help me on this.
Your help is very much appreciated.
You may simply place your AAR file in your App_Resources/Android/libs directory, CLI will pick it up at build time and the native APIs should be available at runtime within your project.
Try a clean build if you see errors, make sure the AAR is picked up. You might be able to verify it from the CLI logs. If you still see issues, make sure the class you are trying to access is public.
I'm not sure it's possible to use the android lib directly in the main project or not. In my way, I create a NS plugin that includes the .aar library, then add this plugin to the main project & use the methods defined in the .aar library without problem.
If you place the .aar library in the main project, you should check if that .aar library is installed by running tns build command & look at console log. If it's installed together with the project, that means you can use the lib method in .vue or any .js files.
I have a Page class in a project A. I want to navigate to this page from my Universal windows project(say Project B) page. In UWP I am trying to achieve this using Frame.Navigate(typeof(Page_classA)), since NavigationService.Navigate(new Uri()) is obsolete in UWP.
But I get a Windows.UI.Xaml.Markup.XamlParseException in this case.
Is there any other way in UWP or metro Apps for navigating to a page in different assembly?
We can use Frame.Navigate(TypeName) method to navigate to a page in different assembly.
For example, we can create a Class Library(Universal Windows) named "ProjectA" and in this project add a new Page named "PageA". Then in this project's Properties page, check the "Generate library layout" option in the Build configuration.
In WinRT environment, the resources are no longer embedded in the assembly but are placed next to the dll as content. So we need to generate library layout so that we can reference the dll in other project conveniently.
After this, we can build the project and we will get following layout in "Debug" folder:
In ProjectA folder, it contains .xaml file and .xr.xml file:
When we get the library output files, we can copy them to anywhere and in the Universal Windows Project(Project B), we just need to add reference to the "ProjectA.dll" file. Visual Studio will automatically pick these files up and put them in the appx package when it builds the app.
And in Project B, we can use following code to navigate to PageA:
Frame.Navigate(typeof(ProjectA.PageA))
In your case, you get a Windows.UI.Xaml.Markup.XamlParseException, this may be that the .pri file is missing when you add the reference. Here is a similar case. So please check your library layout and make sure these resources are are placed next to the dll you referenced.
I have a library that I'd like to use in a Cocoa project, (specifically vgmstream).
To use this, is it as simple as dragging the necessary files into Xcode? Or would I have to build or bundle it in some way in order to use it?
If you have built static/shared libraries and the header files, you can easily drag them into the project. Otherwise, you'd have to build the libraries your self, or drag in all the source files to the project.
The so called framework that Xcode uses, is just a folder with .framework extension containing a Headers folder and a static library with it's name the same as the folder name without extension.
I am trying to create and then add the dylib to a project.
I created it by using the "Cocoa-Library" template and setting the type to "Dynamic" (not sure if it should be dynamic or static...). Then I created a simple obj-c class called Test and wrote a method in it that prints out something to console.
I compiled and used the generated .dylib file and put it in another project. Now whenever I try to use it, I get this message on runtime"
dyld: Library not loaded: /usr/local/lib/TESTLib.dylib
Referenced from: /Users/***/Library/Developer/Xcode/DerivedData/TestingDYLIB-axmoocnxbwznoyerfogosumqufxc/Build/Products/Debug/TestingDYLIB.app/Contents/MacOS/TestingDYLIB
Reason: image not found
I also created a Copy File phase and set the destination to "Frameworks". I still get the same error.
What am I doing wrong?
The issue is not where Xcode is looking for the library at compile time, which is what Simon Whitaker's answer addresses.
The issue is that the application which uses the dylib cannot find it at runtime. When an application is built that uses a dynamic library, it copies the install_name of the dylib into the output binary.
Creating a copy files phase and copying the dylib to the Frameworks subdirectory of the app's bundle is the right thing do do.
However, you need to do an additional step. You need to compile the dynamic library with an install_name appropriate for a bundle app. By default, a dynamic library is created with an install_name of /usr/local/lib. The app can't find your library there because it doesn't exist. Even if you put the library there, your users certainly won't have it, so that would be the wrong solution.
The right solution is bundling the library with the app. To set the install name for the dynamic library, go into the dynamic library project and set the "Dynamic Library Install Name" option to: #executable_path/../Frameworks/libmydynamiclibrary.dylib
Xcode is looking in /usr/local/lib/ for the library. If the library is in another location, add that location to your Library Search Paths:
Select project file in Xcode 4
Select the target, then click the Build Settings tab
Make sure All is selected in the filter bar (not Basic)
Scroll down to the Search Paths section and you'll find Library Search Paths in there