小编Bad*_*hah的帖子

尝试启动未注册的 ActivityResultLauncher

有时我会收到此 IllegalStateException,它表示您必须确保在调用 launch() 之前注册 ActivityResultLauncher。但没有方法检查 ActivityResultLauncher 是否已注册。我该如何解决这个问题以及为什么会发生这种情况?另外,不清楚何时调用 unregister() 方法,有什么例子吗?

android android-activity onactivityresult

17
推荐指数
1
解决办法
1万
查看次数

找不到 com.android.tools.build:gradle:7.0.3

我有一个项目并且有 apk,但我更改了calculate.java 文件中的值,并且我想重建该项目。但出现以下错误。我应该怎么办?我不是 android studio 开发者,我只是一个新手。“找不到 com.android.tools.build:gradle:7.0.3。在以下位置搜索:

java android build gradle maven

8
推荐指数
1
解决办法
1万
查看次数

Spring boot 2.6.0 创建名为“webSecurityConfig”的 bean 时出错

我无法将我的 Spring Boot 应用程序从 2.5.7 更新到 2.6.0。它抛出以下错误。

2021-12-07T08:40:22,311 ERROR [restartedMain] o.s.b.SpringApplication.reportFailure:819|| Application run failed org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'webSecurityConfig': 
The requested bean is currently in creation: Is there an unresolvable circular reference?
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.beforeSingletonCreation(DefaultSingletonBeanRegistry.java:355)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:227)
Run Code Online (Sandbox Code Playgroud)

从 spring-boot 2.6.0 发行说明中可以清楚地看出,循环引用被禁用。并且可以通过属性重新启用它spring.main.allow-circular-references = true。但我想首先修复循环引用。谁能帮我解决这个问题?请找到下面的WebSecurityConfig类,

2021-12-07T08:40:22,311 ERROR [restartedMain] o.s.b.SpringApplication.reportFailure:819|| Application run failed org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'webSecurityConfig': 
The requested bean is currently in creation: Is there an unresolvable circular reference?
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.beforeSingletonCreation(DefaultSingletonBeanRegistry.java:355)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:227)
Run Code Online (Sandbox Code Playgroud)

我的代码是开源的,可以在 …

java spring-security spring-boot

8
推荐指数
1
解决办法
7259
查看次数

Android 语音识别自定义音频源

Android RecognizerIntent 文档指出

public static final String EXTRA_AUDIO_INJECT_SOURCE

Intent 中使用的额外关键是提供一个已打开的音频源供 RecognitionService 使用。数据应该是音频资源的 URI。

https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_AUDIO_INJECT_SOURCE

但没有关于此密钥的其他参考资料或用户文档。因此,尚不清楚此功能如何工作以及使用此密钥作为数据传递什么。

我尝试为 中的音频录制文件传递 Uri res/raw,但 Android 12 模拟器中的 SpeechRecognizer 忽略了该文件。

有人可以指出我如何在 SpeechRecognizer 中正确注入音频资源/源的正确方向吗?

android uri speech-to-text android-intent

6
推荐指数
0
解决办法
736
查看次数

应用印地语字体文件或其他语言字体文件时 FFmpeg 绘制文本问题

我们正在尝试使用 FFmpeg 绘制文本来支持印地语字体。但有些字符无法正确渲染。

\n

使用的印地语语言字体文件:- https://fonts.google.com/specimen/Khula

\n
Input string :- **\xe0\xa4\x9c\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa4\x97\xe0\xa5\x80 \xe0\xa4\xb8\xe0\xa4\xbf\xe0\xa4\xb0\xe0\xa5\x8d\xe0\xa4\xab \xe0\xa4\xb9\xe0\xa4\x95\xe0\xa5\x80\xe0\xa5\x98\xe0\xa4\xa4 \xe0\xa4\xb9\xe0\xa5\x88 \xe0\xa4\xb9\xe0\xa4\x95\xe0\xa5\x80\xe0\xa5\x98\xe0\xa4\xa4 \xe0\xa4\xb8\xe0\xa4\xae\xe0\xa4\x9d\xe0\xa5\x8b,**\n
Run Code Online (Sandbox Code Playgroud)\n

但输出呈现为\n代码输出

\n

我想要一些完美的解决方案来应用资产字体FFmpeg.

\n

先感谢您。

\n

ffmpeg custom-font android-ffmpeg mobile-ffmpeg

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

android - 面向 Android 12 及更高版本的应用需要为“android:exported”指定显式值

我已将 SDK 版本更新为 31,之后出现此错误。这是我的摇篮:

    android {
    compileSdkVersion 31

    defaultConfig {
        applicationId "com.persiandesigners.alldentshops"
        minSdkVersion 16
        targetSdkVersion 31
        vectorDrawables.useSupportLibrary = true
        versionCode 1
        versionName "1"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
    implementation 'androidx.cardview:cardview:1.0.0-alpha01'
    implementation 'com.google.android.material:material:1.2.0-alpha01'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
Run Code Online (Sandbox Code Playgroud)

我收到此错误:清单合并失败:需要显式指定 android:exported for 。android:exported当相应组件定义了意图过滤器时,面向 Android 12 及更高版本的应用需要指定显式值。有关详细信息,请参阅 https://developer.android.com/guide/topics/manifest/activity-element#exported。

我按照它说的做了,这是我的清单代码:

<activity
        android:name="mypackage.MainActivity"
        android:exported="true"
        tools:node="merge"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/SplashScreenTheme"
        android:windowSoftInputMode="stateAlwaysHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" …
Run Code Online (Sandbox Code Playgroud)

android android-manifest android-sdk-tools android-12

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

当我的应用程序在 Android 10/Q 上关闭时,如何触发启动 Activity 意图?

我正在尝试创建一个将在指定时间打开另一个应用程序的应用程序。为此,我使用了启动服务的 AlarmManager。如果我的应用程序在触发警报时打开,它就可以正常工作。我收到服务启动的通知,并且另一个应用程序打开。但是,如果我的应用程序在后台(按主页按钮后),并且警报触发,我会收到服务已启动的通知,但其他应用程序不会启动。我究竟做错了什么?我正在运行 API 级别 29 (Android 10/Q) 的 Pixel 3 模拟器上对此进行测试。

MainActivity.java

public class MainActivity extends AppCompatActivity {

    public static final int REQUEST_CODE=101;
    public static int aHour;
    public static int aMinute;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void setAlarm() {
        AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
        Intent intent = new Intent(this, amReceiver.class);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(this, REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(System.currentTimeMillis());
        calendar.set(Calendar.HOUR_OF_DAY, aHour);
        calendar.set(Calendar.MINUTE, aMinute);
        am.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
    }

    //Some code that sets aHour …
Run Code Online (Sandbox Code Playgroud)

java android android-intent android-service android-studio

2
推荐指数
1
解决办法
3517
查看次数