Questions tagged [j2objc]
J2ObjC is an open-source command-line tool from Google that translates Java code to Objective-C for the iOS (iPhone/iPad) platform.
137
questions
0
votes
1
answer
49
views
How do you use external build rule in Xcode (J2Objc)?
I want to use j2objc with an external build rule with Xcode, described to some extent here: https://developers.google.com/j2objc/guides/external-build-projects
What I have accomplished so far:
...
0
votes
1
answer
108
views
j2objc reflection support in native iOS classes
I've just updated my j2objc tool from 1.0.2 to 2.8. As far as I know there were changes in reflection starting from 1.1 version. And now code doesn't work anymore.
We have IApplicationSupport.java ...
1
vote
1
answer
373
views
No able to build J2ObjC
I have fulfilled the requirements for installing j2objc on my mac as follows:
Apple macOC Catalina Version 10.15.7
Xcode Version 12.2 (12B45b)
JDK 1.8 installed - JAVA_HOME=`/usr/libexec/java_home -v ...
0
votes
1
answer
106
views
j2objc adding source class dependency for junit test class
I am very new to j2objc and have a question about translating junit test classes.
I have a class (Foo.java) and a corresponding test class (FooTest.java). I am following steps from this link to ...
0
votes
1
answer
218
views
J2ObjC undefined symbols for architecture arm64
I'm trying to convert a java library to objective-c using j2objc and include the generated objc files into my XCode project. I managed to generate the objc files, but XCode gives me the following ...
0
votes
2
answers
209
views
Cyclic dependency error J2OBJC archive build?
I am having cyclic dependency issues with my Ionic/iOS project using J2OBJC as a internal Xcode settings built in.
I've set my build rules and settings in my ionic project as stated in the J2OBJC ...
0
votes
1
answer
60
views
How can I access Android string resources from ObjC
I am looking for a function in ObjC to get strings from Android string resources.
I have res/values/strings.xml (Android project):
<?xml version="1.0" encoding="utf-8"?>
<resources>
&...
1
vote
2
answers
327
views
How j2ObjC works
I am here to have some clarifications on how j2ObjC works. I've developed my own app on android and now I'm trying to get into the world of IOS with less problems as possible. I heard of j2objc and I ...
0
votes
1
answer
543
views
J2ObjC with Swift - Bridging Header Imports not found when archiving
I've been using J2ObjC for a while now to share code code between Android and iOS. Every time I come to create an Archive to deploy I have trouble with imports in -Bridging-Header.h not being found. I ...
2
votes
2
answers
471
views
Compile Apache common math for iOS or alternatives
I am trying to compile Apache math for iOS.
I am using this fork : https://github.com/j2objc-contrib/j2objc-common-libs-e2e-test
This library is using J2Objc version : 0.9.8 and J2Objc-Graddle ...
0
votes
1
answer
337
views
How to install j2objc
Yesterday I ran "make dist" but compiling was more than 4 hours(I don't know, which time it could, if I didn't press stop). Today I run "make dist" again and compiling very long time again. Is it ...
0
votes
1
answer
45
views
How to get custom http status text for ios using j2objc
I'm using HttpURLConnection.getResponseMessage() to get http status text. When the server responses with custom status text like HTTP/1.1 500 ItemNotFoundException, translated to objective c method ...
0
votes
1
answer
77
views
Update J2ObjC library in Xcode10
I'm currently working on an app in Xcode10 which references the J2ObjC library.
When trying to build the app i get the following errors. See line 486-490 in image below.
I currently have j2objc ...
0
votes
1
answer
173
views
J2Objc - Ignoring annotations when compiling code
I have a set of java beans that are annotated with @XmlRootElement from javax.xml.bind. When trying to import the .h files in my XCode project, I get the error 'javax/xml/bind/annotation/XmlTransient....
-1
votes
1
answer
163
views
Objective C class method call in Swift
j2objc created a class method declaration in the header file as follows:
(void)startWithNSString:(NSString *)folderPath
withNSString:(NSString *)pushyToken
withInt:(jint)port
withInt:(...
0
votes
1
answer
140
views
J2ObjC: How to get NSError from JavaIOIOException
I need to determine no internet exception when connecting to server without network. But on iOS I get IOException(On Android exception is ConnectException).
The message of exception contains this ...
1
vote
1
answer
305
views
Sharing code between iOS and Android using Bazel and j2objc
I have a library with common code which uses android.util.Log:
java_library(
name = "common",
srcs = glob(["*.java"]),
)
And I have an j2objc rule for iOS which works just fine:
...
0
votes
1
answer
221
views
How to convert sqlite-jdbc-3.8.11.1.jar to iOS using j2objc?
I'm converting a java project to objective c (on iOS).
However, when I run it, it's hitting:
*** Terminating app due to uncaught exception 'JavaLangClassNotFoundException', reason:
'java.lang....
0
votes
1
answer
536
views
How to include "import" when using j2ojbc?
Hi I'm trying to convert a java project to objc. However there are still some hiccups when I'm trying to do so.
error: package com.zzz.yyy.xxx does not exist
import com.zzz.yyy.xxx.Test;
e.g.:
...
2
votes
2
answers
2k
views
How to Import Java Library and use It In my IOS(Swift) Project, Xcode 9
We have a Common Java Library for to be use in both Android and IOS .. In Android It Is common But When It Comes to IOS is there any way to use Java Library In my project.. Please help If you have any ...
0
votes
2
answers
523
views
Fastest possible j2objc integration
I just want to share our j2objc setup with you guys, as it took us some time to fine-tune it in one of our projects. We're currently compiling 400+ files using j2objc, have classname duplicates in ...
0
votes
1
answer
105
views
J2ObjC: How to translate own type
I want to create class-adapter for platform specific code.
For example, there are 2 classes:
Java:
class SQLiteAdapter {
public void executeSql() {
//use android.database.sqlite
}
}
...
0
votes
0
answers
1k
views
How do I use j2objc to convert my android app to ios?
I have been searching for the past days on a tutorial on how to use https://developers.google.com/j2objc/guides/getting-started to convert my Android App (I have the source code) to IOS and I have ...
0
votes
1
answer
56
views
Working make file example
Sorry to appear so basic in this place.
1/ Shall I use both a make file and build settings + build phases, or alternatively a make file or build* ?
2/ There is two examples of make files in the wiki ...
1
vote
1
answer
404
views
Why does SHA-256 message digest give different result in j2objc?
I'm getting a different result when running my code in Java and j2obc. My java code looks like this:
import java.security.DigestException;
import java.security.MessageDigest;
import java.security....
4
votes
1
answer
3k
views
Xcode cannot find header files when files added in folder reference mode
I am trying to add many Objective-C files to my Swift project with folder reference mode that means when I drag and drop my files into project I am selecting "Create Folder Reference".
This is ...
0
votes
1
answer
138
views
Why doesn't J2ObjC translate field with @Weak as __weak but __unsafe_unretained?
As we know, __unsafe_unretained is not as safe as __weak, so why doesn't J2ObjC translate field with @Weak as __weak but __unsafe_unretained?
0
votes
1
answer
222
views
When Compiling with j2objc: javax.* packages are not found
When building a Java projekt with j2objc in command line, I specify all needed dependencies JARs with the -classpath attribute, e.g.: httpclient-4.4.1.jar or others.
This works for all dependencies ...
0
votes
1
answer
176
views
J2OBJC_HOME not correctly defined in LibConfig.xcconfig
I was trying to run a J2OBJC sample from this "https://github.com/yixiang/Xcode-J2ObjC-Example" repository. I am facing some issue while building this project.
the error is listing below.
...
0
votes
1
answer
204
views
"J2OBJC_HOME\ not\ correctly\ defined\ in\ Settings.xcconfig
Guys last 2 to 3 day I am trying to run an example project for J2OBJC conversion. First I faced issue for the j2objc command not found, fixed this issue by adding the path to the /etc/paths file. Now ...
0
votes
1
answer
238
views
j2objc - exception when deserialize enum
I am having trouble deserializing objects that contain an enum. The object serializes without complaint, but I get an InvalidObjectException when I deserialize the object. The exception message says ...
1
vote
1
answer
898
views
how to use .jar libraries in objectiveC ios Project Using j2objc?
the goal is make an ios app with this features:
-download a source code file as a text and compile or interpret at runtime
-this Plain Text source code needs to capable of UI Manipulation , Os and ...
1
vote
3
answers
807
views
How to install or setup j2Objc in android studio steb by step
How to use j2objc in android studio?
I did not find any manual. How to implement and work with j2objc in android studio?
I'm a junior in java language, and I wrote one app for android, and now I ...
0
votes
1
answer
332
views
Not able to install J2OBJC using terminal
I have download the J2OBJC version and while running the command on terminal
A:j2objc-master $ make dist
I am getting below error
building j2objc jar
javac: invalid source release: 1.8
Usage: javac ...
0
votes
1
answer
151
views
Has the Cocoapod of J2ObjC been depricated?
The J2Objc Cocoapods page lists the latest version as 0.9.6.1 and this is what pod update fetches. However, the J2Objc git page indicates that the latest version is 2.0.2.
Has the Cocoapod for ...
0
votes
3
answers
48
views
J2ObjC JavaLangTreeSet<String> not possible?
I'm trying to create a TreeSet in objc using the J2ObjC cocoapod package v0.9.6.1 (the latest at this time).
#include <java/util/TreeSet.h>
id<JavaUtilSet> set = [[JavaUtilTreeSet ...
0
votes
0
answers
95
views
Facing issue while converting java code to objective c code using j2objc
I am trying to convert some of the java files to objective c classes. But i am facing some issue here. kindly check the image below.
Command i have given:
Click here to see the command i have given
...
1
vote
1
answer
113
views
j2objc Unable to call method that returns JavaIoInputStream in swift
One of my java classes implements 2 methods:
public OutputStream getOutputStream(){
return null;
}
public int getV(){
return 3;
}
After conversion with j2Objc, I try to call those methods ...
-1
votes
1
answer
527
views
How to set up and use j2objc
I would like to start off by saying that I am a novice programmer. I have only learned Java and Android studio, and I know very little about cmd prompts and that sort of thing. I recently found j2objc ...
1
vote
1
answer
363
views
J2ObjC - Android Libraries
I'm trying to convert my Android project to an Objective C project with J2ObjC. So far, I managed to convert all my files which are not using any libraries. However, every class which uses a library ...
0
votes
1
answer
129
views
How to include apache commons lang3 in XCode with J2ObjC
Trying to get my first j2objc project up and running in XCode. I have a few .java files and one of them references string functions in the apache commons library. I'm getting an error that says:
...
0
votes
2
answers
2k
views
Catch NSMallocExceptioni using swift
From time to time my users find this error:
myapp(7383,0x1a1471000) malloc: * mach_vm_map(size=67125248) failed
(error code=3)
error: can't allocate region
set a breakpoint in ...
0
votes
1
answer
459
views
J2OBJC_HOME not correctly defined in Settings.xcconfig
I must to include *.jar files in my Xcode project so I decided to use j2objc to translate them into Objective C. I tried to configure my project with no success so I just downloaded a sample project ...
0
votes
1
answer
130
views
J2ObjC JavaUtilHashMap Not Showing in Swift
I have an object with HashMap called metadata (of type HashMap<String, String>), which I'm using in a Swift app.
All of the other properties of the object are accessible through Swift (via the ...
0
votes
1
answer
93
views
how can I have kxml2 in j2objc package?
the kxml2 package is in the j2objc source tree (1.3.1)
enter link description here
but I cannot find the kxml2 supported after compile j2objc. Studied from a forum explanation enter link description ...
2
votes
1
answer
445
views
j2objc /usr/local/lib//libprotobuf.a(strutil.o) ld: 55 duplicate symbols for architecture x86_64
I am unable to get beyond the make protobuf step due to the error below. I read up some blogs, they recommended installing brew install protobuf. Did that. Still not able to build.
I am building on a ...
0
votes
1
answer
148
views
How to change a file generated by J2Objc
Hello I have been trying for a while to changue the url from a file .m generated by the tool j2objc but xCode seems to not notice it, when I recompile the whole project it's still pointing to the url ...
0
votes
1
answer
273
views
I'm instantiating from Swift non-ARC Objective-C classes transpiled from Java (J2ObjC), is it leak-safe?
I'm using J2ObjC for a project. I did setup everything and included my Java classes.
Only note is that I had to disable ARC because otherwise my Java codebase would not transpile/compile. (J2ObjC ...
1
vote
2
answers
171
views
j2objc exception prevents unit tests running
I'm working on an app that uses a cocoapod, which has been built using j2objc. But when I try to run unit tests in Xcode I see the following error:
Terminating app due to uncaught exception '...
0
votes
1
answer
191
views
Some Objective-C methods are invisible in Swift 3
Why this method
+ (instancetype)arrayWithNSData:(NSData *)data;
in j2obj project
https://github.com/google/j2objc/blob/master/jre_emul/Classes/IOSPrimitiveArray.h#L252
invisible for Swift3?
but ...