Israa Ezzat
Israa Ezzat

Reputation: 3

Build failed due to use of deprecated Android v1 embedding

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.

Upvotes: 0

Views: 12946

Answers (3)

Abdeldjalil Chougui
Abdeldjalil Chougui

Reputation: 814

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.

Upvotes: 0

Rad
Rad

Reputation: 11

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

enter image description here

Upvotes: 1

Vinamra Jaiswal
Vinamra Jaiswal

Reputation: 709

<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

Upvotes: 1

Related Questions