NativeScript / NativeScript/android-dts-generator

Importing dependencies for a .jar file

Open
#8 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
96
Forks
25
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented commands with bolts-tasks-1.4.0.jar, android.jar, and OneSignalSDK.jar, noting where dependency lookup fails. Trace the command-line handling of repeated -input arguments in dts-generator.jar and define done as resolving required classes without manually adding every dependency jar.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, typescript
Domain
mobile-dev, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.