Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI - android

On android 7 everything works perfectly, but on android 12 it shows this error(in title). I've tried multiple solutions. None of them works.
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.0, on Microsoft Windows [Version 10.0.19045.2364], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices
(Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.6)
[√] Android Studio (version 2021.3)
[√] IntelliJ IDEA Community Edition (version 2022.3)
[√] Connected device (4 available)
[√] HTTP Host Availability
• No issues found!
Tried solution 2 and updated my build.gradle file (did not work) still show error (in title)
build.gradle file
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
// compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 33
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.botwrite.botwrite"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
// default // minSdkVersion flutter.minSdkVersion
minSdkVersion 26
// targetSdkVersion flutter.targetSdkVersion
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.multidex:multidex:2.0.1"
}
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.botwrite.botwrite">
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.ACCESS_INTERNET"/>
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
<action android:name="TextToSpeech.Engine.INTENT_ACTION_TTS_SERVICE" />
</intent>
</queries>
<application
android:label="botwrite"
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>
My pubspec.yaml file
name: botwrite
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=2.19.0 <3.0.0'
dependencies:
build_runner: ^2.3.3
carousel_slider: ^4.2.1
cloud_firestore: ^4.3.1
connectivity_plus: ^3.0.2
cupertino_icons: ^1.0.5
dropdown_button2: ^1.9.2
email_validator: ^2.1.17
firebase_auth: ^4.2.5
firebase_core: ^2.4.1
flutter:
sdk: flutter
# flutter_launcher_icons: ^0.11.0
flutter_native_splash: ^2.2.17
flutter_riverpod: ^2.1.3
flutter_spinkit: ^5.1.0
flutter_svg: ^1.1.6
flutter_tts: ^3.6.3
go_router: ^6.0.1
google_fonts: ^3.0.1
http: ^0.13.5
isar: ^3.0.5
isar_flutter_libs: ^3.0.5
isar_generator: ^3.0.5
path_provider: ^2.0.12
permission_handler: ^10.2.0
salomon_bottom_bar: ^3.3.1
string_validator: ^0.3.0
dev_dependencies:
change_app_package_name: ^1.1.0
flutter_lints: ^2.0.0
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/
- assets/images/
- assets/images/homepagecarouselimages/
- assets/images/testimonials/profile/
- assets/avatars/
- assets/icons/
- assets/logo/
# this is for the launcher icon
flutter_icons:
android: true
image_path: "assets/logo/botlogo.png"
min_sdk_android: 21 # android min sdk min:16, default 21
flutter_native_splash:
color: "#ffffff"
image: assets/splash.png
# run this command if splash doesn't work on android 12
# flutter pub run flutter_native_splash:create
android_12:
color: "#ffffff"
image: assets/splash.png
full debug console error
Launching lib\main.dart on V2061 in debug mode...
lib\main.dart:1
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install D:\projects\flutter_projects\MVCs\botwrite\build\app\outputs\flutter-apk\app-debug.apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl2112444397.tmp/base.apk (at Binary XML file line #23): intent tag may have at most one action.]
Error launching application on V2061.
Solutions I've tried
https://stackoverflow.com/a/67916122/20302196 (android:exported="true" is already there) (most of the solutions say this)
https://stackoverflow.com/a/75055556/20302196
https://github.com/firebase/flutterfire/issues/8254#issue-1165223518 (see pubspec file for packages info)
https://stackoverflow.com/a/48628738/20302196 (I've double checked names none of them are capital)
https://github.com/firebase/flutterfire/issues/8254#issuecomment-1065104827 (see pubspec)
Google play says to not use package name like this "com.example.appname" so I updated my app's package name to this "com.botwrite.botwrite" using change_app_package_name from pub.dev and then it changed it in different files i.e AndroidManifest, MainActivity, and some other places. I'm mentioning this as some solutions say changing package names sometimes cause this problem.
https://pub.dev/packages/change_app_package_name
I'll be grateful if you'll explain what causes this problem, so that I can address this specifically.

You are getting error because of two action tags inside an intent tag.
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
<action android:name="TextToSpeech.Engine.INTENT_ACTION_TTS_SERVICE" />
</intent>
</queries>
Official Android documentation says that inside intent tag,
You must include exactly one <action> element.
Read more,
https://developer.android.com/training/package-visibility/declaring#intent-filter-signature

Related

white screen crash/hang at startup in my production release flutter app

hope you all healthy. little problem aroused in my flutter app. i have released flutter apk on play store. it was working fine. after some change i published updated version of my app. now on some users' phone app stuck/hang at startup showing only white screen. it works fine on debug and fat releasae apk's. I tried most upvoted suggestion/issue but no success:
github issue
flutter app stuck on white screen
my android/build.gradle file:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
my app/build.gradle file:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "tm.com.getirtm"
minSdkVersion 21 //
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" //
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:26.4.0')
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.android.support:multidex:1.0.3'
androidTestImplementation 'com.android.support.test:runner:1.0.2' //
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' //
}
my AndroidManifest.xml file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="smth.com.example">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:name=".Application"
android:label="SomeApp"
android:icon="#mipmap/ic_launcher"
android:requestLegacyExternalStorage="true">
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#mipmap/ic_launcher" />
<activity
android:name=".MainActivity"
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"
android:allowBackup="false"
android:fullBackupOnly="false">
<!-- 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"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</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>
my pubcpec.yaml file:
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.1.8+32
environment:
sdk: ">=2.10.5 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
auto_size_text: ^2.1.0
back_button_interceptor: ^2.0.2
cached_network_image: ^2.5.0
cloud_firestore: ^0.13.5
conditional_builder: ^1.0.2
cupertino_icons: any
datetime_picker_formfield: ^1.0.0
device_info: ^1.0.0
dio: ^3.0.10
equatable: ^1.2.6
firebase_messaging: ^6.0.16
firebase_storage: ^3.1.6
flare_splash_screen: ^3.0.1
flutter_images_slider: ^0.0.2
flutter_secure_storage: ^3.3.5
flutter_slidable: ^0.5.7
flutter_webview_plugin: ^0.3.11
image_picker: ^0.6.7+22
launch_review: ^2.0.0
mask_text_input_formatter: ^1.2.1
package_info: ^0.4.3+4
path_provider: ^1.6.27
photo_view: ^0.10.3
provider: ^4.0.0
pull_to_refresh: ^1.6.4
sentry_flutter: ^4.0.4
shared_preferences: ^0.5.12+4
sqflite: ^1.3.0+1
url_launcher: ^5.7.10
rxdart: ^0.25.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.8.1
flutter_icons:
ios: true
android: true
image_path_ios: "assets/images/launcher/app_icon.png"
image_path_android: "assets/images/android_launcher/app_icon.png"
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/logo.flr
- assets/images/logo.png
- assets/images/g.flr
- assets/images/empty.png
- assets/images/logo_text.png
- assets/images/revenue.png
- assets/images/down.png
- assets/images/up.png
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
my flutter doctor:
[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.19041.746], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.53.2)
[!] Connected device
! No devices available
Just update this block:
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
}
}
Not sure if it's build-tools update; I'd rather assume it lacks R8 configuration rules.

Flutter Android app "Unable to instantiate activity"

I build my app as a "release" build (with signing and all) to publish it to PlayStore. I get a lot of crash reports from the "Pre-launch report" within PlayStore which all look like this:
Crash java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.domain/com.domain.MainActivity}: java.lang.ClassNotFoundException: Didn't find
class "com.domain.MainActivity" on path: DexPathList[[zip file "/data/app/com.domain-1/base.apk", zip
file "/data/app/com.domain-1/split_config.arm64_v8a.apk", zip file "/data/app/com.domain-
1/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/com.domain-1/lib/arm64,
/data/app/com.domain-1/base.apk!/lib/arm64-v8a, /data/app/com.domain-
1/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/com.domain-
1/split_config.xxhdpi.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
The build process, however, worked as expected without any failure. Also, the debug build and split-by-abi build is working without any problems or crashes.
This is the folder structure of the Android app (Originally I used another folder structure "app/main/kotlin/com/domain/MainActivity.kt" but with the same result):
This is the gradle.build which is on the androids folder level:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') {
reader -> localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
logger.info("DEBUG - FLUTTER ROOT: " + flutterRoot)
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
/*
task clean(type: Delete) {
delete rootProject.buildDir
}
*/
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
packagingOptions {
exclude ("META-INF/shared_core_release.kotlin_module")
}
defaultConfig {
applicationId "com.domain"
minSdkVersion 25
targetSdkVersion 28
compileSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
minifyEnabled true
signingConfig signingConfigs.release
sourceSets {
main {
manifest.srcFile 'app/src/main/AndroidManifest.xml'
res.srcDirs = ['app/src/main/res']
}
}
}
}
}
flutter {
source '..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
And this is the referenced AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.domain">
<application
android:name="io.flutter.app.FlutterApplication"
android:label="App"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
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">
<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>
<!-- omitted -->
</manifest>
This is the content of app/src/main/kotlin/com.domain/MainActivity.kt:
package com.domain
import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(#NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
This is the excerpt from flutter doctor:
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18362.900], locale de-DE)
• Flutter version 1.17.5 at C:\flutter
• Framework revision 8af6b2f038 (9 days ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\xxx\AppData\Local\Android\Sdk
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = C:\Users\xxx\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit visit
https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] IntelliJ IDEA Ultimate Edition (version 2019.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.4
• Flutter plugin version 44.0.3
• Dart plugin version 193.6911.31
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
Any help would be highly welcome to resolve this problem.
EDIT #1:
After turning off modification, it seems that the com.domain.MainActivity is not present in the dex.
But I don't understand why it's not included.
I was finally able to resolve the problem to some extend.
After trying all the solutions offered as comments (non of them working) I created a brand new project and copied over the parts that I assumed might cause the problem to try to replicate the problem.
After nothing worked (nothing broke the build or the app for the new project) I copied over everything and just adapt the newly created project. From what I can see, there are no changes and even GIT does not find any remarkable changes.
It's now working even if the solution for this is far behind what I'd hoped for. As there are also no remarkable changes in the project, I can not contribute with deeper insights or what might have caused the problem.

My specific Flutter project has problem with some packages

I have a specific flutter project that has error on some packages i added like the following:
on image_picker package issue - when running ImagePicker.pickImage:
Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker)
on url_launcher package issue - when running canLaunch(url):
Unhandled Exception: MissingPluginException(No implementation found for method canLaunch on channel plugins.flutter.io/url_launcher)
on plaid package issue:
Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: plugins.flutter.io/webview
Note:
I have tried to import those packages on my previous projects on the same machine, and it works just fine.
Tested this project to build iOS and it works fine so the problem most likely is on android build.
Done flutter clean, flutter upgrade, uninstall/reinstall app on device, tested on other android device/emulator but doesn't solved the problem.
Tried to run both on Android Studio and VS Code, but still gives the same error.
changed to flutter stable channel, and Still got no luck.
flutter doctor -v
[√] Flutter (Channel master, v1.16.4-pre.69, on Microsoft Windows [Version 10.0.18362.720], locale en-US)
• Flutter version 1.16.4-pre.69 at C:\Flutter\flutter
• Framework revision 19e7db585d (5 days ago), 2020-04-01 11:16:01 -0700
• Engine revision c9506cb8e9
• Dart version 2.8.0 (build 2.8.0-dev.18.0 eea9717938)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\mikay\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.43.2)
• VS Code at C:\Users\mikay\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1
[√] Connected device (1 available)
• Samsung Galaxy S8 • 192.168.175.101:5555 • android-x86 • Android 9 (API 28)
• No issues found!
pubspec.yaml
version: 1.0.0+1
environment:
sdk: '>=2.6.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
relative_scale: ^1.0.5
rxdart: ^0.23.1
flutter_signin_button: ^1.0.0
dio: ^3.0.9
pretty_dio_logger: ^1.1.1
firebase_core: ^0.4.4+3
firebase_auth: ^0.15.5+3
cloud_firestore: ^0.13.4+2
firebase_messaging: ^6.0.13
flutter_facebook_login: ^3.0.0
shared_preferences: ^0.5.6+3
flushbar: ^1.10.0
url_launcher: ^5.4.2
intl: ^0.16.1
flutter_advanced_networkimage: ^0.7.0
image_picker: ^0.6.4
decimal: ^0.3.0
plaid: ^1.0.2
webview_flutter: ^0.3.19+9
dev_dependencies:
flutter_test:
sdk: flutter
build.gradle(app)
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.app.example"
minSdkVersion 20
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.android.support:multidex:1.0.3'
}
build.gradle (project-level)
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Found the solution. The reason is that I added the flutter_facebook_login and did not do its additonal setup which is to add this code on AndroidManifest.xml:
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
thus, It mess up all packages that initiate an external views like camera, file manager, web view, etc..

Adding firebase_messaging Plugin to flutter project on android stops app from launching with no error

I'm developing a flutter app with most of it done except for the push notification. When adding the firebase_messaging plugin in the pubspec.yaml and follow the setup process for android, the app stops launching with out giving any error. Just keeps on waiting to finish installation.
App migrated to android x from the start of development and other firebase plugins in use and working fine.Tested on different physical devices and emulator all with same issue. flutter clean run every time before build.
I'm sure there is something wrong with the setup or a conflict with another plugin but no error is being given.
pubspec.yaml
environment:
sdk: ">=2.2.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
#cupertino_icons: ^0.1.2
http: ^0.12.0+1
#shared_preferences: ^0.5.1+1
rxdart: ^0.21.0
carousel_slider: ^1.1.0
google_maps_flutter: ^0.4.0
url_launcher: ^5.0.2
firebase_core: ^0.3.1+1
firebase_auth: ^0.8.3
firebase_dynamic_links: ^0.2.1
flutter_secure_storage: ^3.2.1+1
corsac_jwt: ^0.1.2
intl_translation: ^0.17.4
connectivity: ^0.4.3+1
flutter_svg: ^0.13.0+2
#flutter_statusbarcolor: ^0.1.0
google_sign_in: ^4.0.1+3
flutter_facebook_login: ^2.0.0
country_code_picker: ^1.1.5
webview_flutter: ^0.3.7+1
#permission_handler: '^3.1.0'
#notification_permissions: ^0.3.1
auto_size_text: ^1.1.2
launch_review: ^1.0.1
qr_flutter: ^2.0.0
geolocator: '^5.0.0'
flare_flutter: ^1.5.2
package_info: ^0.4.0+4
pin_code_text_field: ^1.3.6
meta: ^1.1.6
platform: ^2.2.0
firebase_messaging: ^5.1.0
dev_dependencies:
flutter_launcher_icons: 0.6.1
flutter_test:
sdk: flutter
/android/build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
// classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '/build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
/android/app/build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '19'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '2.0.17'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "app.flutter.test"
minSdkVersion 18
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
//// for relases
//release {
// signingConfig signingConfigs.release
// minifyEnabled true
// useProguard true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//}
//// for debugging
release{
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// implementation 'com.google.firebase:firebase-messaging:18.0.0'
}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
terminal output
Launching lib/main.dart on ONE A2001 in debug mode...
Initializing gradle... 0.6s
Resolving dependencies... 3.5s
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 20.2s
Built android\build\app\outputs\apk\debug\app-debug.apk.
Installing android\build\app\outputs\apk\app.apk... 28.7s
flutter doctor -v (the only issue of android license it never and it shouldn't effect)
[√] Flutter (Channel stable, v1.7.8+hotfix.3, on Microsoft Windows [Version 10.0.17763.557], locale en-GB)
• Flutter version 1.7.8+hotfix.3 at C:\Users\ricardo\flutter
• Framework revision b712a172f9 (2 days ago), 2019-07-09 13:14:38 -0700
• Engine revision 54ad777fd2
• Dart version 2.4.0
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\ricardo\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 37.0.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] VS Code (version 1.35.1)
• VS Code at C:\Users\ricardo\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.2.0
[√] Connected device (1 available)
• ONE A2001 • 47fc4070 • android-arm64 • Android 6.0.1 (API 23)
! Doctor found issues in 1 category.
You try
run flutter doctor - android-licenses to make an android license. There is one problem there.
Lastest version firebase_messaging 5.1.0
Firebase Messaging Example this is an example of implementation if there is an error in your code
I hope this helps

Error -32601 received from application: Method not found , Flutter Upgrade issue in Android

After upgrading the flutter , when i build my app i started getting following error:
Execution failed for task ':app:processDebugManifest'. [ +5 ms] >
Manifest merger failed : Attribute
meta-data#android.support.VERSION#value value=(25.4.0) from
[com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
[ +23 ms] is also present at
[com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35
value=(26.1.0). [ +8 ms] Suggestion: add
'tools:replace="android:value"' to element at
AndroidManifest.xml:26:9-28:38 to override.
As explained in add 'tools:replace="Android:value"' to <meta-data> element at AndroidManifest and
Android: Getting "Manifest merger failed" error after updating to a new version of gradle SO answers i added the
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.4.0'
}
}
}
}
to my app folder build.gradle :
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.yourcompany.chatapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.4.0'
}
}
}
}
apply plugin: 'com.google.gms.google-services'
Now whenever i run my app i get the following Error :
Error -32601 received from application: Method not found
I have tried by running flutter clean, the error still persists.
Here is output of flutter doctor :
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.3.1, on Microsoft Windows [Version 10.0.16299.371], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.0-rc1)
[√] Android Studio (version 3.1)
[√] Connected devices (1 available)
• No issues found!
I Found out that the original issue :
Execution failed for task ':app:processDebugManifest'. [ +5 ms] >
Manifest merger failed : Attribute
meta-data#android.support.VERSION#value value=(25.4.0) from
[com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
[ +23 ms] is also present at [com.android.support:support-v4:26.1.0]
AndroidManifest.xml:28:13-35 value=(26.1.0). [ +8 ms] Suggestion: add
'tools:replace="android:value"' to element at
AndroidManifest.xml:26:9-28:38 to override.
Might have been due to older firebase packages dependencies.
My initial pubspec.yaml dependencies looked something like :
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.0
contact_picker: ^0.0.2
connectivity: ^0.3.0
image_picker: 0.1.1
google_sign_in: 0.3.1
firebase_analytics: 0.0.4
firebase_auth: 0.2.0
firebase_database: 0.0.1
firebase_storage: 0.0.5
firebase_messaging: 0.2.5
If i update the pubspec.yaml as below :
cupertino_icons: ^0.1.0
contact_picker: ^0.0.2
connectivity: ^0.3.0
image_picker: ^0.4.1
google_sign_in: ^3.0.3
firebase_analytics: ^0.3.3
firebase_auth: ^0.5.7
firebase_database: ^0.4.6
firebase_storage: ^0.3.3
firebase_messaging: ^0.2.5
There is no Manifest merger failed in first place hence no changes needed in build.gradle file.
I am not sure how the Manifest merger failed is linked to other firebase packages, however after this solution the build is working fine, and there are no Manifest merger failed or Error -32601 received from application: Method not found error.
Just experienced that same error and can confirm that it was a Firestore package dependency error. I was attempting to update to 0.12.11 when I received the error binding to the service failed.
The solution was to go back to 0.12.10 Firestore plugin and that resolved the issue

Categories

Resources