how add Android project as library or add arr in android moudle project - titanium

I need to use a third-party SDK which must be added as aar or android project library.
I tried to unzip the aar and copy the /lib and /res files to my titanium android module project, but it didn't work.
the error looks like this:
The developer of the SDK tell me check out a link which is FATAL EXCEPTION: java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$layout
I don't know how to solve it, hope someone could help me, thanks

Because Titanium is a Javascript cross platform tool to build native apps, you will need to write a wrapper to get a native functionality to work.
You can check out the documentation how to this on the Appcelerator website.
Unfortunately you can't just drop in a native component.

Related

how to add ios support for existing React Native application with only Android support?

I know it might be very basic question. But I am very new and got a codebase with only android support. I need to add iOS for it. Please help me
As you're aiming to build a cross-platform app, React Native provides two ways to organize the code and seperate it by platform: platform module or platform-specific file extensions.
As you already have an Android app, I assume it has more complexity so you might want to split the code out into separate files.
You say you have an Android app but i don't thing that at any point you specified that the app should only build for Android (you can review in the package and the project configuration). So, the following command should be enough:
react-native run-ios
If you created your react native app from a template (e.g. using npx react-native init ProjectName), it already provides an ios and android folder, so it already supports it. If the file is not there, you could follow the instructions that #Rajan shared above to recreate the ios folder.
If your problem is running the iOS application using npm run ios, and its failing to build or the javascript throws an error, the quickest thing to try is cd ios, then pod install. If this does not work, it might be because you have additional dependencies you have installed, which require specific instructions and configuration to be done in the ios folder. This is library dependent, if needed, will be explained in depth in the README.md of the library. For example, react-native-firebase has a lot of steps, and is different to the android configuration.
Sometimes it is helpful to modify these configurations in XCode instead of editing the files manually (e.g. plist, xml, xproj). You can open xcode quickly using xed ios when in the root project folder.
Note: As usual, remember to have the libraries available in the node_modules folder, npm install.
In the future, you might choose to run different javascript code based on the platform (platform-specific code). React native allows that by using file.android.js and file.ios.js. However, your IDE is likely to struggle with the 2 files, and won't be as helpful compared to file.js. Alternatively, you can import Platform and conditionally check at runtime, what your platform is.
If you used Expo, you don't have access to the native code, but will already support iOS.

How include aar whitch has JNI so file in React Native project

I have wrote a project by React Native,now I need to reference a android SDK to implement some functions.
the android sdk is a aar file,and it contains JNI,now it reports couldn't find "libjniload.so", the "libjniload.so" is in the aar.
If you want to reference an Android SDK, you must add the files to your android project in your react native project. That means, you must add the dependencies to your build.gradle, and copy the files to you libs folder etc.. This is not any different than adding .aar files to an Android project. After this, you will need to implement a native module to call its functions from react-native. This is the general procedure, what exact step is causing error?

Adding React Native to an existing iOS app - fails to compile

I followed the official guide on adding React Native to existing iOS apps (Swift).
pod install finished successfully and I got to the point when I import React in a Swift file and try to compile the app.
The build fails with an error in the yoga dependency. Xcode cannot find the C++ standard library:
However, then I click "Go to definition" on <algorithm>, Xcode can find it:
These are my project settings (I tried a few different combinations):
I'm fairly new to iOS development, so this might be a simple issue with our existing project, Xcode, Command Line Tools, or my machine. I Googled around a bit, no luck so far.
Any help from someone familiar with iOS development is appreciated! When we find the solution I'd like to update the official guide so others don't get stuck adding React Native to their app.
I believe your issue is fixed by this PR https://github.com/facebook/react-native/pull/17764, which reduces the number of exported Yoga headers to those that are actually needed to be able to build and as part of that removes headers that require C++ and its stdlib.

Adding third party Library to the native project makes the "IBMMobilefirst Platform "not found?

I want to add "Crashlytics" and "Appsflyer" framework in the IBM Mobilefirst iOS Project. After adding the Framework it shows that the " 'IBMMobileFirstPlatformFoundationHybrid/MFPMainViewController.h' file not found".
Tried with both Cocoapods and Framework, but getting the same error.
But its fine with native project.
Sample Project is available in
https://www.dropbox.com/s/r8u54gfrmofqzhf/native.zip?dl=0
Please suggest how to resolve it.
Try with Adding "$(SRCROOT)/frameworks" in your Frameworks Search Path under Build Settings of your Xcode Project, I hope it should resolve the issue.
Also i have added Crashlytics and Appsflyer in MFP 7.1 Hybrid Project and I did not find any issues. Sample application you can find here.

Android code using Titanium

How can I access the Android Java code, created by the Titanium as a result of the Titanium development?
You don't have such a possibility since all the javascript code in Titanium is interpreted by a JavaScript engine internally and .class files are generated.
Follow this link for further explanation.
If you are referring to the interpretation of your javascript code, then you can't. Everything is turned into symbols for Titanium to interpret, but you can find this at your /build folder
Titanium use javascript code, Modules let you write code in a platform's native language (Java for Android), Titanium can use java native code in module and java code run in v8 。