【问题标题】:Watson Conversation autogenerate Android app - 'Unknown pattern character 'X''Watson Conversation 自动生成 Android 应用程序 - '未知模式字符'X''
【发布时间】:2017-09-04 02:23:39
【问题描述】:

我正在使用来自 IBM Watson Mobile App 的自动生成示例,但是当我尝试运行它时,它在以下代码部分中显示错误。我在 SO 周围发现了类似的错误,但我认为这是另一个不同的错误。

public ServiceCall<MessageResponse> message(String workspaceId, MessageRequest request) {
Validator.isTrue((workspaceId != null) && !workspaceId.isEmpty(), "'workspaceId' cannot be null or empty");

RequestBuilder builder = RequestBuilder.post(String.format(PATH_MESSAGE, workspaceId));
builder.query(VERSION_PARAM, versionDate);
if (request != null) {
  //the error shows here
  builder.bodyJson(GsonSingleton.getGson().toJsonTree(request).getAsJsonObject());
} else {
  builder.bodyJson(new JsonObject());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(MessageResponse.class));
}

以下是我的 build.gradle 文件:

apply plugin:'base'
apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.ibm.watson_conversation"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        manifestPlaceholders = ['appIdRedirectScheme': android.defaultConfig.applicationId]
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        warning 'InvalidPackage'
        abortOnError false
    }
}

dependencies {
    compile ('com.ibm.mobilefirstplatform.clientsdk.android:core:[2.0.0,3.0.0)')
    compile 'com.ibm.watson.developer_cloud:conversation:3.8.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
}

【问题讨论】:

    标签: android json ibm-cloud watson-conversation


    【解决方案1】:

    该问题已在 3.9.0 中修复。

    你只需要将依赖版本更新为3.9.1

    compile 'com.ibm.watson.developer_cloud:conversation:3.9.1'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-07
      • 1970-01-01
      • 1970-01-01
      • 2017-11-19
      • 1970-01-01
      相关资源
      最近更新 更多