firebase messaging from minSdkVersion error on android with flutter - android

When I debug on android I get the error regarding minSdkVersion.
I tried adding:
android {│
defaultConfig {
minSdkVersion 19
}
}
in the build.gradle file but it didn't work. Also I added:
flutter.minSdkVersion = 21
flutter.targetSdkVersion = 30
flutter.compileSdkVersion = 30
in the local.properties file but that also didn't work

Add this to the build.gradle
defaultConfig {
minSdkVersion 21
multiDexEnabled true
}
and
dependencies {
...
implementation 'com.android.support:multidex:1.0.3'
}

Related

use a compatible library with a minSdk of at most 16

Hi I am trying to build detox to test my app. I am facing compatibility issue. My app runs with android versions 21 to 31. I get the below error when I run the command "yarn detox build -c android"
Error:
Task :react-native-midnight:processDebugAndroidTestManifest FAILED [androidx.vectordrawable:vectordrawable-animated:1.0.0]
/Users/user/.gradle/caches/transforms-2/files-2.1/5677f0d1d2fd33816116c626e2dd87f1/vectordrawable-animated-1.0.0/AndroidManifest.xml
Warning:
Package name 'androidx.vectordrawable' used in: androidx.vectordrawable:vectordrawable-animated:1.0.0,
androidx.vectordrawable:vectordrawable:1.0.1.
/Users/user/projects/MyWorkspaceapp/node_modules/react-native-midnight/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger10963475594834660155.xml:5:5-74
Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.65.2]
/Users/user/.gradle/caches/transforms-2/files-2.1/b7e25968130290bea6922f5b0f7f24b0/jetified-react-native-0.65.2/AndroidManifest.xml
as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.facebook.react" to force usage (may lead to runtime failures)
See http://g.co/androidstudio/manifest-merger for more information
about the manifest merger.
build.gradle:
ext {
compileSdkVersion = 31
targetSdkVersion = 31
minSdkVersion = 21
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
// buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion 21
targetSdkVersion 31
multiDexEnabled true
}
}
AndroidManifest.xml
> <uses-sdk android:minSdkVersion="21"
> android:targetSdkVersion="31"
> android:maxSdkVersion="31"
> tools:overrideLibrary="com.facebook.react" />
Add the below line in build.gradle. It works
subprojects {
ext {
compileSdk = rootProject.ext.compileSdkVersion
minSdk = rootProject.ext.minSdkVersion
targetSdk = rootProject.ext.targetSdkVersion
}
afterEvaluate { subproject ->
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
}
}
}
}

Deleting cache did not solve Error:create service of type TaskArtifactStateRepository

Building this App.
I got the following error and tried solutions for deleting chache and .gradle files folder, but it is not solved.
Error:Could not create service of type TaskArtifactStateRepository using TaskExecutionServices.createTaskArtifactStateRepository().
> Unexpected lock protocol found in lock file. Expected 3, found 0.
build.gradle file(tried with tools version 26.~ too):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "edu.cmu.sphinx.pocketsphinx"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.1"
}
}
dependencies {
implementation project(':aars')
implementation project(':models')
implementation 'com.android.support:appcompat-v7:27.1.1'
}

Cannot get property 'compileSdkVersion' on extra properties extension as it does not exist Open File

I imported a project downloaded from GitHub into my Android Studio project as module.
The "Import module..." wizard worked fine, but when the Adroid Studio tried to rebuild the project, it returned me this error:
Cannot get property 'compileSdkVersion' on extra properties extension as it does not exist Open File
The error is related to this line in the "build.gradle" file of the imported module:
compileSdkVersion rootProject.compileSdkVersion
I tried to add "ext" section in the project "build.gradle" like this:
ext {
compileSdkVersion 26
}
But in this way I receive a new error:
Gradle DSL method not found: 'compileSdkVersion()' Possible causes: ...
In your top-level file use:
ext {
compileSdkVersion = 26
}
In your module/build.gradle file use:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
...
}
Another way:
Your build.gradle in top-level module
ext {
minSdk = 21
targetSdk = 29
compileSdk = 29
buildTools = '29.0.3'
}
Your build.gradle in app module
android {
def buildConfig = rootProject.extensions.getByName("ext")
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
defaultConfig {
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk
}
// ...
}
In build.gradle you need to write compilesdkversion under android tag as in this example:
android {
..
compileSdkVersion 26 // 26 is an example
..}
By the way. You can build that module as library then import it into your project as .aar file.
Change your .gradle android part to this
android {
compileSdkVersion 26
defaultConfig {
applicationId "your App id"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

Installation failed since app's minSdkVersion is newer than device's API level

Here is my gradle settings.
ext {
android_compile_version = 26
android_version = '26.0.1'
android_min_sdk_version =15
appcompat_library_version = '25.2.0'
support_library_version = '25.2.0'
gms_library_version = '11.0.4'
}
this is define in my project.gradle file and
apply plugin: 'com.android.application'
android {
compileSdkVersion android_compile_version
buildToolsVersion android_version
defaultConfig {
applicationId "com.xxasda.stickman"
minSdkVersion android_min_sdk_version
targetSdkVersion compileSdkVersion
versionCode 2
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile project(':libraries:BaseGameUtils')
}
buildscript {
repositories {
jcenter()
}
}
This is my Build.Gradle file I don't know why it's not compiling.
but when I try to run application on emulator it throws me this error
Failure [INSTALL_FAILED_OLDER_SDK]
Installation failed since app's minSdkVersion is newer than device's API level (API 23).
Please update your apps minSdkVersion.
Error while Installing APK
I checked many times and replace min_sdk_version with absolute value 15 but still no luck.any one please advice it would be helpful.
Thank you. :)
I'm also getting same issue
I have solved my issue making below changes
compileSdkVersion 'android-P'
targetSdkVersion 27
and the dependencies
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
implementation 'com.android.support:cardview-v7:28.0.0-alpha1'
hope it help someone
this can also be caused when creating the app and you select a higher minimum sdk so when creating empty activity select the lowest(Icecream) and you wont experience the same...was avictim of the same and i got sorted after realising the it
You can try to add to your build.gradle (D:\AppName\app\build.gradle) the following line under default config:
minSdkVersion 28 //or whatever version you need
defaultConfig {
applicationId "com.example.appname"
minSdkVersion 28 <<<----------------------------------
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Android Studio: use one version number for all modules

I'm building a complex project with multiple modules that gets build together to create a distributed sdk.
My purpose is to have one variable for version major, minor and revision who I later inject into the buildConfig.
Cant find how to do it.
This is what I tried so far:
project1:
// PROJECT VERSIONS
project.ext {
major = 1
minor = 7
revision = 2
}
project2:
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode project(':project1').ext.major
versionName "1.0"
}
Thank you!
You can configure these values in the build.gradle file in the root of the project.
Example:
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.1"
minSdkVersion = 15
targetSdkVersion = 23
}
Then in the module/build.gradle you can use:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
//...
}
In the beginning of build.gradle of project2 add the following line:
evaluationDependsOn(':project1')
Then the evaluation you wrote will work.

Categories

Resources