Professional Documents
Culture Documents
Step 1: Convert Source jar files into Objective C
j2objc -use-arc -d source_common_lang334_codec110_pac_arc commons-codec-1.10-
sources.jar commons-lang3-3.4-sources.jar
Step 2.1: Create a new Xcode Project -> Cocoa Touch Static Library
Step 2.2: Drag & Drop the generated Files into Project
Step 2.3: Build Settings -> Environments Setup
1. J2OBJC_HOME: /j2objc-dist
2. Framework Search Paths: ${J2OBJC_HOME}/frameworks
3. Library Search Paths: ${J2OBJC_HOME}/lib
4. User Header Search Paths: ${J2OBJC_HOME}/include
5. User Header Search Paths: ${SRCROOT} Select recursive
6. Other Linker Flags: -ljre_emul -ObjC
https://www.evernote.com/shard/s446/sh/f1f71e7f-bd0f-4191-9f41-7d3f1a6f333b/0faefc57db7e9bb9 1/5
10/27/2017 *Static Lib: 包结构完整在j2objc项目中使用
Step 2.4: Build Phases
1. Add all .h files into copy files
Step 3.1: Edit Schema (Debug - Release)
1. Build on Devices (Product -> Release-iphones) Generic iOS Device
2. Build on Simulators (Product -> Release-iphonesimulator) iPad Air
Step 3.2: Target
1. File -> New -> Target -> Cross-platform -> Aggregate
2. Build Phases -> New Run Script Phases
https://www.evernote.com/shard/s446/sh/f1f71e7f-bd0f-4191-9f41-7d3f1a6f333b/0faefc57db7e9bb9 2/5
10/27/2017 *Static Lib: 包结构完整在j2objc项目中使用
# define output folder environment variable
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# Step 1. Build Device and Simulator versions
xcodebuild -target ImageFilters ONLY_ACTIVE_ARCH=NO -configuration
${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}"
BUILD_ROOT="${BUILD_ROOT}"
xcodebuild -target ImageFilters -configuration ${CONFIGURATION} -sdk iphonesimulato
-arch i386 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 2. Create universal binary file using lipo
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/lib${PROJECT_NAME}.a"
"${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a"
"${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a"
# Last touch. copy the header files. Just for convenience
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include"
"${UNIVERSAL_OUTPUTFOLDER}/"
3. Select Target (Edit Schema -> [Debug - Release])
Step 4.1: Deal With Head files, which used in Cordova plugins
1. Copy Step1 generated files, under Header_files, run script under README.md. it will
remove all related .m method files
https://www.evernote.com/shard/s446/sh/f1f71e7f-bd0f-4191-9f41-7d3f1a6f333b/0faefc57db7e9bb9 3/5
10/27/2017 *Static Lib: 包结构完整在j2objc项目中使用
Step 5.1: Cordova plugins - Config
1. Related Static Lib & Header files & pulgin.xml - for the new added classes ( )
Step 5.2: Cordova plugins - Customer Converted Code
1. Related java code convert into J2objc.
j2objc -use-arc -d source_offline_arc offlineservice.jar -sourcepath gson-2.6.2-
sources.jar jsoup-1.8.3-fis-sources.jar commons-lang3-3.4-sources.jar lucene-core-3.5.0-
sources.jar lucene-grouping-3.5.0-sources.jar commons-codec-1.10-sources.jar
https://www.evernote.com/shard/s446/sh/f1f71e7f-bd0f-4191-9f41-7d3f1a6f333b/0faefc57db7e9bb9 4/5
10/27/2017 *Static Lib: 包结构完整在j2objc项目中使用
Want to save this note?
Sign In/Sign Up
Terms of Service Privacy Policy
https://www.evernote.com/shard/s446/sh/f1f71e7f-bd0f-4191-9f41-7d3f1a6f333b/0faefc57db7e9bb9 5/5