内容丰富的产品目录错误

时间:2015-10-23 20:00:38

标签: android json sqlite android-studio contentful

我已下载此CONTENTFUL CMS产品目录演示 - > https://github.com/contentful/product-catalogue-android。我正在使用android studio 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";
  }

My Android Studio project error screenshot

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

谢谢。

1 个答案:

答案 0 :(得分:0)

你好,来自Contentful的Mario,

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

这也需要在Contentful-WebUI中创建的所有其他ContentTypes完成。

相关问题