Adding Firebase to flutter project, breaks the project - android

I followed several tutorials to add firebase to my flutter project. But no matter what I do, my project breaks with the same exact failure.
I tried creating new projects, and got the same exact failure.
For now, I followed this tutorial.
Right after changing the app level build.gradle file, I start to build my app. I use flutter run to run the app on my physical device.
Every single time, I get hit by the same exact error, and scouring on the internet, didn't solve the issue, hence the question.
My Error:
* Error running Gradle:
ProcessException: Process "D:\Projects\flutter_creds\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Projects\flutter_creds\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 1m 58s
Command: D:\Projects\flutter_creds\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Exited (sigterm)
The error is at line 24 of my app level build.gradle file. However, that is the line, I haven't changed. Here is my build.gradle (app level)
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.sowingfiber.flutter_creds"
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 "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'

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!!

Related

im stuck with firebase authetication

i was trying to connect firebase into my flutter project, after tons of research, im still dont know the bug.im trying to connect authentication, follow the tutorial step by step, but it doesn't seems like gonna work
somebody please help me :V, im only had 1.5 month anymore. (btw, i dont know how to post the right version if stackoverflow, im so sorry)
here, written in the console
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Flutter_Project\firebase_authentication\android\build.gradle' line: 25
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method setVariantDir() for arguments [debug] on task ':app:processDebugGoogleServices' of type com.google.gms.googleservices.GoogleServicesTask.
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
Exception: Gradle task assembleDebug failed with exit code 1
and this problem show up
(-) Cannot resolve symbol 'Properties'
(-) throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
and this is the code of 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: 'com.google.gms.google-services' // this is line 25
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.firebase_authentication"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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 {
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:28.0.0')
// Add the dependency for the Firebase SDK for Google Analytics
// When using the BoM, don't specify versions in Firebase dependencies
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-firestore'
// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
}
please, kind people
Try to flutter clean first it seems the machine cannot find your flutter.sdk
Have you put the file from firebase google-services.json to the folder android/app folder?
And also add the depedencies for firebase ? on file build.grandle but not inside android/app folder
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.5'
}
}

I'm trying to add firebase to my flutter project but i keep on getting this Error Could not find method implementation()

**This is the error message :**
Launching lib\main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\HP-LinkR\Videos\event_notifier\android\build.gradle'
line: 35
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not find method implementation() for arguments
[com.android.support:support-annotations:28.0.0] on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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
Exception: Gradle task assembly debug failed with exit code 1
***This is code for the Build.gradle file that is giving the error:***
New Properties methods is highlighted red
This is code for the Build.gradle file that is giving the error:
New Properties methods is highlighted red
This is code for the Build.gradle file that is giving the error:
New Properties methods is highlighted red
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"
apply plugin: 'com.google.gms.google-services'
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.event_notifier"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
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.2'
compile 'com.android.support:multidex:1.0.1'
}
Goto event_notifier\android\build.gradle ...
These dependencies should make it build:
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-
jdk7:$kotlin_version"
compile "com.google.firebase:firebase-analytics:17.2.2"
compile "com.android.support:multidex:1.0.1"
}
The actual problem seems to be a quite outdated version of the Android Gradle Plugin.
You'd have to upgrade to something more current to use implementation:
classpath "com.android.tools.build:gradle:4.0.1"
And maybe already start with current androidx packages ...because else you'll be stuck at the latest version of Firebase libraries, which use these obsolete support libraries. That Flutter project may generally be outdated and might require some refactoring (unless using the above compile):
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72"
implementation "com.google.firebase:firebase-analytics:17.4.4"
// https://mvnrepository.com/artifact/androidx.multidex/multidex
implementation "androidx.multidex:multidex:2.0.1"
}

When I try to sync my Gradle files I get an error

I am currently building a Flutter app and almost everything has gone okay so far until I started getting this error. I've searched all over the internet for a solution but I have not found anything that solved it for me.
When I try to sync my Gradle files I get an error:
ERROR: Gradle DSL method not found: 'classpath()'
Possible causes:
The project 'android' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.5.2 and sync project
The project 'android' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
I cant press the "Upgrade plugin to version 3.5.2 and sync project" as that fails.
When i try to build my app i get this error
Launching lib\main.dart on SM G973F in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\build.gradle' line: 15
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not find method classpath() for arguments [com.android.tools.build:gradle:3.5.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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 6s
Command: C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\gradlew.bat app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
This is the project-lever build.gradle file:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.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
}
And this is the app-level build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.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.0.0'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
compileSdkVersion 29
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.tab.tab_truth_true"
minSdkVersion 21
targetSdkVersion 29
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 {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-ads:18.3.0'
}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
The strange thing is that I don't have any Gradle settings, see image
{LINK} this is my gradle settings, as you see, all I get is this
I have tried to migrate to Android X but with no luck. I just says "no usages found"
In the project level build.gradle there is a duplicate class path:
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
}
Please delete the second occurrence outside the buildscript block and try to build again.

When building my flutter app, it fails with GradleExeption

When I try to build my app for public release I get this error from the app level build.gradle. I'm getting the error below:
Launching lib\main.dart on SM G973F in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\app\build.gradle' line: 11
* What went wrong:
Could not compile build file 'C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\app\build.gradle'.
> startup failed:
build file 'C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\app\build.gradle': 11: unable to resolve class GradleExeption
# line 11, column 11.
throw new GradleExeption("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
^
1 error
* 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\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\gradlew.bat app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
This is the app level build.gradle code:
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 GradleExeption("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.0.0'
}
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 29
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.tab.tab_truth_true"
minSdkVersion 21
targetSdkVersion 29
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"
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:18.3.0'
}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
I have tried everything, what I know, but achieved nothing. please help me out.
You've got a typo in your Gradle file, change GradleExeption to GradleException at line 11 in your Gradle file.

Onesignal is sticking and not removing in gradle

I was installing Onesignal in my app but suddenly i got this error.
I Removed everything connected in onesignal and still getting this error..
VS CODE ERROR while debugging :
* Error running Gradle:
ProcessException: Process exited abnormally:
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --status for details
> Configure project :app
WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
> Configure project :firebase_admob
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':firebase_admob'.
> Could not resolve all artifacts for configuration ':firebase_admob:classpath'.
> Could not find any matches for gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99] as no versions of gradle.plugin.com.onesignal:onesignal-gradle-plugin are available.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml
- https://dl.google.com/dl/android/maven2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/
- https://jcenter.bintray.com/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml
- https://jcenter.bintray.com/gradle/plugin/com/onesignal/onesignal-gradle-plugin/
Required by:
project :firebase_admob
* 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 15s
Command: C:\Users\Anonymous\Desktop\newwwapp\android\gradlew.bat app:properties
Android Studio error :
Could not find any matches for gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99] as no versions of gradle.plugin.com.onesignal:onesignal-gradle-plugin are available.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml
- https://dl.google.com/dl/android/maven2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/
- https://jcenter.bintray.com/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml
- https://jcenter.bintray.com/gradle/plugin/com/onesignal/onesignal-gradle-plugin/
Required by:
project :firebase_admob
Adnroid/Build.gradle icludes :
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
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 this is the 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.lottothesmartapp"
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 {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
I remember that i did not change any inner codes in gradle i just added some codes implements in the build.gradle only and debugged.
then removed the added codes to remove the error shown above and sticked without any changes.
Any solution please ?
Do you load the onesignal library from pubspec.yaml? Maybe it's in the pubspec.lock.

Categories

Resources