issues with ttorrent with android? - android

i was looking for a torrent library for android and came-across ttorrent
.when i tried to add dependencty to gradle it gave me errors regarding slf4j-log4j12.
i ended up adding all jar files manually and managed to run the app using sample code.
But i am getting this error now.
ClassLoader referenced unknown path: /data/app/com.test.torrent-1/lib/arm64
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1273)
at java.net.InetAddress.lookupHostByName(InetAddress.java:431)
at java.net.InetAddress.getLocalHost(InetAddress.java:409)
at com.test.torrent.MainActivity.onCreate(MainActivity.java:26)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
i think it is trying to find a library but i cannot find it , that path does not exist in my mobile , any help?

Related

How to use NativeSecp256k1 wrapper from Bitcoinj in Android?

As I understand bitcoinj library contains wrapper for bitcoin-core functions - NativeSecp256k1. I am trying to call one of methods from this wrapper:
NativeSecp256k1.secKeyVerify(byteArrayOf(...))
But I got a crash:
java.lang.UnsatisfiedLinkError: No implementation found for int
org.bitcoin.NativeSecp256k1.secp256k1_ec_seckey_verify(java.nio.ByteBuffer,
long) (tried
Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1seckey_1verify and
Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1seckey_1verify__Ljava_nio_ByteBuffer_2J)
at org.bitcoin.NativeSecp256k1.secp256k1_ec_seckey_verify(Native Method)
at org.bitcoin.NativeSecp256k1.secKeyVerify(NativeSecp256k1.java:134)
at com.my.app.MainActivity.onCreate(MainActivity.kt:15)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
It looks like bitcoinj library contains the wrapper but doesn't contains native library which used in this wrapper. How to fix this issue?
Bitcoinj uses JNI to load a C library for secp256k1 curve operations. If the lib is imported correctly... and since you are trying to access it directly, you might be missing the System.loadLibrary('secp256k1') call
Check here : https://github.com/bitcoinj/bitcoinj/blob/2ec193f8479425c3a66bebf5f2d3493e39e88f7c/core/src/main/java/org/bitcoin/Secp256k1Context.java
To build the compiles sources for the lib, its describes in the comment block of the NativeSecp256k1 class, here : https://github.com/bitcoinj/bitcoinj/blob/2ec193f8479425c3a66bebf5f2d3493e39e88f7c/core/src/main/java/org/bitcoin/NativeSecp256k1.java#L34

Android Studio OpenCV Library not working

I have followed the directions here OpenCV in Android Studio the one that has 94 votes. I get this error when I dod System.loadlibrary("opencv-java")
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file
"/data/app/com.krikorherlopian.opencvsample-
1/base.apk"],nativeLibraryDirectories=
[/data/app/com.krikorherlopian.opencvsample-1/lib/arm,
/data/app/com.krikorherlopian.opencvsample-1/base.apk!/lib/armeabi-
v7a, /vendor/lib, /system/lib]]] couldn't find "libopencv_java.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.krikorherlopian.opencvsample.MainActivity.onCreate(MainActivity.java:13)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
EDIT: I still get the error , and I have the ndk added . Krikors-MacBook-Air:~ KrikorHerlopian$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/KrikorHerlopian/Downloads/adt-bundle-mac-x86_64-20140702/sdk/ndk-bundle
Whats the problem?
Edit2: Now I got problem of Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /Users/KrikorHerlopian/Downloads/adt-bundle-mac-x86_64-20140702/sdk/ndk-bundle//jni/Android.mk when i try running my app from the terminal using /Users/KrikorHerlopian/Downloads/adt-bundle-mac-x86_64-20140702/sdk/ndk-bundle/ndk-build

PjSip not working in Marshmallow

App is working fine prior to Marshmallow. Here is the logcat.
E/PjService: We have a problem with the current stack.... NOT YET Implemented
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "BN_nist_mod_521" referenced by "/data/app/xx.xx-1/lib/arm/libsip.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at xx.xx.xx.PjSipService.tryToLoadStack(PjSipService.java:99)
at xx.xx.xx.SipService.loadStack(SipService.java:1050)
at xx.xx.xx.SipService.onStart(SipService.java:1011)
at android.app.Service.onStartCommand(Service.java:459)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3010)
at android.app.ActivityThread.-wrap17(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1442)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
AND
E/art: No implementation found for void org.pjsip.pjsua.pjsuaJNI.swig_module_init() (tried Java_org_pjsip_pjsua_pjsuaJNI_swig_1module_1init and Java_org_pjsip_pjsua_pjsuaJNI_swig_1module_1init__)
Can anyone guide me what to do?

An app using zbar library for scanning QR codes is getting crash.

I am trying to run the QR scanner app downloaded from
http://kvenkataprasad.blogspot.in/2015/01/bar-code-and-qr-code-scanner-example.html?showComment=1449051540990#c226949441944394510
App getting started but when I am clicking the scan button, the app get crashed.
Following the log of crash.
13239-13239/com.kvprasad.zbarbarcodescanner E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.kvprasad.zbarbarcodescanner, PID: 13239
java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/com.kvprasad.zbarbarcodescanner-1/lib/arm/libzbarjni.so: has text relocations
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at net.sourceforge.zbar.ImageScanner.<clinit>(Unknown Source)
at com.kvprasad.zbarbarcodescanner.BarcodeScanner.initControls(BarcodeScanner.java:52)
at com.kvprasad.zbarbarcodescanner.BarcodeScanner.onCreate(BarcodeScanner.java:42)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I am not getting the main issue behind crashing because I am a newbie in android. Please guide me to solve the problem.
Thanks.

Android Marshmallow Keystore SecurityException

I'm trying to implement functionality similar to Android Keystore Direct access. The code is making use of IPC and an exception is thrown when mRemote.transact was called (IKeystoreService.java line 54)
This works well on versions of Android before Marshmallow (API 23). I know the permissions model has changed since.
The exception is:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.activity.MainActivity}: java.lang.SecurityException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.SecurityException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:503)
at com.example.utilities.security.IKeystoreService$Stub$Proxy.test(IKeystoreService.java:55)
at com.example.utilities.security.KeyStoreKk.state(KeyStoreKk.java:93)
at com.example.utilities.security. Cryto.isPasswordPinEnabled(Cryto.java:198)
at com.example.activity.MainActivity.onCreate(MainActivity.java:65)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Is there a particular permission I need to check for during runtime? Or is this another problem altogether?

Categories

Resources