简体   繁体   English

尝试将 amazon mturk SDK 实现到 android studio 项目时出错

[英]Error when trying to implement amazon mturk SDK into android studio project

I am trying to implement Amazon's mechanical turk into my android app.我正在尝试将亚马逊的机械土耳其人实施到我的 android 应用程序中。 I have followed the instructions: http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMechanicalTurkGettingStartedGuide/CreatingAHIT.html#Java but when I am specifying the third party .jar files, it gives me我已按照说明进行操作: http : //docs.aws.amazon.com/AWSMechTurk/latest/AWSMechanicalTurkGettingStartedGuide/CreatingAHIT.html#Java但是当我指定第三方 .jar 文件时,它给了我

Error:Gradle: Execution failed for task ':app:dexDebug'.错误:Gradle:任务 ':app:dexDebug' 执行失败。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1 com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command'/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java''完成非零退出值 1

I have tried taking out every combination of .jar files and found out that jaxrpc.jar is the file causing this error.我尝试取出 .jar 文件的每个组合,发现 jaxrpc.jar 是导致此错误的文件。 Without this file, the error when running the project is:没有这个文件,运行项目时的错误是:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/ServiceException
    at com.example.mturk.HomeworkRequest.<init>(HomeworkRequest.java:20)
    at com.example.mturk.HomeworkRequest.main(HomeworkRequest.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at ...

where line 20 points to:其中第 20 行指向:

service = new RequesterService(new PropertiesClientConfig("../mturk.properties"));

and line 39 points to:第 39 行指向:

HomeworkRequest app = new HomeworkRequest();

I have tried enabling multiDex and looked around but couldn't find any solution.我尝试启用 multiDex 并环顾四周,但找不到任何解决方案。 Any help would be greatly appreciated, I have been stuck on this problem for a few days now.任何帮助将不胜感激,我已经被这个问题困住了几天。

EDIT: Here's my code so far.编辑:到目前为止,这是我的代码。 It's just a simple HIT request similar to the sample in http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMechanicalTurkGettingStartedGuide/CreatingAHIT.html#Java这只是一个简单的 HIT 请求,类似于http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMechanicalTurkGettingStartedGuide/CreatingAHIT.html#Java 中的示例

import com.amazonaws.mturk.requester.HIT;
import com.amazonaws.mturk.service.axis.RequesterService;
import com.amazonaws.mturk.service.exception.ServiceException;
import com.amazonaws.mturk.util.PropertiesClientConfig;

public class HomeworkRequest{

private RequesterService service;
private String title= "Math Question";
private String description = "Solve the math question shown";
private int numAssignments = 3;
private double reward = 0.05;

public HomeworkRequest(){
    service = new RequesterService(new PropertiesClientConfig("../mturk.properties"));
}

public void createHomeworkRequest(){
    try {
        HIT hit = service.createHIT(
                title, description, reward, RequesterService.getBasicFreeTextQuestion(
                        "Can you solve this math question?"), numAssignments);

        System.out.println("Created HIT: " + hit.getHITId());
        System.out.println("HIT location: ");
        System.out.println(service.getWebsiteURL() + "/mturk/preview?groupId=" + hit.getHITTypeId());
    }
    catch(ServiceException e) {
        System.err.println(e.getLocalizedMessage());
    }
}

public static void main(String[] args){
    HomeworkRequest app = new HomeworkRequest();
    app.createHomeworkRequest();
}
}

If you look at step 1 of using the MTurk Java SDK, you need to include SDK Installation Directory]\\lib\\third-party in your classpath .如果您查看使用 MTurk Java SDK 的第 1 步,您需要在classpath包含SDK Installation Directory]\\lib\\third-party

Your inability to find third-party jars such as JaxB seems to suggest that your IDE is facing issues finding necessary jars to build.您无法找到诸如 JaxB 之类的第三方 jar 似乎表明您的 IDE 在寻找必要的 jar 来构建时遇到了问题。

Please let us know if you are still facing difficulties.如果您仍然面临困难,请告诉我们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试构建项目时android studio中出现错误 - Error in android studio when trying to build the project 尝试在Android Studio 2.2.1中运行新项目时出错 - Getting error when trying to run new project in Android Studio 2.2.1 尝试复制和重建项目时出现 Android Studio 错误 - Android Studio error when trying to copy and rebuild project 尝试将Android项目导入Android Studio错误 - Trying to import a android project into Android studio error 尝试在Android Studio中实现getSharedPreferences时出现“无法解决方法”错误 - Getting “cannot resolve method” error when trying to implement getSharedPreferences in Android Studio 尝试在 Android 工作室中实现 tensorflow lite model 时,我收到不兼容的数据类型错误 - When trying to implement tensorflow lite model in Android studio I am getting an incompatible data types error 将Facebook SDK添加到android项目时出错 - Error when Facebook sdk Added into android project 尝试在 Android Studio 上实现 RapidApi - Trying to implement RapidApi on Android Studio 尝试启动 Android Studio 时出现 JDK 错误 - JDK error when trying to start Android Studio 尝试将Firebase添加到Android Studio项目,但它不会添加(app:processDebugGoogleServices Error) - Trying to add Firebase to Android Studio Project, but It Will not Add (app:processDebugGoogleServices Error)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM