android-dts-generator icon indicating copy to clipboard operation
android-dts-generator copied to clipboard

Importing dependencies for a .jar file

Open roblav96 opened this issue 9 years ago • 1 comments

TLDR

How do I import all the dependencies required for a jar file I'm setting as input?

First I want to say, this repository is a game changer for debugging native Android plugins. I'm using it to see exactly what APIs are exposed to TypeScript for any .jar file.

For example, here's a gist of the BoltsFramework/Bolts-Android bolts.Task.d.ts.

I'm having an issue with dts-generator.jar and detecting dependentcies for the input jar file.

Example:

java -jar dts-generator.jar -input bolts-tasks-1.4.0.jar

Error:

Exception in thread "main" java.lang.NoClassDefFoundError: Couldn't find class: java.lang.Exception required by class: bolts.AggregateException. You need to provide the jar containing the missing class: java.lang.Exception

What I've been doing so far is adding android.jar from $ANDROID_HOME/platforms/android-23/android.jar and adding it to an input like so:

java -jar dts-generator.jar -input android.jar -input bolts-tasks-1.4.0.jar -generate-multiple

Which most of the time results in a working output of *.d.ts files.

Although sometimes for example,

java -jar dts-generator.jar -input android.jar -input OneSignalSDK.jar -generate-multiple

Errors

Exception in thread "main" java.lang.NoClassDefFoundError: Couldn't find class: com.amazon.device.messaging.ADMMessageHandlerBase required by class: com.onesignal.ADMMessageHandler. You need to provide the jar containing the missing class: com.amazon.device.messaging.ADMMessageHandlerBase

Since the android.jar file does not contain com.amazon.device classes.

How do I import all the dependencies required for a jar file I'm setting as input?

roblav96 avatar Aug 28 '16 16:08 roblav96

It seems like I need to modify the Java Build Path as described here.

Is there a way I can always set -input android-support-v13.jar and -input android.jar for every jar?

roblav96 avatar Aug 28 '16 17:08 roblav96