Hi guys i have an error in the flutter project that I cloned from GitHub. I tried this method but it didn't work
<application
android:name="io.flutter.app.FlutterApplication"
To :
<application
android:name="${applicationName}"
can anyone help?
error:
AndroidManifest.xml:
CodePudding user response:
Add the following code in android manifest after activity
<meta-data
android:name="flutterEmbedding"
android:value="2" />
In project build.gradle add the following code in buildscript
ext.kotlin_version = '1.6.10'
And change gradle version in gradle-wrapper.properties
My manifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.stackoverflowexample">
<application
android:label="stackoverflowexample"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<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">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<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>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
CodePudding user response:
Add below lines in AndroidManifest.xml
file
<meta-data
android:name="flutterEmbedding"
android:value="2" />
For more details : https://docs.flutter.dev/release/breaking-changes/android-v1-embedding-create-deprecation
CodePudding user response:
It may sound like a fake solution, but indeed, the easiest way to resolve this is:
- Delete the
android
folder. - Run
flutter create .
The command will recreate the android
folder with the already migrated code. Also, the command will create folders for the other stable platforms (e.g. web, windows), so you could ignore those and just delete them or trigger the flutter create
command by defining android - flutter create --platforms=android .
.