Below is the problem i'm facing right now when using VSCode flutter to debug.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Android resource linking failed
/Users/jbyen/code/testing/build/app/intermediates/merged_manifests/debug/AndroidManifest.xml:58: AAPT: error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.example.crystagram:style/Theme.AppCompat.Light.NoActionBar) not found.
error: failed processing manifest.
BUILD FAILED in 31s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
The plugin cloud_firestore could not be built due to the issue above.
My project build.gradle :
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}
}
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 project gradle.properties :
org.gradle.jvmargs=-Xmx1536M
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=true
My project 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 = '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 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.example.testing"
minSdkVersion 18
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'androidx.multidex:multidex:2.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.google.gms.google-services'
I adding this 2 dependencies to solve the failed processing manifest error.
dependencies {
implementation 'com.android.support:support-v4:28.1.0'
implementation 'com.google.android.material:material:1.0.0'
}
For me, it was because I had an invalid AndroidManfiest.xml file. When implementing Branch.io, I copied and pasted the directly without recognizing I should have merged that in with my existing MainActivity
Related
FAILURE: Build failed with an exception.
What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[16.0. 0]", but isn't
being resolved to that version. Behavior exhibited by the library will
be unknown.
Dependency failing:
com.google.firebase:firebase-measurement-connector-impl:16.0.1 ->
com.google.android.gms:play-servic es-measurement-base#[16.0.0], but
play-services-measurement-base version was 17.2.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 onto
com.google.firebase:firebase-core#16.0.1 -- Project 'app' depends
onto com.google.firebase:firebase-analytics#17.2.0
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 build.gradle
file.
Here is my app level 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 = '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"
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.santosenoque.chatapp"
minSdkVersion 16
targetSdkVersion 27
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 {
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.android.support:support-v4:27.1.1"
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
}
apply plugin: 'com.google.gms.google-services'
Project level build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
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
}
I downloaded this project from Github, please help me solve this error.
I am trying to add Firebase and google services to my flutter app however Gradle is throwing an exception without any real explanation.
I tried reinstalling both android studio and flutter however the error still happens. I also downloaded the google-services.json file and placed it within the app folder.
My project level gradle looks like this:
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.3.2'
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 level gradle looks like this
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 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.example.facial_app"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
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 {
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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 error message produced is:
* Error running Gradle:
ProcessException: Process "C:\Users\user\AndroidStudioProjects\facial_app\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user\AndroidStudioProjects\facial_app\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
* 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 1s
Command: C:\Users\user\AndroidStudioProjects\facial_app\android\gradlew.bat app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
It's due to AndroidX compatibility,
Create a new project and follow the steps below:
In order for your project to be AndroidX compatible, you need to add the following two lines to your gradle.properties file:
android.useAndroidX = true
android.enableJetifier = true
Make sure in your app build.gradle file that the compileSdkVersion and targetSdkVersion are both set to 28
Remove all the lines with the comment "Remove" from your main app build.gradle file:
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "YOUR_APPLICATION_ID"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" //Remove
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2' // Remove
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' // Remove
}
If you try to build the project you will get an error that has something to do with the core library for AndroidX, To fix it, add the code in the subprojects category in your project level build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('androidx') ) {
details.useVersion "1.0.1"
}
}
}
}
}
NOTE 1: In the 4th step rememeber that the subprojects category should be bellow the dependecies category, if not present then copy and paste the code given.
I would prefer to try the above steps in Android Studio, Save all the files and restart the project, Add the Firebase dependencies and whatever the changes are told to do in the documentation: Documentation. It would work.
BEST OF LUCK!!
When using android studio, creating a new project and adding the following entries to:
android/build.gradle (dependencies):
classpath 'com.google.gms:google-services:4.3.0'
and android/app/build.gradle (at the bottom)
apply plugin: 'com.google.gms.google-services'
the gradle build fails with the following error:
Finished with error: Gradle task assembleDebug failed with exit code 1
This error goes away when I stop to apply the google-services plugin, which I need for google services.
Flutter is upgraded to the latest version.
Complete build files:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.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
}
and:
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 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 "de.sveri.shopli_new"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.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 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
To complete the setup of the google play services plugin you have to
add the google-services.json file.
This file is generally placed in the app/ directory (at the root of the Android Studio app module). As of version 2.2.0 the plugin supports build type and product flavor specific JSON files. All of the following directory structures are valid:
// dogfood and release are build types.
app/
google-services.json
src/dogfood/google-services.json
src/release/google-services.json
I tried to implement Google's recommended changes for "Add Firebase to your app" which states:
The Google services plugin for Gradle loads the google-services.json file you just downloaded. Modify your build.gradle files to use the plugin.
Project-level build.gradle (<project>/build.gradle):
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:4.0.1'
}
}
App-level build.gradle (<project>/<app-module>/build.gradle):
dependencies {
// Add this line
implementation 'com.google.firebase:firebase-core:16.0.1'
}
...
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
But after making these changes (albeit updated for current versions, ie: services is now 4.2.0 and core is now 16.0.9) I get the following error when trying to run the application:
* Error running Gradle:
ProcessException: Process "X:\Projects\Apps\Flutter\ultimate_mtg\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Script 'X:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 29
* What went wrong:
A problem occurred evaluating script.
> Could not find method android() for arguments [flutter_btx813u5j2ly3w9khjl576b0k$_run_closure1#6f90a486] on project ':app' of type org.gradle.api.Project.
It appears at this stage to be inside the flutter SDK. Here is my flutter.gradle file (extract):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
Line 29 is this line:
android {
Anyone have any ideas with this one? I have read many similar threads on this and none of the suggestions there are working for me.
For added information, my \build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.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
}
And 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 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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "sjr.ultimatemtg"
minSdkVersion 16
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
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 {
implementation 'com.google.firebase:firebase-core:16.0.9'
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-ads:17.2.0'
}
apply plugin: 'com.google.gms.google-services'
Try moving 'com.android.application' to the top of the order in the plugin configs. This seems needed to go first similarly to what have been mentioned on this answer.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
Though nowadays, you can user flutterfire_cli to configure your app to use Firebase.
I am trying to build a newly created Android project (created using flutter create), but the gradle build because of missing dependencies.
I have tried to install a newer version of gradle (using brew install gradle) and tried to change it to that (5.4.1) version without luck. I also read in multiple places that the problem might be a conflict of different httpclient versions being in the class path, but is not the case. I have also tried adding the httpclient dependency directly to the root build.gradle file, but the error remains.
build.grade (root)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
// classpath 'org.apache.httpcomponents:httpclient:4.5.8'
classpath 'com.android.tools.build:gradle:2.3.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/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 = '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"
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.myapp"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
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.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Expected result: build finished.
Actual result: gradle build exception;
[ +3 ms] * Error running Gradle:
ProcessException: Process "/Users/riccardo/dev/app/android/gradlew" exited abnormally:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.3.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:2.3.0.
> Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
> Could not resolve com.android.tools.build:gradle:2.3.0.
> Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
How do install this missing dependency? Shouldn't it be fetched from jcenter for instance?
change the buildscript to:
buildscript {
repositories {
maven {url "https://maven.google.com"}
// google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.4.0"
}
}