1

我已经下载了这个 CONTENTFUL CMS 产品目录演示 -> https://github.com/contentful/product-catalogue-android。我使用的是安卓工作室 1.4。我已经在 const.java 中相应地设置了公共令牌 ID,但它仍然出现错误。起初我想也许我在 content_type 字段设置中设置了错误的设置。但我仍然找不到我的解决方案。我的错误如下所示,并附上图片供您查看,

10-23 18:56:18.820 2094-2147/catalogue.contentful E/SQLiteLog: (1) no such table: entry_nulundg0rwhzuvm0suntyxvdzufjrq
 (1) no such table: entry_ne90ogm2rdjxuxfnb2fvs2dzbtgysw

这是来自我的内容“产品”的 JSON 语句:content_type

{
  "name": "Product",
  "description": "",
  "displayField": "productName",
  "fields": [
    {
      "name": "productName",
      "id": "productName",
      "type": "Symbol",
      "localized": false,
      "validations": []
    },
    {
      "name": "productDescription",
      "id": "productDescription",
      "type": "Symbol",
      "localized": false,
      "validations": []
    },
    {
      "name": "sizetypecolor",
      "id": "sizetypecolor",
      "type": "Symbol"
    },
    {
      "name": "images",
      "id": "images",
      "type": "Array",
      "items": {
        "type": "Link",
        "linkType": "Asset",
        "validations": []
      },
      "validations": []
    },
    {
      "name": "categories",
      "id": "categories",
      "type": "Link",
      "linkType": "Entry",
      "validations": [
        {
          "linkContentType": [
            "5In484EhYQS4ICSauCeAcE"
          ]
        }
      ]
    },
    {
      "name": "tags",
      "id": "tags",
      "type": "Array",
      "items": {
        "type": "Symbol",
        "validations": []
      },
      "validations": []
    },
    {
      "name": "price",
      "id": "price",
      "type": "Number",
      "validations": []
    },
    {
      "name": "brand",
      "id": "brand",
      "type": "Link",
      "linkType": "Entry",
      "validations": [
        {
          "linkContentType": [
            "5gTQW9EcAwEYEc42WGgaEu"
          ]
        }
      ]
    },
    {
      "name": "quantity",
      "id": "quantity",
      "type": "Integer",
      "localized": false,
      "validations": []
    },
    {
      "name": "sku",
      "id": "sku",
      "type": "Symbol",
      "localized": false,
      "validations": []
    },
    {
      "name": "website",
      "id": "website",
      "type": "Symbol",
      "localized": false,
      "validations": []
    }
  ],
  "sys": {
    "id": "4Ot8c6D2qQqgoaUKgYm82K",
    "type": "ContentType",
    "createdAt": "2015-10-23T13:04:54.705Z",
    "createdBy": {
      "sys": {
        "type": "Link",
        "linkType": "User",
        "id": "2P70I7YlhYLnC0iOpPYYwN"
      }
    },
    "space": {
      "sys": {
        "type": "Link",
        "linkType": "Space",
        "id": "b7di2z8ukacn"
      }
    },
    "firstPublishedAt": "2015-10-23T13:04:59.904Z",
    "publishedCounter": 17,
    "publishedAt": "2015-10-23T17:33:41.088Z",
    "publishedBy": {
      "sys": {
        "type": "Link",
        "linkType": "User",
        "id": "2P70I7YlhYLnC0iOpPYYwN"
      }
    },
    "publishedVersion": 41,
    "version": 42,
    "updatedAt": "2015-10-23T17:33:41.107Z",
    "updatedBy": {
      "sys": {
        "type": "Link",
        "linkType": "User",
        "id": "2P70I7YlhYLnC0iOpPYYwN"
      }
    }
  }
}

这是我的 Android Studio 编码

  public Product$$ModelHelper() {
    fields.add(FieldMeta.builder().setId("productName").setName("name").setSqliteType("STRING").build());
    fields.add(FieldMeta.builder().setId("productDescription").setName("description").setSqliteType("STRING").build());
    fields.add(FieldMeta.builder().setId("sizetypecolor").setName("sizeTypeColor").setSqliteType("STRING").build());
    fields.add(FieldMeta.builder().setId("image").setName("images").setArrayType("com.contentful.vault.Asset").build());
    fields.add(FieldMeta.builder().setId("tags").setName("tags").setSqliteType("BLOB").setArrayType("java.lang.String").build());
    fields.add(FieldMeta.builder().setId("categories").setName("categories").setArrayType("catalogue.contentful.vault.Category").build());
    fields.add(FieldMeta.builder().setId("price").setName("price").setSqliteType("DOUBLE").build());
    fields.add(FieldMeta.builder().setId("brand").setName("brand").setLinkType("ENTRY").build());
    fields.add(FieldMeta.builder().setId("quantity").setName("quantity").setSqliteType("INT").build());
    fields.add(FieldMeta.builder().setId("sku").setName("sku").setSqliteType("STRING").build());
    fields.add(FieldMeta.builder().setId("website").setName("website").setSqliteType("STRING").build());
  }

  @Override
  public List<FieldMeta> getFields() {
    return fields;
  }

  @Override
  public String getTableName() {
    return "entry_ne90ogm2rdjxuxfnb2fvs2dzbtgysw";
  }

我的 Android Studio 项目报错截图

如果有人能帮助我解决这个问题,我真的很感激。因为这个应用程序是一个演示,我真的认为我的问题出在我的 CONTENTFUL 设置上,但也许我需要第二个意见。请帮忙。

谢谢你。

4

1 回答 1

0

你好,来自 Contentful 的马里奥,

正如我从您提供的代码中看到的那样,似乎您更改了生成的类。您可以尝试更改Product.java使用提供的注释vault来创建与您的数据匹配的产品吗?

这也需要与ContentTypes您在 Contentful-WebUI 中创建的所有其他内容一起完成。

于 2015-12-15T10:00:13.737 回答