Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Bounty 0.01 btc. Android demo app bug #51

Closed
UkolovaOlga opened this issue Jan 23, 2021 · 18 comments
Closed

Bounty 0.01 btc. Android demo app bug #51

UkolovaOlga opened this issue Jan 23, 2021 · 18 comments
Labels
bounty Bounty is established for solving this issue bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@UkolovaOlga
Copy link
Member

UkolovaOlga commented Jan 23, 2021

Originally reported by @Jasonvdb here #47

Steps to reproduce:

  • Used these instructions to build the artifacts on ubuntu using docker.
  • Copied artifacts/android/library-debug.aar into demo/android/app/libs/
  • Open /demo/android in Android Studio and build project

Error message

E/DemoApp: Error loading 'rgb' library: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSt12length_errorD1Ev" referenced by "/data/app/~~LN6GpR4dsQOH6xN0_cqfNA==/org.lnpbp.demoapp-1eB-I4WLe5-ims5tw7RtTA==/lib/x86/librgb.so"...
E/g.lnpbp.demoap: No implementation found for long org.lnpbp.rgb_autogen.rgbJNI.rgb_node_run(java.lang.String, java.lang.String, java.lang.String, short) (tried Java_org_lnpbp_rgb_1autogen_rgbJNI_rgb_1node_1run and Java_org_lnpbp_rgb_1autogen_rgbJNI_rgb_1node_1run__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2S)

Possible cause of the bug
libc++_shared is not part of the APK, while present in the aar produced from bindings.
With static lib it can't find a function from libc++_shared. The library is included into the .aar file, so DemoApp gradle due to some reason does not include it into the resulting apk.

Attempts to fix the bug
#48

Contribution terms

  1. Anyone can take over this task, fix it, test it and create a PR.
  2. The PR should be assigned to @dr-orlovsky for review.
  3. After the PR is approved and merged, you'll get a bounty of 0.01btc!

For more details feel free to reach out to @UkolovaOlga on telegram (@dr_ukolova) or drop a message in IRC channel (#lnp-bp @freenode).

@UkolovaOlga UkolovaOlga added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed bounty Bounty is established for solving this issue labels Jan 23, 2021
@05nelsonm
Copy link

05nelsonm commented Jan 24, 2021

Copy the .so file into app/src/main/jniLibs/mySharedLib.so instead of libs

Alternatively, use Android Studio to create a new module of type 'import .jar/.aar', then in your app/build.gradle file's dependencies block add

implementation project(path: ":mymodule")

As a PR cannot fix the issue (steps are being performed manually).

See https://donate.matthewnelson.io to send reward

@dr-orlovsky
Copy link
Member

Thank you for the suggestions!

As a PR cannot fix the issue (steps are being performed manually).

Can you pls clarify what do you mean by this? The repo is automated with docker containers, it has READMEs, plus it is possible to modify gradle files. The bounty concept is to get the task solved by a PRs, not to get others work on it and get a full reward - since without an actual PR the reward must be split between you and those who will do the PR and show that the solution works (and had found which of the possible solutions had actually worked).

@dr-orlovsky dr-orlovsky added this to the v0.2 milestone Jan 24, 2021
@05nelsonm
Copy link

05nelsonm commented Jan 24, 2021

The steps to produce the issue are to manually copy the compiled .aar into the libs folder. As those steps are performed manually, a PR cannot be made to fix the issue due to the issue not being in the code base, but in the steps of importing the compiled native shared library.

I would strongly advise against merging a PR for a fix to this issue, too, as the PR would be one of compiling the binaries and simply adding a module to import the produced .aar properly. The potential for malicious code injection is present as the docker build is not setup to be reproducable making it impossible to verify the build, and I would definitely want someone on your team to compile the binaries.

@dr-orlovsky
Copy link
Member

Not sure I understand why the situation you described applies. This is the script that should be modified according to your first suggestion https://github.com/rgb-org/rgb-sdk/blob/master/bindings/android/build_rust.sh#L21

BTW, as you can see a correct jniLibs path is already used there and it's not working.

As for the second suggestion, nothing prevents from doing PR with creating that additional project inside the repo and providing instructions to replicate successful build in the README, if manual .so copying is required.

The solution should be a PR such that the app that will run on the simulator when doing git clone from the PR branch. And it was the way it worked before with this repo, without any trust (all builds happens within the Docker container, which produces .aar file, not .so)

@alexeyneu
Copy link

alexeyneu commented Feb 2, 2021

тут вопрос на самом деле в другом. Что вот эта штука /lib/x86/librgb.so делает в андройд сборке?

@UkolovaOlga
Copy link
Member Author

Communication in our repos is held in English, so please respect our rules and use English language for your comments.

@alexeyneu
Copy link

Screenshot_2021-02-02_07-38-10

@UkolovaOlga with all respect i don't understand what are you waiting for

@alexeyneu
Copy link

do you have the same?

@alexeyneu
Copy link

looks like i've fixed stuff you're talking about. lady hurry up a little bit please , we're talking about money here. i can make pr right now , and here's firebase report

java.lang.UnsatisfiedLinkError: No implementation found for long org.lnpbp.rgb_autogen.rgbJNI.rgb_node_run(java.lang.String, java.lang.String, java.lang.String, short) (tried Java_org_lnpbp_rgb_1autogen_rgbJNI_rgb_1node_1run and Java_org_lnpbp_rgb_1autogen_rgbJNI_rgb_1node_1run__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2S)
     FATAL EXCEPTION: main
Process: org.lnpbp.demoapp, PID: 14402
java.lang.UnsatisfiedLinkError: No implementation found for long org.lnpbp.rgb_autogen.rgbJNI.rgb_node_run(java.lang.String, java.lang.String, java.lang.String, short) (tried Java_org_lnpbp_rgb_1autogen_rgbJNI_rgb_1node_1run and Java_org_lnpbp_rgb_1autogen_rgbJNI_rgb_1node_1run__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2S)
	at org.lnpbp.rgb_autogen.rgbJNI.rgb_node_run(Native Method)
	at org.lnpbp.rgb_autogen.rgb.rgb_node_run(rgb.java:57)
	at org.lnpbp.rgb.Runtime.<init>(Runtime.java:24)
	at org.lnpbp.demoapp.DemoApp.onCreate(DemoApp.java:32)
	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5920)
	at android.app.ActivityThread.access$1100(ActivityThread.java:200)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:6718)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

looks like you also forgot to init/load a library, but it's a different story.

@UkolovaOlga
Copy link
Member Author

UkolovaOlga commented Feb 2, 2021

PR should be submitted and then it will be reviewed, as pointed out in the initial issue description.
BTC will be handed out only if and only after the PR is successfully merged. If there are several participants, the bounty will be shared between them. Firebase report is not the reason for making any payments.

@alexeyneu
Copy link

i didn't say it is. It's about that the app will still not work after you merge the pr. ok

@UkolovaOlga
Copy link
Member Author

If the PR does not solve the described problem, no bounty will be paid (which is a pretty logical consequence).

alexeyneu added a commit to alexeyneu/rgb-sdk that referenced this issue Feb 2, 2021
alexeyneu added a commit to alexeyneu/rgb-sdk that referenced this issue Feb 2, 2021
@alexeyneu
Copy link

alexeyneu commented Feb 3, 2021

last error turns out to be simple:

02-02 05:29:44.085: I/DemoApp(14402): Loading 'rgb_node' library
02-02 05:29:44.087: E/DemoApp(14402): Error loading 'rgb_node' library: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.lnpbp.demoapp-lexB-eH2G5vuS57FUplgeA==/base.apk"],nativeLibraryDirectories=[/data/app/org.lnpbp.demoapp-lexB-eH2G5vuS57FUplgeA==/lib/arm64, /data/app/org.lnpbp.demoapp-lexB-eH2G5vuS57FUplgeA==/base.apk!/lib/arm64-v8a, /system/lib64]]] couldn't find "librgb_node.so"

firebase log : https://storage.cloud.google.com/test-lab-bh6m4ri6pd042-nc4s0m5341qcz/web-build_2021-02-02T13%3A25%3A47.518Z_3xm9/walleye-28-en_US-portrait/logcat

and really i do not see it too.

https://github.com/rgb-org/rgb-sdk/blob/0e48b493252b6af68678c9696329a3b75f5f4c83/demo/android/app/src/main/java/org/lnpbp/demoapp/DemoApp.java#L22-L25

UkolovaOlga added a commit to LNP-BP/devcalls that referenced this issue Feb 3, 2021
Agenda:
1. Brief demo of RGB working with real-life software (Bitcoin Pro tool and WIP on MyCitadel wallet that are being developed by Pandora Core).
2. Proposal to create standards that would cover the ways to visually represent the client-side functionality that is not a part of Core RGB Library and protocol.
3. Technical update on the progress.
4. RGB workflow diagram RGB-WG/FAQ#1
5. Android bounty bug RGB-WG/rgb-sdk#51
6. Other bugs and issues raised by the core dev team and external contributors.
alexeyneu added a commit to alexeyneu/rgb-sdk that referenced this issue Feb 5, 2021
@alexeyneu
Copy link

alexeyneu commented Feb 5, 2021

so issue is fixed now. you should see libc++_shared in demo apk because now it's linked properly. it was optimized out before by android ndk(android studio one) .And it was so for a reason.
Screenshot from 2021-02-05 16-14-56

side notes:
given that you can setup your second library this way , link this one to it and then include both into .aar package. after that your app should work

do not use underscore in jni lib names

https://libcxx.llvm.org/docs/UsingLibcxx.html

@alexeyneu
Copy link

alexeyneu commented Feb 5, 2021

https://github.com/alexeyneu/rgb-sdk/tree/test
here i have app ready for android studio compilation with .aar included . you can compile it in studio right away and check lib presence in apk. Also you can unpack the .aar and check library with readelf -d to compare it to yours one. stuff is on the test branch of my repo so you can clone it then do git checkout -b test . you might be faster on that, really,

@dr-orlovsky
Copy link
Member

dr-orlovsky commented Feb 6, 2021

+ 20806 files? 20 thousand new files after the checkout? Are you joking?

@dr-orlovsky
Copy link
Member

dr-orlovsky commented Feb 6, 2021

And sorry, I do not need the presence of the library in the .aar. It was already there. I need the app launching and running. Please stop wasting my time and spamming until you get the solution ready.

@alexeyneu
Copy link

@dr-orlovsky good luck. see you soon

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bounty Bounty is established for solving this issue bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
No open projects
Development

No branches or pull requests

4 participants