我下载了 libs 中所有的 jar 包,在 Android 项目中添加对应的依赖,并按照 wiki 中提及的测试代码去获取图片中的信息,但运行的时候就报出这个 NoClassDefFoundError
I downloaded all the jar packages in libs, added the corresponding dependencies to the Android project, and followed the test code mentioned in the wiki to get the information in the picture, but this NoClassDefFoundError was reported when I ran it.
class CameraActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val inputStream = assets.open("test.jpg")
val metadataMap = Metadata.readMetadata(inputStream)
for (entry in metadataMap) {
if (entry.value is XMP) {
val iterator = entry.value.iterator()
while (iterator.hasNext()) {
val item = iterator.next()
printMetadata(item, "", " ")
}
}
}
}
private fun printMetadata(
entry: MetadataEntry,
indent: String,
increment: String
) {
var ind = indent
log(ind + entry.key + if (entry.value.isNullOrEmpty()) "" else ": " + entry.value)
if (entry.isMetadataEntryGroup) {
ind += increment
val entries = entry.metadataEntries
for (e in entries) {
printMetadata(e, ind, increment)
}
}
}
}
我下载了 libs 中所有的 jar 包,在 Android 项目中添加对应的依赖,并按照 wiki 中提及的测试代码去获取图片中的信息,但运行的时候就报出这个 NoClassDefFoundError I downloaded all the jar packages in libs, added the corresponding dependencies to the Android project, and followed the test code mentioned in the wiki to get the information in the picture, but this NoClassDefFoundError was reported when I ran it.