google / j2objc

A Java to iOS Objective-C translation tool and runtime.
http://j2objc.org
Apache License 2.0
5.99k stars 968 forks source link

Built dist from master does not contain package android.util #2104

Open CruorVult opened 1 year ago

CruorVult commented 1 year ago

I've built dist (make all_dist) without errors. But when translating sources that uses package android.util, for example SparseArray, it fails.

package android.util does not exist
import android.util.SparseArray;

Using other packages like org.json translates successful

Use this command to translate "$HOME/j2objc/dist/j2objc" -d "gen" -classpath "$HOME/j2objc/dist/lib/json.jar" --no-package-directories -sourcepath "." "Test.java"

Comparing with public distribution I've noticed that there is no libandroid_util.a in lib folder

tomball commented 1 year ago

We removed the android.util classes from the jre_emul libraries because with Java 9+ they can't be in the same module as JRE classes. This issue shows there's more work that needs to be done to fix android.util support.

As a temporary workaround, you should be able to just copy the sources you need from this package into your iOS app or a separate library. Several of these classes depend upon com.android.internal.util classes, which can also be included.

CruorVult commented 1 year ago

Tom, thank you for answer! I'll copy the sources as you recommended.

blazek commented 1 month ago

I would be nice to get fixed.

It would be useful to mention this in build instructions https://developers.google.com/j2objc/guides/building-j2obj.