paky
paky

Reputation: 1

UnsatisfiedLinkError: Native library (com/sun/jna/android-x86-64/libjnidispatch.so) not found in resource path (.)

i'm develop android app for sniffing packets from device. I'm using pcap4j library, but when call Pcaps.getDevByAddress(), launches the exception. Can you help me?

This is snipped code:

InetAddress destAddr = parsedPacket; 

PcapNetworkInterface nif =Pcaps.getDevByAddress(destAddr);

Thanks

Upvotes: 0

Views: 906

Answers (2)

YAMAMOTO Yuji
YAMAMOTO Yuji

Reputation: 1434

I guess you should add JNA as aar:

implementation 'net.java.dev.jna:jna:5.5.0@aar'

ref: https://github.com/java-native-access/jna/blob/master/www/FrequentlyAskedQuestions.md#jna-on-android

Upvotes: 0

Crittje
Crittje

Reputation: 101

Not sure if this might still be an issue for you. Have you added both dependencies to you classpath?

Add the following to your pom.xml:

<dependencies>
 <dependency>
  <groupId>org.pcap4j</groupId>
  <artifactId>pcap4j-core</artifactId>
  <version>1.7.3</version>
 </dependency>
 <dependency>
  <groupId>org.pcap4j</groupId>
  <artifactId>pcap4j-packetfactory-static</artifactId>
  <version>1.7.3</version>
 </dependency>
   ...
</dependencies>

Also make sure you have installed pcaplib-dev on your machine. Depends on OS how to install it.

Did you perform these steps?

If so, have you given java root access (assuming you are on linux)? I have seen people getting issues after they used the set_cap command. Please let me know!

Upvotes: 0

Related Questions