Getting proguard error on adding androidx biometric API ( "androidx.biometric:biometric:1.0.1") - androidx

I am getting following error on building release apk after adding androidx biometric api "androidx.biometric:biometric:1.0.1" in gradle file
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
../release/values-v28/values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
../release/values-v28/values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
../release/values/values.xml:2853: error: resource android:attr/fontVariationSettings not found.
../release/values/values.xml:2854: error: resource android:attr/ttcIndex not found.
error: failed linking references.
I am using below mentioned sdk / tools version
buildToolsVersion = '28.0.3'
compileSdkVersion 28
targetSdkVersion 28
I am able to build debug apk and it works fine

I created my app following the instructions given here and here. And I have no problems creating and running a release APK. Here is the proguard section of my Gradle file
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

Related

react-native build failed after installing admob module

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1001 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
> Configure project :react-native-firebase_admob
:react-native-firebase_admob package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/admob/package.json
:react-native-firebase_app package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/app/package.json
:react-native-firebase_admob:firebase.bom using default value: 26.3.0
:react-native-firebase_admob:ads.consent using default value: 1.0.6
:react-native-firebase_admob package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/admob/package.json
:react-native-firebase_admob:version set from package.json: 10.5.1 (10,5,1 - 10005001)
:react-native-firebase_admob:android.compileSdk using custom value: 29
:react-native-firebase_admob:android.targetSdk using custom value: 29
:react-native-firebase_admob:android.minSdk using custom value: 16
:react-native-firebase_admob:reactNativeAndroidDir /home/muhamed-kveshkshaano/suck/node_modules/react-native/android
> Configure project :react-native-firebase_app
:react-native-firebase_app package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/app/package.json
:react-native-firebase_app:firebase.bom using default value: 26.3.0
:react-native-firebase_app:play.play-services-auth using default value: 19.0.0
:react-native-firebase_app package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/app/package.json
:react-native-firebase_app:version set from package.json: 10.5.0 (10,5,0 - 10005000)
:react-native-firebase_app:android.compileSdk using custom value: 29
:react-native-firebase_app:android.targetSdk using custom value: 29
:react-native-firebase_app:android.minSdk using custom value: 16
:react-native-firebase_app:reactNativeAndroidDir /home/muhamed-kveshkshaano/suck/node_modules/react-native/android
> Task :react-native-firebase_app:compileDebugJavaWithJavac
> Task :app:processDebugResources FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
37 actionable tasks: 29 executed, 8 up-to-date
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/home/muhamed-kveshkshaano/.gradle/caches/transforms-2/files-2.1/820765fbb4c63d086027395fb7f0dacc/play-services-ads-lite-19.6.0/AndroidManifest.xml:27:5-38:15: AAPT: error: unexpected element <queries> found in <manifest>.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 32s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API.
here is the error, the main problem is each i install admob module #react-native-firebase/admob, it throws this error after trying a lot i couldnt find any solution, it only happens after installing admob module except that it build well, anyone knows whats wrong with that module
I was with the same problem and it work for me
in android/app/build.gradle
defaultConfig {
...
multiDexEnabled true // added for admob problem
}
...
dependencies {
...
implementation "androidx.multidex:multidex:2.0.1" // fix firebaseAdmob
}
in android/build.gradle
dependencies {
classpath('com.android.tools.build:gradle:4.1.2')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.3'
}
now open the android folder in Android Studio and wait for gradle will update
when finish the gradle update run npx react-native run-android
downgrade all the rnfirebase libraries that you are using to less than 10.0.0 (admob 7.6.11 and app 9.0.0), as I show in the image

How to fix 'Dependency failing' when building Flutter application on Android

I am trying to use Google Sign in with my Flutter application. However, I am unable to build the application due to some issues with dependencies. I have updated all of my dependencies to the latest version but to no avail. How do I resolve these dependencies so I can build the application?
This is for a simple flutter application using google sign in running on a connected OnePlus 6 android phone.
I have tried updating my dependencies to the latest version as well as changing the code to match the latest version of the google_sign_in dependency found here: https://pub.dartlang.org/packages/google_sign_in
I also tried adding firebase_core to the list of dependencies as the error message said that the app relied on firebase_core. This did nothing to change the error message.
Project 'pubspec.yaml' dependencies
dependencies:
flutter:
sdk: flutter
duration: ^2.0.0
firebase_core: ^0.3.2
cloud_firestore: ^0.9.11
firebase_auth: ^0.8.4
google_sign_in: ^4.0.1+3
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
Project Level build.gradle (android/build.gradle):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// Google Services class path
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
}
App Level build.gradle (android/app/build.gradle):
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.recipe_app"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.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 'com.google.firebase:firebase-core:16.0.1'
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'
}
apply plugin: 'com.google.gms.google-services'
The output of 'flutter run':
Launching lib/main.dart on ONEPLUS A6003 in debug mode...
Initializing gradle... 1.0s
Resolving dependencies... 4.0s
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture fingerprint of input files for task ':app:checkDebugClasspath' property 'compileClasspath' during up-to-date check.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.
1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.android.gms:play-services-stats:15.0.1 -> com.google.android.gms:play-services-basement#[
15.0.1], but play-services-basement version was 16.1.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends on project 'cloud_firestore' which depends onto com.google.firebase:firebase-firestore#18.2.0
-- Project 'app' depends onto com.google.firebase:firebase-core#16.0.1
-- Project 'app' depends on project 'firebase_auth' which depends onto com.google.firebase:firebase-auth#16.0.5
-- Project 'app' depends on project 'google_sign_in' which depends onto com.google.android.gms:play-services-auth#16.0.1
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 2.9s
Gradle task assembleDebug failed with exit code 1
I expected the application to build successfully so I could test if Google Sign in worked. However, the application does not build successfully and I am at a loss as to what to do.
I attempted to recompile using verbose mode and was informed about AndroidX being the cause.
I followed this link and downgraded all of the dependencies to the versions before the AndroidX migration as listed in the article. This fixed the issue.

Flutter Firebase Auth not working in Ecommerce app

I was trying out the firebase auth but when I added the dependencies I got some error.
Could you please check what the error?
This is the error that I got :
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Android resource linking failed
Output: D:\App\dipam\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
And this the dependencies that I added to the pubspec.yaml file :
dependencies:
flutter:
sdk: flutter
carousel_slider: ^1.0.1
cloud_firestore: 0.8.2+3
firebase_auth: 0.6.6
google_sign_in: ^3.2.4
shared_preferences:
fluttertoast:
The error you posted is a result of conflicting android.support and AndroidX versions. Make sure you're targeting API version 28.
In your app's build.gradle check if you have following values set
android {
compileSdkVersion 28 // <-- Make sure you target API 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// ...
targetSdkVersion 28 // <-- You need to update this value as well, or you might encounter runtime errors
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
// ...
}
// ...
}
Also, make sure your not using old android.support libraries in your dependencies, but new AndroidX packaged. Check this article for further references

Flutter: Build errors for cloud_firestore: above version "0.7.4"

I have been trying to resolve a build issue for hours until I realise it is due to Flutter plugin cloud_firestore. Version 0.7.4 builds fine for both Android and iOS but anything above 0.7.4 like 0.8.2+1 will have errors such as:
CloudFirestorePlugin.java:160: error: cannot find symbol
query = query.whereArrayContains(fieldName, value);
^ symbol: method whereArrayContains(String,Object) location: variable query of type
Query
/dev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:598:
error: cannot find symbol
builder.setTimestampsInSnapshotsEnabled(
^ symbol: method setTimestampsInSnapshotsEnabled(Boolean) location: variable builder
of type Builder
/dev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:678:
error: cannot find symbol
return FieldValue.arrayUnion(toArray(readValue(buffer)));
^ symbol: method arrayUnion(Object[]) location: class FieldValue
/dev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:680:
error: cannot find symbol
return FieldValue.arrayRemove(toArray(readValue(buffer)));
^ symbol: method arrayRemove(Object[]) location: class FieldValue Note:
/Users/peterlumdev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java
uses unchecked or unsafe operations. Note: Recompile with
-Xlint:unchecked for details. 4 errors FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org BUILD FAILED in 11s Gradle task assembleDebug failed with exit code 1
I would like to use 0.8.2+1 cloud_firestore for both ios and Android because of the support of
await db.settings(timestampsInSnapshotsEnabled: true);
Appreciate some help here. Many Thanks!
There is a problem with google-services.json.
In my case, I was in the same situation while coding Firebase for Flutter on Google Codelabs. I put GoogleService-Info.plist in Xcode in the corresponding folder and put google-services.json in the corresponding folder in Adndroid Studio as well. iOS Simulator worked, but in Android Studio the window like the one below is displayed, then pressing the OK button and launching Android Emulator resulted in the corresponding error.
When coding from scratch and inserting the google-services.json file from the Finder instead of Android Studio, no error occurred.
It's not working because it is creating a gradle conflict. Version 0.7.3 of firestore is working because gradle tooling is updated at that version. Please refer changelog and also refer this answer for any other working versions of firebase products.
I feel you, I've also spent hours and hours trying to figure this out.
After building a SSCCE, and then applying the settings of that project to my project, and then some tweaking, I got my project working.
Although I adjusted more settings than I care to remember, these seem to have had the highest impact:
In pubspec.yaml:
# included two other common libraries others might use
cloud_firestore: 0.8.2+1
firebase_auth: 0.7.0
google_sign_in: 3.2.4
Explicitly disable these two features in android/gradle.properties :
android.useAndroidX=false
android.enableJetifier=false
Use these versions of dependencies in android/build.grade:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
}
And finally, use these settings in android/app/build.gradle:
android {
compileSdkVersion 27
...
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
...
}
...
}
...
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.1'
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'
compile 'com.android.support:multidex:1.0.3'
}
It's also worth noting that I downloaded the google-services.json file again (though that didn't have any effect just by itself).
Any combination of these settings might help you.

Can't build release APK for flutter

I'm currently trying to build a signed release APK on Windows using Flutter. I've performed the tasks outlined in the documentation on the flutter site. When I run the build command here's the output I get. It seems to be around the firebase plugins. Any ideas?
pubspec.yaml
dependencies:
flutter:
sdk: flutter
firebase_auth: 0.4.0
firebase_database: ^0.3.0
Flutter Doctor Output
C:\Users\myuser\projects\myflutterapp>flutter doctor
[√] Flutter (on Microsoft Windows [Version 10.0.16299.125], locale en-US, channel alpha)
• Flutter at C:\Users\myuser\flutter
• Framework revision 8f65fec5f5 (3 weeks ago), 2017-12-12 09:50:14 -0800
• Engine revision edaecdc8b8
• Tools Dart version 1.25.0-dev.11.0
• Engine Dart version 2.0.0-edge.d8ae797298c3a6cf8dc9f4558707bd2672224d3e
[√] Android toolchain - develop for Android devices (Android SDK 27.0.1)
• Android SDK at C:\Users\myuser\AppData\Local\Android\Sdk
• Android NDK at C:\Users\myuser\AppData\Local\Android\Sdk\ndk-bundle
• Platform android-27, build-tools 27.0.1
• ANDROID_HOME = C:\Users\myuser\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_152-release-915-b01)
[√] Android Studio (version 3.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[-] Connected devices
• None
Error Log Information
C:\Users\myuser\projects\myflutterapp>flutter build apk --release
Initializing gradle... 0.9s
Resolving dependencies... 1.1s
Running 'gradlew assembleRelease'...
Configuration 'debugCompile' in project ':app' is deprecated. Use 'debugImplementation' instead.
Configuration 'profileCompile' in project ':app' is deprecated. Use 'profileImplementation' instead.
Configuration 'releaseCompile' in project ':app' is deprecated. Use 'releaseImplementation' instead.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
Configuration 'debugProvided' in project ':firebase_auth' is deprecated. Use 'debugCompileOnly' instead.
Configuration 'releaseProvided' in project ':firebase_auth' is deprecated. Use 'releaseCompileOnly' instead.
Configuration 'compile' in project ':firebase_core' is deprecated. Use 'implementation' instead.
Configuration 'debugProvided' in project ':firebase_core' is deprecated. Use 'debugCompileOnly' instead.
Configuration 'releaseProvided' in project ':firebase_core' is deprecated. Use 'releaseCompileOnly' instead.
Configuration 'debugProvided' in project ':firebase_database' is deprecated. Use 'debugCompileOnly' instead.
Configuration 'releaseProvided' in project ':firebase_database' is deprecated. Use 'releaseCompileOnly' instead.
Skipping AOT snapshot build. Fingerprint match.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:profileRuntimeClasspath'.
> Could not resolve project :firebase_auth.
Required by:
project :app
> Unable to find a matching configuration of project :firebase_auth:
- Configuration 'debugApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'debugRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found compatible value 'java-runtime'.
- Configuration 'releaseApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'releaseRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found compatible value 'java-runtime'.
> Could not resolve project :firebase_database.
Required by:
project :app
> Unable to find a matching configuration of project :firebase_database:
- Configuration 'debugApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'debugRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found compatible value 'java-runtime'.
- Configuration 'releaseApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'releaseRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found compatible value 'java-runtime'.
> Could not resolve project :firebase_core.
Required by:
project :app
> Unable to find a matching configuration of project :firebase_core:
- Configuration 'debugApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'debugRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found compatible value 'java-runtime'.
- Configuration 'releaseApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'releaseRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'profile' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found compatible value 'java-runtime'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 38s
Gradle build failed: 1
Turns out, the best way to handle this is to make the following change in android/app/build.gradle:
android {
compileSdkVersion 26
buildToolsVersion '26.0.3'
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.example.app"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
// This is the main section that I've updated
// to get the release APK to build
buildTypes {
release {
profile {
matchingFallbacks = ['debug', 'release']
}
signingConfig signingConfigs.release
}
}
}
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'
}
apply plugin: 'com.google.gms.google-services'
With this change I was able to build the release APK.
try this:
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
android/app/build.gradle
I just deactivated the lint. It solved my release built issue.
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
I had the same error, it turned out that I used buildTypes by mistake twice
buildTypes {
buildTypes {
.....
}
}
If you are having issue with build apk from android then try using terminal commands:
Flutter build apk --build-name =1.0.1
Flutter build apk --build-Number=10
Flutter build apk --build-name =1.0.1 --build-number=10
Make sure you will always change build name and build number when build apk. For example, if your last version name is 1.0.1 use 1.0.2 or higher and also with build number=11. Every time change this and your issue will be fixed.
I tried changing from debug to release. That solution didn't work for me. However, when I checked this site: https://www.dartlang.org/tools/pub/dependencies it says you can set a dependency without specifying a version. So in the pubspec.yaml file I did this and it worked for me...
dependencies:
flutter:
sdk: flutter
image_picker:
google_sign_in:
firebase_analytics:
firebase_auth:
firebase_database:
firebase_storage:

Resources