0

商业论文教程中有一个关于 java 的应用程序,它运行良好。现在,我尝试使用 Android Studio 作为教程来实现。

我修改了一些行以在模拟器上启动并尽可能遵循 pom.xml 来获取依赖项。但是当我使用Issue.javaAddToWallet.java类时org.hyperledger.fabric发生错误(最后完全错误,对于问题应用程序):

Gateway.Builder builder = Gateway.createBuilder();通过GatewayImpl.javaDefaultCommitHandlers.java:70发出调用传递

在类DefaultCommitHandlers上有Peer,错误开始的地方:

  • import org.hyperledger.fabric.sdk.Peer;

  • private static final EnumSet<Peer.PeerRole> EVENT_SOURCE_ROLES = EnumSet.of(Peer.PeerRole.EVENT_SOURCE);

这是什么意思?我该如何纠正?

完全错误:

    Process: iti.pap.ch.pap_test, PID: 9364
    java.lang.NoClassDefFoundError: Failed resolution of: Lorg/hyperledger/fabric/sdk/Peer$PeerRole;
        at org.hyperledger.fabric.gateway.DefaultCommitHandlers.<clinit>(DefaultCommitHandlers.java:70)
        at org.hyperledger.fabric.gateway.impl.GatewayImpl$Builder.<init>(GatewayImpl.java:67)
        at org.hyperledger.fabric.gateway.Gateway.createBuilder(Gateway.java:87)
        at iti.pap.ch.pap_test.Issue.main(Issue.java:41)
        at iti.pap.ch.pap_test.MainActivity$1.onClick(MainActivity.java:29)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.access$3100(View.java:778)
        at android.view.View$PerformClick.run(View.java:25885)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        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)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.hyperledger.fabric.sdk.Peer$PeerRole" on path: DexPathList[[zip file "/data/app/iti.pap.ch.pap_test-CLJRfC7j75Bhy3VebuP5kg==/base.apk"],nativeLibraryDirectories=[/data/app/iti.pap.ch.pap_test-CLJRfC7j75Bhy3VebuP5kg==/lib/x86, /system/lib]]```
4

1 回答 1

0

这个依赖应该提供它:

implementation "org.hyperledger.fabric:fabric-gateway-java:2.1.0"

如果该类在运行时未知,请禁用混淆 - 或为其编写适当的配置。

于 2020-06-15T12:48:40.283 回答