Very few supported devices of my Flutter app on PlayConsole - android

Its been a very fun adventure with Flutter so far and my app just got published in PlayStore but I have 2 problems
Its not visible on most devices
The supported devices is VERY FEW (25 only)
How do I increase the supported versions of Androids? Like from Jellybean to latest?
Its an ALPHA RELEASE
below is the image for reference
my APP-LEVEL build.gradle
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.hivemanila.syncshop_webview"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.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
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}

Related

Google Play: Bundle was not signed

I'm creating app in Kotlin and I paid Google developer account. But there is some problem with upload .aab file: The Android App Bundle was not signed. I readed all topics at Stackoverflow about it and tried all solutions. Not works for me.
signingConfig signingConfigs.release in build.gradle ends with this error: Could not get unknown property 'release' for SigningConfig. It works only when I set signingConfig. I'm using also this: minifyEnabled false and debuggable = false. So what another I must to try? There exists some new solution for year 2021?!
My build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId '...'
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.00"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders["hostName"] = "..."
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig
debuggable = false
}
applicationVariants.all{
variant ->
variant.outputs.each{
output->
def name = "...apk"
output.outputFileName = name
}
}
}
buildFeatures{
dataBinding = true
viewBinding = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'com.github.amitshekhariitbhu.Fast-Android-Networking:android-networking:v1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}
I had the same issue when I set "debuggable true" for release build type variant,
pls ensure "debuggable false" is set for release type.
buildTypes {
release {
minifyEnabled true
debuggable false
}
Step by step how to create signed aab file:
In the next window select Android App Bundle (aab)
Now you have to create your own signing key. If you want upload any update in the future, you must sign it with this signing key you created here.
Also every update you need to increment version in build.gradle(app).
Edit 1:
Change: signingConfig to: signingConfig signingConfigs.release and add this:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
The full code:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId '...'
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.00"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders["hostName"] = "..."
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
debuggable = false
}
applicationVariants.all{
variant ->
variant.outputs.each{
output->
def name = "...apk"
output.outputFileName = name
}
}
}
buildFeatures{
dataBinding = true
viewBinding = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'com.github.amitshekhariitbhu.Fast-Android-Networking:android-networking:v1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}
Edit 2:
I just uploaded the project aab to Google Play with this build.gradle(app):
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 31
defaultConfig {
applicationId "pfhb.damian.uploadtest"
minSdk 28
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
You have to create signing config release, Hope this will work. Let me know if you want to know how to create this block will be more happy to help you.
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'com.google.gms.google-services'
}
//repositories { maven { url 'https://maven.cashfree.com/release' } }
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.xyz.medicine"
minSdkVersion 27
targetSdkVersion 30
versionCode 4
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
// Please check if you have this block or not
signingConfigs {
release {
storeFile file('../secrets/keystore.jks')
storePassword 'DUMMYPASSWORD'
keyAlias 'DUMMYALIAS'
keyPassword 'DUMMYPASSWORD'
}
}
buildTypes {
release {
resValue "string", "BASE_URL", "https://obhaiyya.com/proMaid/"
shrinkResources true
minifyEnabled true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
shrinkResources false
minifyEnabled false
debuggable true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
buildFeatures {
dataBinding true
}
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-messaging-ktx:22.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "com.airbnb.android:lottie:3.7.1"
}

Unable to build : How to add Android Build Config for new Module

Now i am converting my android code to modularized architectural approach. Facing issues when trying add a dependency on "app" module from "chat" module.
I have the following build config for the "app" module.
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
signingConfigs {
companydevconfig {
keyAlias 'company'
keyPassword '123456'
storeFile file('../app/jksFils/company_dev.jks')
storePassword '123456'
}
companyqaconfig {
keyAlias 'company'
keyPassword '123456'
storeFile file('../app/jksFils/company_qa.jks')
storePassword '123456'
}
companyprodconfig {
keyAlias 'company'
keyPassword '123456'
storeFile file('../app/jksFils/release.keystore')
storePassword '123456'
}
}
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.company.employee.dev"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.13"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
aaptOptions {
cruncherEnabled = false
}
testOptions {
unitTests.returnDefaultValues = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/rxjava.properties'
}
flavorDimensions "company"
productFlavors {
dev {
dimension "company"
applicationId "com.company.employee.dev"
versionCode 277
versionName "2.0.0.16"
signingConfig signingConfigs.companydevconfig
buildConfigField 'String', 'BASEURL', '"https://dev.company.com"'
}
qa {
dimension "company"
applicationId "com.company.employee.qa"
versionCode 225
versionName "2.0.2.2"
signingConfig signingConfigs.companyqaconfig
buildConfigField 'String', 'BASEURL', '"https://qa.company.com"'
}
prod {
dimension "company"
applicationId "com.company.employee.prod"
versionCode 38
versionName "1.5.20"
signingConfig signingConfigs.companyprodconfig
buildConfigField 'String', 'BASEURL', '"https://cloud.company.com"'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests.returnDefaultValues = true
unitTests.all {
setIgnoreFailures(true)
jacoco {
includeNoLocationClasses = true
}
}
}
}
Now i have added a new module "chat". And it has following code in build config.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.company.employee.chat"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation project(':app')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
When i try to build i get following Error.
ERROR: Unable to resolve dependency for ':chat#debug/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#debugAndroidTest/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#debugUnitTest/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#release/compileClasspath': Could not resolve
project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#releaseUnitTest/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
Here are some things to consider
There are differences between App Module and Library Module.
Library Module is complied to .aar/file. However, App Module is Compiled to APK.
This means that you can not import App Module as dependency to Library Module. Therefore, Remove This line from Library Module:
implementation project(':app')
Make sure the library is listed at the top of your settings.gradle.
Open settings.gradle of the App Module and make sure there is your library listed
include ':app', ':chat'
import the Library Module to your App Module Build Gradle
import your Library Module as dependency
dependencies {
implementation project(':chat')
}
Most Importantly Have a look at :Create an Android library

Sign library before running Junit Android

I'm developing unit test using JUnit 4 on Android studio, but I need to sign the library before running tests to each function of the library to be accepted on my device. I'm trying the following:
build.gradle
android {
signingConfigs {
config {
keyAlias 'xxxxx'
keyPassword 'xxxxx'
storePassword 'xxxxxx'
storeFile file('cert/platform.jks')
}
}
compileSdkVersion 26
buildToolsVersion '26.0.2'
testBuildType "debug"
defaultConfig {
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.111"
externalNativeBuild {
cmake {
cppFlags "-fexceptions"
}
}
signingConfig signingConfigs.config
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
flavorDimensions "api"
productFlavors {
minApi17 {
dimension "api"
ndk.with {
moduleName = 'FAL'
abiFilters = ["armeabi"]
}
signingConfig signingConfigs.config
}
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
buildTypes {
debug {
signingConfig signingConfigs.config
}
release {
signingConfig signingConfigs.config
}
}
}
dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation files('libs/zxing-2.3.0.jar')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
I'm using this portion of code, but the application don't work in device (Certification error). What is the proper way to sign the application before running the test?
Click on Build -> Generate Signed APK -> Create new... -> add password, some credentials needed and click Next -> choose build type and flavors, check Signature Versions (check here: https://developer.android.com/about/versions/nougat/android-7.0.html#apk_signature_v2) but tl;dr -> choose V2.
This way you will generate dummy certificate which will sign your builds. Your gradle file will update automatically. If not than add:
signingConfigs {
config {
keyAlias 'KEY'
keyPassword 'PASSWORD'
storeFile file('../cert/fileName.jks')
storePassword 'STORE_PASSWORD'
}
to your gradle file.
It's good practice to store generated cert inside your project repo.

Gradle cannot find theme

I am trying to simply build a second module in my Android project. I have refered to another module, because there are some Activities and classes I want to reuse. This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "nl.minerall.sapphire.browser"
minSdkVersion 19
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
}
lintOptions {
disable "MissingTranslation"
checkReleaseBuilds false
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile project(path: ':sapphirelib')
compile project(path: ':app')
}
The build.gradle of sapphirelib is:
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile files('libs/simple-xml-2.7.1.jar')
compile project(path: ':Zebra_SDK_DS3678')
}
And of app:
apply plugin: 'com.android.application'
android {
signingConfigs {
demo {
keyAlias 'FlexDemo'
keyPassword '******'
storeFile file('/path/to/file.jks')
storePassword '******'
v2SigningEnabled false
}
full {
keyAlias 'PocketFull'
keyPassword '****'
storeFile file('/path/to/file.jks')
storePassword '*****'
v2SigningEnabled false
}
}
compileSdkVersion 19
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "nl.minerall.sapphire.pocket"
minSdkVersion 19
targetSdkVersion 19
}
productFlavors {
full {
applicationId "nl.minerall.sapphire.pocket.full"
signingConfig signingConfigs.full
resValue "string", "app_name", "Sapphire Pocket"
versionCode 13
versionName "Flex 2.0.25"
}
demo {
applicationId "nl.minerall.sapphire.pocket.demo"
signingConfig signingConfigs.demo
resValue "string", "app_name", "Pocket Demo"
versionCode 12
versionName "Flex 1.13 DEMO"
}
ipsdemo {
applicationId "nl.minerall.sapphire.pocket.ipsdemo"
signingConfig signingConfigs.demo
resValue "string", "app_name", "Pocket IPS Demo"
versionCode 12
versionName "Flex 1.13 IPS DEMO"
}
sourceSets.ipsdemo.root = "src/demo"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
}
lintOptions {
disable "MissingTranslation"
checkReleaseBuilds false
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile project(path: ':sapphirelib')
}
When I build, I get the error
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.NoActionBar'.
and I am thrown into a values-v21.xml file that is apparently auto-generated. The styles.xml I am using is:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
</resources>
It completely beats me where the android:Theme.Material.Light.NoActionBar comes from ...

Linkedin Sample demo not working

I am working to implement LinkedIn SDK into my application. I import the demo code and created the sample project on LinkedIn developer console. I also added required package name and hash. I got those two from the sample demo code.
But after adding this two when I try to run the application it always fire the below error.
{
"errorMessage":"either bundle id or packagename / hash are invalid,unknown, malformed"
"errorCode":"INVALID_REQUEST"
}
I cross checked several time for the hash and package name because this two are parameter we have to add into console.
Posible duplicate of this post. Problem is about your are not signing correctly the APK generated. Check your signingConfig in the build.gradle file.
allprojects {
repositories {
mavenCentral()
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
signingConfigs {
sdkTest {
storeFile file("debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
storeFile file("debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
buildTypes {
sdkTest {
signingConfig signingConfigs.sdkTest
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
compile project(':linkedin-sdk')
}
configurations {
}
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
}

Categories

Resources