构建因使用不推荐的Android V1嵌入而失败

发布于 2025-01-22 15:26:19 字数 352 浏览 1 评论 0 原文

当试图在Android Studio中的pubspec.yaml中插入tflite插件时,我遇到了这个错误,这会导致构建如何解决此错误。

插件 tflite 使用Android嵌入的弃用版本。 为了避免意外的运行时故障或将来的构建故障,请尝试查看此插件是否支持Android V2嵌入。否则,考虑将其删除,因为 将来的扑来释放将消除这些弃用的API。 如果您是插件作者,请查看将插件迁移到v2嵌入的文档:

I got this error when trying to insert TFLite plugin in dependencies in pubspec.yaml in android studio which cause the build to fail how to fix this error.

The plugin tflite uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since
a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

早茶月光 2025-01-29 15:26:19
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"   
    package="com.example.debugbrains"> // change your package name here
    
   <application
        tools:replace="android:label"
        android:label="CONNECT"
        android:name="${applicationName}"
        android:icon="@mipmap/launcher_icon">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
           
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

//不要忘记更改应用程序的包装名称
//用上述代码替换AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"   
    package="com.example.debugbrains"> // change your package name here
    
   <application
        tools:replace="android:label"
        android:label="CONNECT"
        android:name="${applicationName}"
        android:icon="@mipmap/launcher_icon">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
           
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

// Don't forget to change the package name of your app
// Replace the androidManifest.xml with the above code

漫雪独思 2025-01-29 15:26:19

请尝试此 tflite_flutter 通过将此插件添加到您的pubspec.yaml文件

在此处输入图像描述

Please try this tflite_flutter by adding this plugin to your pubspec.yaml file

enter image description here

戒ㄋ 2025-01-29 15:26:19

您需要的只是在Android \ App \ Src \ Main \ AndroidManifest.xml文件中进行一些更改。

我已经回答了这个问题,您可以找到在这里

All you need is to do some changes in the android\app\src\main\AndroidManifest.xml file.

I already answered this question, you can find it here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文