neodix42 / ton4j

Java libraries for interacting with TON blockchain.
GNU General Public License v3.0
28 stars 10 forks source link

add dependency #18

Open saeedishayan76 opened 2 weeks ago

saeedishayan76 commented 2 weeks ago

hi when i add depdency to android project error duplicate class occured . implementation("io.github.neodix42:ton4j:0.4.6") implementation("io.github.neodix42.ton4j:tonlib:0.4.6")

error:

Duplicate class com.iwebpp.crypto.TweetNacl found in modules tweetnacl-java-8-0.4.6 (io.github.neodix42.ton4j:tweetnacl-java-8:0.4.6) and tweetnacl-java-8-0.4.6 (io.github.neodix42:tweetnacl-java-8:0.4.6)

neodix42 commented 2 weeks ago

does it work if you add only: implementation("io.github.neodix42.ton4j:tonlib:0.4.6")

saeedishayan76 commented 2 weeks ago

no new error occured

Caused by: org.gradle.internal.component.NoMatchingConfigurationSelectionException: No matching variant of io.github.andreypfau.curve25519-kotlin:curve25519-kotlin-js:0.0.4 was found. The consumer was configured to find a component for use during runtime, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:develop' with value 'mainnet', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.1.0', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:

neodix42 commented 2 weeks ago

It seems you are mixing two libraries ton4j and https://github.com/andreypfau/curve25519-kotlin. Did you add dependency to https://github.com/andreypfau/curve25519-kotlin ?

saeedishayan76 commented 2 weeks ago

no just ton lib dependency exist, can i work with your library only with implementation("io.github.neodix42.ton4j:tonlib:0.4.6")?

after clear cache only this dependency works, but does'nt have wallet class

neodix42 commented 2 weeks ago

right, if you pull only tonlib, you will be able to use only Tonlib wrapper. Try to add the dependency : implementation("io.github.neodix42.ton4j:smartcontract:0.4.6") it will pull the required libs

saeedishayan76 commented 2 weeks ago

so thanks, how to create wallet from mnemonic with usage of ton lib ?

neodix42 commented 2 weeks ago

look at this example: https://github.com/neodix42/ton4j/blob/aedb55acdd9c030ffaeb2143295adc5aadfa21d0/mnemonic/src/test/java/org/ton/java/mnemonic/TestMnemonic.java#L84 and afterward this one: https://github.com/neodix42/ton4j/blob/9501c22830e09e48086c0c750cbd603aca90b1e7/smartcontract/src/test/java/org/ton/java/smartcontract/integrationtests/TestWalletV3R2Short.java#L42v

saeedishayan76 commented 2 weeks ago

thank when i add 2 depdency smartcontract and tonlib below error occured: Native library (com/sun/jna/android-x86-64/libjnidispatch.so) not found in resource path (.)

and when i add here file error : dlopen failed: library "libnative-lib.so" not found android occured

neodix42 commented 2 weeks ago

could you please try to use this tonlib library, compiled specifically for android: https://cicd.neodix.io/view/pipelines/job/master-pipeline/lastSuccessfulBuild/artifact/artifacts/tonlib-android-jni/ton-android-tonlib.zip

saeedishayan76 commented 2 weeks ago

Should I remove ton lib dependecny and add top folder to jni folder? but again top error occured and when i add libjnidispatch.so manualy, error version 6.1.3 occured

neodix42 commented 2 weeks ago

No, you need tonlib dependency. Just place the library of correct architecture to any folder or resources and specify path to it in tonlib builder.

On Thu, Jun 20, 2024, 23:57 Shayan Saeedi @.***> wrote:

Should I remove ton lib dependecny and add top folder to jni folder?

— Reply to this email directly, view it on GitHub https://github.com/neodix42/ton4j/issues/18#issuecomment-2181624436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMOVWWNJACL5GJSGRVJLYJ3ZINF4VAVCNFSM6AAAAABJRXJ656VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBRGYZDINBTGY . You are receiving this because you commented.Message ID: @.***>

fereshteh-jvz commented 3 days ago

I added this to my project but then I faced this error: java.lang.UnsatisfiedLinkError: dlopen failed: library "libtonlibjson.so" not found: needed by /data/data/.../cache/libnative-lib.so in namespace classloader-namespace

could you please try to use this tonlib library, compiled specifically for android: https://cicd.neodix.io/view/pipelines/job/master-pipeline/lastSuccessfulBuild/artifact/artifacts/tonlib-android-jni/ton-android-tonlib.zip