hyperledger-archives / iroha-android

Android library for Iroha, a Distributed Ledger Technology (blockchain) platform.
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
107 stars 59 forks source link

*.proto files structure different with README - No implementation found for long jp.co.soramitsu.iroha.android.irohaJNI.new_ModelCrypto() #140

Closed truongnmt closed 6 years ago

truongnmt commented 6 years ago

I'm implement Iroha into my Android project with the first way:

implementation 'jp.co.soramitsu.iroha.android:iroha-android-bindings:+'

But where to copy *.proto files from? From this repo: iroha-android-sample/src/main/proto ?

Copy the latest version of *.proto files from develop branch of Iroha [repository] into app/src/main/proto/ folder inside your project in Android Studio.

Also the *.proto files structure in README is different from iroha-android-sample/src/main/proto structure.

Also on include *.proto from iroha-android-sample/src/main/proto I got this error:

E/htruong.irohat: No implementation found for long jp.co.soramitsu.iroha.android.irohaJNI.new_ModelCrypto() (tried Java_jp_co_soramitsu_iroha_android_irohaJNI_new_1ModelCrypto and Java_jp_co_soramitsu_iroha_android_irohaJNI_new_1ModelCrypto__)
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.nguyenmanhtruong.irohatx, PID: 3476
                  java.lang.UnsatisfiedLinkError: No implementation found for long jp.co.soramitsu.iroha.android.irohaJNI.new_ModelCrypto() (tried Java_jp_co_soramitsu_iroha_android_irohaJNI_new_1ModelCrypto and Java_jp_co_soramitsu_iroha_android_irohaJNI_new_1ModelCrypto__)
                      at jp.co.soramitsu.iroha.android.irohaJNI.new_ModelCrypto(Native Method)
                      at jp.co.soramitsu.iroha.android.ModelCrypto.<init>(ModelCrypto.java:51)
                      at com.example.nguyenmanhtruong.irohatx.IrohaConnection.<init>(IrohaConnection.kt:16)
                      at com.example.nguyenmanhtruong.irohatx.MainActivity.onCreate(MainActivity.kt:13)
                      at android.app.Activity.performCreate(Activity.java:7136)
                      at android.app.Activity.performCreate(Activity.java:7127)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
                      at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
                      at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
                      at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
                      at android.os.Handler.dispatchMessage(Handler.java:106)
                      at android.os.Looper.loop(Looper.java:193)
                      at android.app.ActivityThread.main(ActivityThread.java:6669)
                      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)
truongnmt commented 6 years ago

Get it worked. NVM! Forgot to add library:

companion object {
    init {
        System.loadLibrary("irohajava")
    }
}