Flutter build with different flavours instantly crashes after starting - android

I have followed the official guide for creating different flavours of my Flutter application.
When I build either of the flavours on my emulator,
flutter build apk --flavor a -t lib/main-a.dart
flutter install
the app succesfully builds but instantly crashes on startup. I have looked at other solutions but none seem to work.
I checked if my package names are the same.
android/app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutterclient">
android/app/build.gradle
defaultConfig {
minSdkVersion 19
targetSdkVersion 27
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
flavorDimensions "app"
productFlavors {
a {
dimension "app"
applicationId "com.example.flutterclient"
versionCode 1
versionName "1.0"
}
b {
dimension "app"
applicationId "com.example.flutterclient"
versionCode 1
versionName "1.0"
}
}
app/src/main/java/com/example/flutterclient/MainActivity.java
package com.example.flutterclient;
I've tried flutter clean before building
Any help is appreciated!

Related

How to sync .so file with project in android studio?

I add .so file to app\src\main\jniLibs\libs directory as below:
app
...main
.......jniLibs
..............libs
..................armeabi
.........................libjsqlite.so
..................armeabi-v7a
.........................libjsqlite.so
..................x86
.........................libjsqlite.so
and after sync the project. But android studio doesn't know package from libjsqlite and couldn't import libraries to code. I tried different way at stackoverflow but I couldn't. Is there any useful way?
It's my project info:
compileSdk 31
defaultConfig {
applicationId "com.example.masterngo"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Thanks

Upgrading flutter android build tools

Flutter is building apk on android API level 29 by default I want to upgrade it to 30 how can I? I am new to flutter I don't know, I tried to google it but it wasn't helpful
Open a Flutter project in Android Studio and you have to edit the build.gradle file. In a flutter project, it is found at the path ./android/app/build.gradle
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.projectname"
minSdkVersion 19
targetSdkVersion 28 // Set this to 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Inspiration from this answer and modified accordingly

Getting package name conflict with different application ids of the same app

I have an app with two flavors, each with a unique application id, according to the docs this is how to install both versions of the app on the same phone. But I keep getting the package name conflict error while I try to install either of them while the other one is already installed
Flavor settings
defaultConfig {
applicationId "com.kc.mb.vr"
multiDexEnabled true
minSdkVersion 19
targetSdkVersion 26
versionCode 14
setProperty("archivesBaseName", "vr4.25.1")
}
flavorDimensions "default"
productFlavors {
dev {
versionName "4.25.1"
applicationId "com.kc.mb.vr.dev"
dimension "default"
}
prod {
applicationId "com.kc.mb.vr"
versionName "3.1.2"
dimension "default"
}
}
After installing, I checked with the package name viewer that shows the app with the dev flavor has a packagename + ".dev" and the one with prod has a different package name. But both of them can not be installed together.
Is there any step that I might have missed ?
For example,in your dev flavor,delete applicationId "com.kc.mb.vr" and add following code:
applicationIdSuffix ".dev"
then your dev's package name will be "com.kc.mb.vr.dev"

Android Studio Logcat Title Rename

In Android studio, I started a project with one name say "First Project" and later I renamed project as "Second Project", changed package name and everything to this new name but Logcat title (debugging process name ) shows previous process name as
com.example.app.first_project. I want it to be com.example.app.second_Project,
How do I achieve this, can someone help !!!
change build.gradle (Module: app) applicationId in defaultConfig:
defaultConfig {
applicationId "com.example.app.second_Project"
minSdkVersionhttps: 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Location of espresso test reports into files created dynamically

Currently, all my test reports are being created and stored in the folder 'test-reports' in the project root directory. Below is the gradle file, in which I have specified the directory under 'testOptions'.
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.edk1kor.decodedemov3"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testOptions{
reportDir "$rootDir/test-reports"
}
}
I want to create a new folder, each time a test is run. Is it possible to dynamically create a folder each time? If not via gradle code, via the android source code?

Categories

Resources