小编ami*_*phy的帖子

Android AndroidManifest.xml错误:在包“ android”中找不到属性“ appComponentFactory”的资源标识符

今天,我正在尝试构建我的项目,但是构建失败,以下是日志:

    AGPBI: {"kind":"error","text":"No resource identifier found for attribute \u0027appComponentFactory\u0027 in package \u0027android\u0027","sources":[{"file":"xxxxx/app/build/intermediates/manifests/full/xxxxx/debug/AndroidManifest.xml","position":{"startLine":34}}],"original":"","tool":"AAPT"}
    xxxxx/app/build/intermediates/manifests/full/xxxxx/debug/AndroidManifest.xml:35: error: No resource identifier found for attribute 'appComponentFactory' in package 'android'
    Failed to execute aapt
    com.android.ide.common.process.ProcessException: Failed to execute aapt
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
        at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
 ....
        at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:822)
        at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:664)
        at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:48)
        at com.android.build.gradle.internal.process.GradleProcessExecutor$1.run(GradleProcessExecutor.java:58)
        at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:380)
        at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:46)
        ... 9 more
    :app:processxxxxxDebugResources FAILED
    FAILURE: Build failed with an exception.
    * What went …
Run Code Online (Sandbox Code Playgroud)

android android-manifest

5
推荐指数
0
解决办法
2249
查看次数

Android在谷歌付费中绘制自定义视图

缺口图像

这个问题已经被问到,这里已经接受了答案,但接受的答案并不是我想要的.我想使用一个自定义视图,其中缺口占用视图的宽度+一些边距,如上图中的付费图标.虽然寻找到它拥有一个晶圆厂像bottomappbar 这个 我看到了一个叫做类边缘治疗类我想这可以作为很好.我不会发布我的自定义视图代码,因为我可以绘制的是一个矩形.

java android android-custom-view android-layout kotlin

5
推荐指数
1
解决办法
340
查看次数

处理非英语Unicode(例如中文,日文)时,目标API 28中的EditText行间距行为不正确

我们注意到,在targetSdkVersion 28期间EditText,当输入非英语unicode(如中文,日语,...)时,输入后将趋于“稍微下推”该行。

当代码为targetSdkVersion 27或更低版​​本时,不会发生这种情况。


使用targetSdkVersion27,在模拟器API 28上运行

(在输入非英语unicode之前)

在此处输入图片说明

(输入非英文unicode后)

在此处输入图片说明

(确认间距确定)

在此处输入图片说明


使用targetSdkVersion28,在模拟器API 28上运行

(在输入非英语unicode之前)

在此处输入图片说明

(输入非英文unicode后)

在此处输入图片说明

(确认间距是​​有问题的。按下输入后的行)

在此处输入图片说明


这是我们使用的XML和代码。我们从继承androidx.appcompat.widget.AppCompatEditText,画线,使问题更加明显。

<com.yocto.wenote.note.LinedEditText
    android:id="@+id/body_edit_text"
    android:gravity="top"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:layout_marginBottom="12dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent"
    android:scrollbars="vertical"
    android:textSize="18sp"
    android:singleLine="false"
    android:lineSpacingMultiplier="1.4"
    android:inputType="textMultiLine|textCapSentences"
    android:textCursorDrawable="?attr/shorterCursor" />
Run Code Online (Sandbox Code Playgroud)

LinedEditText.java

package com.yocto.wenote.note;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.TypedValue;

import com.yocto.wenote.R;

/**
 * Created by yccheok on 24/3/2018.
 */

public class LinedEditText extends androidx.appcompat.widget.AppCompatEditText {
    private final Paint mPaint = new Paint();
    private int noteLineColor; …
Run Code Online (Sandbox Code Playgroud)

unicode android android-edittext

5
推荐指数
1
解决办法
366
查看次数

是否可以使用 iOS 和 Android 设备创建蓝牙网状网络

我目前正在构建一个应用程序,该应用程序创建了一个用户可以在网络上共享信息的平台,但我想创建一个离线选项,让用户在近距离时仍然可以在对等网络上进行通信。是否可以使用智能手机创建 BT 网状网络?

我已经看到蓝牙可以选择使用 BLE 创建网状网络,但是在研究 CoreBluetooth 之后,我找不到任何支持这种类型网络的东西。我已经看到了一些使用 iOS Multipeer 连接的解决方案,但如果可能的话,我最喜欢跨平台解决方案。

android ios core-bluetooth bluetooth-lowenergy

5
推荐指数
2
解决办法
3844
查看次数

OpenFileDialog 在超过 260 个字符的路径上返回空字符串(或根本不返回)

我正在编写一个程序,需要从系统上的任何地方读取文件。该程序的某些用户的路径超过 260 个字符的限制。在OpenFileDialog不使用文件超过260个字符的路径。

我试过同时使用System.Windows.Forms.OpenFileDialogMicrosoft.Win32.OpenFileDialog。对于前者,当我导航到并选择文件后单击“打开”时,窗口不会关闭,程序也不会继续。在后者的情况下,当我单击“打开”时窗口将关闭,但路径是一个空字符串。

我已经更新了我电脑上的注册表。我已经编辑了应用程序清单文件。我会尝试将“//?/”字符串添加到我的路径中,但没有要添加到的路径。

var dialog = new OpenFileDialog
{
  // initialize dialog
}

if (dialog.ShowDialog() == DialogResult.OK) // DialogResult.OK replaced with true if using Microsoft.Win32.OpenFileDialog
{
  // if when using System.Windows.Forms.OpenFileDialog, I will never get to this point
  // if using Microsoft.Win32.OpenFileDialog, I will get here but dialog.FileNames will be empty
}
Run Code Online (Sandbox Code Playgroud)

如果我更新了注册表和应用程序清单,我希望上面的代码在长路径和短路径下都能正常工作。我怀疑这只是不受支持,但我所有的搜索都表明人们提供的解决方案要么不起作用,要么仅适用于特定情况。

.net c# openfiledialog max-path

5
推荐指数
1
解决办法
306
查看次数

向上滑动以显示打开的应用程序时,iOS 中会显示默认的 Flutter 图标

我已经替换了我的 XCode runner 项目中的所有图标资产,包括 AppIcon 和 LaunchImage。但是,当我在 iOS 中向上滑动以显示打开的应用程序时,仍然会出现默认的颤动图标。是否还有其他地方需要查找使用默认图标的位置? 在此处输入图片说明

在此处输入图片说明

icons ios flutter

5
推荐指数
2
解决办法
954
查看次数

如何在 Kotlin 中将 MutableLiveData&lt;Boolean&gt;() 的值设置为不利?

_displayCheckBox是 a MutableLiveData<Boolean>,我希望将其设置为不利。

但似乎_displayCheckBox.value = !_displayCheckBox.value!! 不能很好地工作,我该如何解决?

代码 A

private val _displayCheckBox = MutableLiveData<Boolean>(true)
val displayCheckBox : LiveData<Boolean> = _displayCheckBox

fun switchCheckBox(){
    _displayCheckBox.value =  !_displayCheckBox.value!!   //It seems that it can't work well.
}
Run Code Online (Sandbox Code Playgroud)

android kotlin android-livedata

5
推荐指数
1
解决办法
1391
查看次数

在 Kotlin 中将值格式化为人类可读形式的依赖性

我正在 android studio 中用 Kotlin 创建一个应用程序。我想在我的应用程序中显示值,这样如果数字很长,比如说数百万或数十亿,它会截断它并用后缀显示它,例如K(thousand) M(million)

例如:如果值为331330464,则显示为331.3 M

是否存在允许我进行此格式化的依赖项?

android number-formatting kotlin android-studio

5
推荐指数
1
解决办法
522
查看次数

LiveData 或 DataBinding Observer

我在我的Android应用程序中使用MVVM,在视图模型我有很多观察员(从数据绑定)一样ObservableBooleanObservableField我看了,我可以使用LiveData/MutableLiveData,而不是这个观察家...有什么区别?我可以用LiveData/MutableLiveData?

例如:

代替:

val loading: ObservableBoolean = ObservableBoolean()
Run Code Online (Sandbox Code Playgroud)

经过:

val loading: MutableLiveData<Boolean> = MutableLiveData()
Run Code Online (Sandbox Code Playgroud)

android android-livedata

4
推荐指数
1
解决办法
1482
查看次数

Android使用Flow时房间查询为空

Flow我对使用withRoom进行数据库访问感到困惑。我希望能够观察表的变化,同时也可以直接访问它。但是,当使用返回 a 的查询时Flow,结果似乎总是这样null,尽管表不为空。直接返回 a 的查询List似乎有效。

有人可以解释其中的差异或告诉我我可能错过了文档的哪一部分吗?

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        db_button.setOnClickListener {
            val user_dao = UserDatabase.getInstance(this).userDatabaseDao

            lifecycleScope.launch {
                user_dao.insertState(State(step=4))

                val states = user_dao.getAllState().asLiveData().value
                if (states == null || states.isEmpty()) {
                    println("null")
                } else {
                    val s = states.first().step
                    println("step $s")
                }

                val direct = user_dao.getStatesDirect().first().step
                println("direct step $direct")
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)
@Entity(tableName = "state")
data class State(
    @PrimaryKey(autoGenerate = true)
    var id: …
Run Code Online (Sandbox Code Playgroud)

android android-room android-livedata

4
推荐指数
1
解决办法
1551
查看次数