I have trouble including the ShowcaseView library in my Android application with Android Studio.
On the GitHub repo (https://github.com/Espiandev/ShowcaseView), it says it should be easy to install with Maven. But when I search for showcaseview, Maven finds no result.
So I clone the repo on my computer and try to include it's library folder as a java library in my project's module dependencies. But when I try to use it in my code, it says
Cannot resolve symbol 'ShowcaseView'
My guess is because the actual ShowcaseView library is not compiling due to errors (the cloned repo is showing in multiple files the error
Cannot resolve symbol 'R'
event after adding the NineOldAndroids as a module dependency as showed on the GitHub repo.
Is there something I am missing?
You shouldn't include library folder as a java library.
try following way to add ShowcaseView library as a module to your project:
Go to file > Project Structure...
in the left panel select Modules and in the middle panel click plus icon and then select Import Module
from browsing dialog select path of ShowcaseView library
click next... to finish importing (but notice the directory /gen of library unchecked)
Then goto the Library section in left panel and select libs in middle panel
if the library robolectric-2.2-20130909.210745-40-jar-with-dependencies.jar existed in right panel then you should remove it.
Goto the Modules section and select your main project module in middle panel and click plus icon in right panel and select Module Dependency... then select ShowcaseView library that previously included.
Now you should rebuild your project...
Go to ShowcaseView Manifest and change the package name to com.espiandev.showcaseview
the rebuild, re-organize imports, R would resolve to the new package.
Related
I have downloaded assimp source code. How to import assimp to Xcode project - ARToolKit5 downloaded from ARToolkit official website? I am trying to load external models - made by blender,maya,3dmax - to this project.
(ps: I am a beginner of Xcode, so please explain it in detail. )
Thank you! :)
I know it's late, but it might benefit someone else.
Here are the steps :
Download and extract the source code from(for version 3.3.1)
https://github.com/assimp/assimp/archive/v3.3.1.zip
Download CMake Gui, and select source as the folder you got after extracting above. Create a build folder inside the assimp folder, and select it to be the build directory.
Select Configure and select XCode. Then Click on generate to generate build files in the build folder.
Open Assimp.xcodeproj file in build folder in XCode and build it.
Now you have got the library and include files. The library files are located in assimp(which you extracted)/build/code/Debug, and the include files are at two locations, one set is at assimp/include and other at assimp/build/include. Make a separate folders library and include at your desired location and copy all these files in the corresponding folders you created.
Now open your project in XCode. Select your project from the left panel, and click on Build phases, click on + inside 'Link Binary with libraries', and click on add other, now select the libassimp.4.0.1.dylib(select the latest version) file.
Now click on Build settings, inside search paths, add your include folder(which you created) to the header search paths, and the library folder to library search paths.
If you followed the steps correctly, you could use these statements inside your project
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
Assimp is available in homebrew. After installing it, add assimp to your Library Search Paths and link it in the build phase tab.
brew install assimp
In your Xcode project, click your Project name in the sidebar > Build Settings tab > Library Search Paths
Double click on the third column of "Library Search Paths" to edit it
Click "+" and add /usr/local/Cellar/assimp/VERSION/lib/. Replace VERSION with your version.
At the top, click on the "build phases" tab
Open "Link Binary With Libraries"
Click the "+"
On the bottom click "Add Other" > "Add Files..."
Add the file /usr/local/Cellar/assimp/VERSION/lib/libassimp.VERSION.dylib, replacing VERSION with your version.
Also make sure you have /usr/local/include in the Header search paths, found before "Library Search Paths" in the instructions above.
I downloaded the Parse SDK and added all of the dependencies as well as the Parse.framework and Bolts.framework. Then I went to my app delegate and
started to import Parse and Bolts. Then I got an error saying "Could not build Objective-C module 'Bolts'". This was because of many errors in the Bolts.h file which all said "Include of non-modular header inside framework module 'Bolts'". So after some research I found that people have fixed this error by changing their header file to "public". But when I tried to do this the only options I get in the "target membership" column, after selecting the Bolts.Framework, is to make it required or optional. Why am I not getting the public, private, and project options? What other way can I find those options?
Select the header file in the Project Navigator (right pane of XCode). In the Utilities pane (far right) select the File Inspector tab. Under Target Management you should be able to select the target and change that property.
Incidentally, I had the same issue (both FacebookSDK and Bolts installed). By removing Facebook from Library Search Paths (under Build Settings) I was able to get it working.
I want to work with some frameworks like glew and cg so i manually added
the needed frameworks to my project by right clicking the project -> Add files to ...
and choosing the correct framework. The problem is, when i try to include the header files,
Xcode cant find any of them. I hope this picture will help to understand:
And:
The error given is for the glew framework, but it also happens on Cg.
As you can see on the left, The needed frameworks were added.
Any idea on how i can include these headers?
After trying to add the header files manually i got an architecture error:
I dont know if this is how it should look like.
Thanks!
Before starting, remove the framework and all files you have added while trying to make it work.
Then, you have to add the frameworks in the Build Phases of your target. Then go into Link Binary With Libraries and select your framework from there.
This should do it. Your headers should be available as auto-completion after each #import directive.
If it does not work (it sometimes happens), there are additional steps I can provide to you.
Additional steps:
Go to your project settings, in the build settings:
Complete the Framework Search Paths with the path of your framework
Do the same with User Header Search Path
Then, it should work. If it does not, you will need to add the full path of your header in the #import directive. Example:
#import "/path/to/my/header.h"
Apple's documentation available here states:
In the project navigator, select
your project
Select your target
Select the 'Build Phases' tab
Open 'Link Binaries With Libraries'
expander
Click the '+' button
Select your framework
(optional) Drag and drop the added
framework to the 'Frameworks' group
In my case I have added Framework Search Paths for Target, but it should be added to Project
Also Always Search Users Path should be yes
For those whose autocomplete fails after adding framework.
I used to add frameworks, by going to Build Phases and taking the Link Binary with Libraries option. Now in XCode 6.1, though project was building fine, autocomplete in XCode was not working.
So what needs to be done is:
Remove the already added framework from Project Navigator and also from Link Binary with Libraries.
Add framework to project by simply File -> Add Files to option in XCode.
And auto complete will start working.
In my case, the external framework had been downloaded with Windows and added to the project. Then it was transferred to OSX, where the Xcode project was built and the external framework didn't load properly. I guess it is because Windows changes the framework folder to be a regular folder, which OSX then has trouble with.
Solution for me was to simply download the framework with OSX and drag it into the framework folder in the XCode project.
In my case I had to update a framework version, so I just replaced the .framework in the filesystem and then I got the error you've mentioned in the question.
Removing the framework and adding it back again, playing with the search paths and all the other suggestions didn't help.
Eventually, cleaning the build folder did the trick:
Select "Product" from the xcode menu, hold the option key and click on: "Clean Build Folder".
After that I built and ran the project successfully.
I'm trying to embed a private framework (last paragraph) in my application bundle using XCode 4 and following Apple's (seemingly) outdated instructions.
In my case, I'm Using Separate Xcode Projects For Each Target. This is the final step:
In the General tab of the inspector window, add your framework as a dependency for the application. Adding this dependency causes Xcode to
build the framework target before building the application target.
The build dependency you establish in the application target causes the framework to be built before the application. This is important because it guarantees that a built version of your framework will be available to link against and to embed in the application. Because of this dependency, you can set the active target of your Xcode project to your application and leave it there. Building the application now builds the framework and copies it to the application bundle directory, creating the necessary linkage between the two.
Yet, when in click on the + button in Target Dependencies the framework doesn't show up. How can I establish a build dependency between the private framework and the application target in Xcode 4?
Edit: I should clarify that I already got the private framework working. I just want to avoid having cleaning the project every time a change to the framework is made, and make sure the framework is built before the application target.
Managed to solve this by adding the private framework project as a subproject, then adding the framework target in Target Dependencies.
However, in my case the framework target didn't show as an option in Target Dependencies until I deleted DerivedData. That nasty little bug drove me crazy.
If you want to add your private framework without including it as a sub project, you have to add a Copy Files task for it:
Select your framework with the + button and choose Frameworks for Destination.
You don't need to add anything in Target Dependencies.
Also for this to work, make sure Runpath Search Paths value is #executable_path/Frameworks in the Build Settings tab.
Select your project in the Xcode and then you can find the Project and Target at the right side. Then Select Target and go to LinkBinary with Libraries and then one window will come and there at the bottom left there is an option called Add other.
You first need to add the other project's .xcodeproj to the project as a subproject:
Right-click the Frameworks group (or whatever/wherever else)
Select Add Files to "<Project>..."
Select the other project's .xcodeproj
That other project's targets will now appear in the Target Dependencies menu
Here is more complete answer with update for Xcode 12+.
Copy the 3rd party framework to your project folder.
It can be anywhere within the same project in the tree. You will need the path info in later steps.
In Xcode, select your build target, then select "general" tab, scroll down to "Framework, libraries, and Embedded Content", then select "+" to browse and select the 3rd part library/framework you want to add. See bellow:
Once added, make sure "Embed & Sign" is selected at the dropdown list for the library/framework you are trying to add.
This is important since the framework will be looked up and loaded at runtime.
Go to "Build Settings" tab, and find "Framework Search Path", and enter the path to the framework's in relative to your Xcode project file's location. See bellow:
Now you can build and run your app with the added framework.
Im playing around with the soundcloud api, in its instructions it says to
drag SoundCloudAPI.xcodeproj into your project
add it as a build dependency
I can drag the project in pretty easily, but how does one accomplish the next step?
To add it as a dependency do the following:
Highlight the added project in your file explorer within xcode. In the directory browser window to the right it should show a file with a .a extension. There is a checkbox under the target column (target icon), check it.
Right-Click on your Target (under the targets item in the file explorer) and choose Get Info
On the general tab is a Direct Dependencies section. Hit the plus button
Choose the project and click Add Target
Select your project in the navigator on left.
Open up the drawer in the middle pane and select your target.
Select Build Phases
Target Dependencies is an option at that point.
Tough one for a newbie like me - here is a screenshot that describes it.
Xcode 10.2.1
Under TARGETS in your project, right-click on your project target (should be the same name as your project) and choose GET INFO, then on GENERAL tab you will see DIRECT DEPENDENCIES, simply click the [+] and select SoundCloudAPI.
Just close the Project you want to add , then drag and drop the file .
Xcode add a project as a dependency
Xcode 10
drag-n-drop a project into another project - is called cross-project references[About]
add the added project as a build dependency - is called Explicit dependency[About]
//Xcode 10
Build Phases -> Target Dependencies -> + Add items
//Xcode 11
Build Phases -> Dependencies -> + Add items
In Choose items to add: dialog you will see only targets from your project and the sub-project
Today I faced with the same problem.
As the result of the first run I got next error:
Lexical or Preprocessor Issue: 'SDKProjectName*/*SDKProjectName.h'
file not found.
But before running, I, obviously, added my SDK into the demo project, just drag&drop .xcodeproj file into my test project's source tree. After that, I moved into Build Phases tab in setting of the main xcodeproj file (of the demo) and added my SDK as target dependency and embed framework into corresponding tabs.
But at the result, I got an error above!
So, the problem was into empty line on the Header Search Paths option. I just wrote "../**" as value for this key and project compiled successfully. So, after that, you can add #include <SDKName/SDKName.h> into any project, which includes this SDK.
ps. My test app was created into root SDK folder.