无效缓存/重启...帮助我!
我在java类中的代码是:
Intent intent = new Intent(view.getActivity(), AddPaymentActivity.class);
view.getActivity().startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
AddPaymentActivity有kotlin extention .kt
Got error java.lang.NoClassDefFoundError
后端返回可以为空的Int? 我该如何写出可以为空的值?
date class Foo (var value: Int?){
constructor(source: Parcel) : this(
source.readInt()
)
override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeInt(value) // doesn't compile - writeInt expect no null value
}
}
Run Code Online (Sandbox Code Playgroud)
现在我得到解决方案:
dest.writeInt(value?: -1)
Run Code Online (Sandbox Code Playgroud)
然后检查-1
或者像字符串一样写Int然后使用值...
但我认为这是丑陋和错误的.
解决!我的答案:
source.readValue(Int::class.java.classLoader) as Int?,
dest.writeValue(value)
Run Code Online (Sandbox Code Playgroud) 更新后,Java 11通过命令在 Android Studio 中出现错误./gradlew lintFooDebug。
* What went wrong:\n\nExecution failed for task \xe2\x80\x98foo:syncDebugLibJars'.\n> NestMember requires ASM7\nRun Code Online (Sandbox Code Playgroud)\n\xe2\x80\xa2 然./gradlew dependencyReport。修复了所有asm版本7。
\xe2\x80\xa2 在文件内搜索 asm 文本 - 没有发现任何可疑的内容。
\n\xe2\x80\xa2 添加implementation "org.ow2.asm:asm:7.0"到所有build.gradle文件。万一。
\xe2\x80\xa2./gradlew lintFooDebug --scan使用scan标志运行以获取详细信息:
Caused by: java.lang.UnsupportedOperationException: NestMember requires ASM7 \nat org.objectweb.asm.ClassVisitor.visitNestMember(ClassVisitor.java:251) \n at org.objectweb.asm.ClassReader.accept(ClassReader.java:663) \n at org.objectweb.asm.ClassReader.accept(ClassReader.java:394) \n at com.android.builder.packaging.TypedefRemover.rewriteOuterClass(TypedefRemover.java:239) \n at com.android.builder.packaging.TypedefRemover.filter(TypedefRemover.java:139) \n at com.android.builder.packaging.JarFlinger.addDirectory(JarFlinger.java:107) \n …Run Code Online (Sandbox Code Playgroud)