我正在创建一个自定义,Checkbox其中Surface有Modifier.clickable:
Surface(
modifier = Modifier
.clickable(
enabled = enabled,
interactionSource = interactionSource,
indication = rememberRipple(),
role = Role.Checkbox,
onClick = { onCheckedChange(!checked) }
)
.then(modifier),
) {
Row {
Checkbox(checked = checked, onCheckedChange = {}, colors = colors)
Text(text = text ?: "")
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试构建它时,我收到错误Exception during IR lowering error:
org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /home/rene/AndroidStudioProjects/pass13/app/src/main/java/com/aresid/simplepasswordgeneratorapp/ui/widgets/Checkbox.kt
Run Code Online (Sandbox Code Playgroud)
请参阅此处的完整堆栈跟踪。
删除Modifier.clickable可以解决构建问题。
我已经尝试过升级/降级某些版本,但没有任何东西可以正常工作。
目前,我正在使用这些版本:
ext.versions = [ …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,用户可以使用隐式意图 ACTION_OPEN_DOCUMENT_TREE 选择一个目录来创建 Excel 文件。但是,返回的 UrionActivityResult()不能被 使用FileOutputStream()。它抛出一个FileNotFoundException:
java.io.FileNotFoundException: content:/com.android.externalstorage.documents/tree/home%3A:test.xlsx (No such file or directory)
Run Code Online (Sandbox Code Playgroud)
在onActivityResult()我检查路径是否存在File.exists(),如果不存在,我想创建一个新的 Excel 文件。
onActivityResult():
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
Log.d(TAG, "onActivityResult: called");
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK && requestCode == 2) {
Log.d(TAG, "onActivityResult: path = " + data.getData()
.getPath());
Uri treePath = data.getData();
File path = new File(treePath + File.pathSeparator + "test.xlsx");
if (path.exists()) {
updateExistingExcelFile(path);
} …Run Code Online (Sandbox Code Playgroud) 我正在使用TextInputLayout,TextInputEditTextAndroid Lint 总是警告我调用toString()可能getText()会产生NullPointerException.
就我个人而言,我从来没有遇到过 NPE 这样做过,即使是在TextInputEditText空的时候也是如此。
我记得读到返回值只能null在创建视图或类似的地方时出现。
简单地忽略 Lint 警告是否安全,还是应该检查以防null万一?
我有一个重试策略,它接受 lambda,启动 a CoroutineScope,增加重试计数器,检查是否达到最大重试次数,waitTime根据重试计数计算 a ,延迟这次的范围,最后调用 lambda:
fun connectionRetryPolicy(block: () -> Unit) {
Timber.d("connectionRetryPolicy: called")
// Launch the coroutine to wait for a specific delay
val scope = CoroutineScope(Job() + Dispatchers.Main)
scope.launch {
// Get and increment the current retry counter
val counter = retryCounter.getAndIncrement()
// Check if the counter is smaller than the maximum retry count and if so, wait a bit and execute the given function
if (counter < maxRetry) {
// Calculate the time …Run Code Online (Sandbox Code Playgroud) 该build.gradle (app)文件包含应用程序的keystore位置和密码。所以我想知道,我是否应该将它们包含在公共 GitHub 存储库中?
我的猜测是“不”,如果是这样,我该如何解决这个问题?我可以以某种方式审查它,还是应该简单地不在提交中包含这些文件?
如果我应该将它们从提交中保留,我该如何解决拉动项目的问题,因为文件会丢失?