iota icon indicating copy to clipboard operation
iota copied to clipboard

Using `Id.generation` results in logcat spam: W ( 4072) ResourceType: No known package when getting name for resource number 0x7e00000b

Open pfn opened this issue 9 years ago • 3 comments

This is caused by accessibility trying to map the ID value back into a human readable name for the AccessibilityNodeInfo

Possible fixes and workarounds? Unknown.

pfn avatar Feb 02 '16 03:02 pfn

this is a workaround, but it interferes with protify

lazy val iotaIds = taskKey[Unit]("iota id to res XML converter")

iotaIds := {
  implicit val output = outputLayout.value
  val mergeTarget = projectLayout.value.generatedRes / "values" / "iota-public.xml"
  val resTarget = projectLayout.value.mergedRes / "values" / "iota-ids.xml"
  val lst = Keys.target.value / "iota" / "iota-ids-lst.txt"
  if (lst.exists) {
    FileFunction.cached(streams.value.cacheDirectory / "iota-ids", FilesInfo.lastModified) { in =>
      val elements = IO.readLines(in.head).map { line =>
        val Array(name, id) = line.split(" ")
        (f"""<public type="id" name="Id.$name" id="0x${id.toInt}%x"/>""",
        s"""<item type="id" name="Id.$name"/>""")
      }
      if (elements.isEmpty)
        resTarget.delete()
      else {
        val header =
          """<?xml version="1.0" encoding="utf-8"?>""" ::
            "<resources>" ::
            Nil
        val footer = "</resources>" :: Nil
        IO.writeLines(resTarget, header ++ elements.map(_._1) ++ footer)
        IO.writeLines(mergeTarget, header ++ elements.map(_._2) ++ footer)
      }
      Set(resTarget)
    }(Set(lst))
  }
}

collectResources <<= collectResources dependsOn iotaIds

pfn avatar Feb 02 '16 04:02 pfn

Additionally, first time packaging runs, the IDs will not be present in the resource packaging, and the errors will occur. Subsequent android:package will have the ID in packaging.

pfn avatar Feb 02 '16 05:02 pfn

This workaround above remains insufficient, further checks in ResourceTypes.cpp result in messages like the following:

02-01 21:23:30.646  26362-26362/com.hanhuy.android.irc.lite W/ResourceType﹕ For resource 0x7f0dfff4, entry index(65524) is beyond type entryCount(191)

pfn avatar Feb 02 '16 05:02 pfn