I am trying to use Chaquopy Plugin in my android project generated with flutter. I mean that when a flutter project is created it generates an android project app folder with it. As Chaquopy does not provide direct support for flutter so I have decided to use this in that flutter generated android app. I went through the line-by-line of Chaquopy's documentation and tried to follow all the instructions given there. But I think I missed something and it is showing errors now and not downloading the Chaquopy Plugin. I am giving my settings.gradle and other gradle files below. Please help me. I am very new to programming and that's why I don't understand these stuff much
Here is the Chaquopy Documentation
Here is my Settings.gradle
include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
Here is my Project level Build.gradle
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id 'com.chaquo.python' version '12.0.1' apply false
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
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 plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
plugins {
id 'com.chaquo.python'
}
android {
compileSdkVersion flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.pyflut"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
python {
buildPython "C:/Users/super/AppData/Local/Programs/Python/Python310/python.exe"
buildPython "C:/Users/super/AppData/Local/Programs/Python/Python310/python.exe", "-3.10"
}
}
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"
}
Finally here are my errors
Build file 'F:\Pyflut\android\build.gradle' line: 14
Error resolving plugin [id: 'com.chaquo.python', version: '12.0.1', apply: false]
> Could not resolve all dependencies for configuration 'detachedConfiguration1'.
> Could not determine artifacts for com.chaquo.python:com.chaquo.python.gradle.plugin:12.0.1
> Could not get resource 'https://plugins.gradle.org/m2/com/chaquo/python/com.chaquo.python.gradle.plugin/12.0.1/com.chaquo.python.gradle.plugin-12.0.1.jar'.
> Could not HEAD 'https://jcenter.bintray.com/com/chaquo/python/com.chaquo.python.gradle.plugin/12.0.1/com.chaquo.python.gradle.plugin-12.0.1.jar'.
> Read timed out
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleException: Error resolving plugin [id: 'com.chaquo.python', version: '12.0.1', apply: false]
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.resolveToFoundResult(DefaultPluginRequestApplicator.java:215)...... [Can not copy full error because of character limitaions sorry for that but if it needs then I will provide you that
As others have mentioned, it looks like the Gradle plugin portal is having some problems today.
Since your Flutter-generated project uses the old buildscript and apply syntax to apply the Android plugin, you should probably follow the same pattern with the Chaquopy plugin. That way, the Gradle plugin portal won't even be involved. See this version of the Chaquopy documentation for an example.
Alternatively, you can continue to apply the Chaquopy plugin with the new plugins syntax, but also include mavenCentral in the pluginManagement { repositories } block in settings.gradle. That should allow you to access the plugin without relying on the Gradle plugin portal's mirror. See here for an example.
Jcenter is down mate. We don't know how long it will be because there is no blogpost or social media post about it.
Check it here: https://status.bintray.com/
Related
I tried running my app on android emulator for the first time and this error showed up
Execution failed for task ':location:generateDebugRFile'.
FAILURE: Build failed with an exception
* What went wrong:
Execution failed for task ':location:generateDebugRFile'.
> Could not resolve all files for configuration ':location:debugCompileClasspath'.
> Could not find com.google.android.gms:play-services-location:16..
Required by:
project :location
* 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 19s
Exception: Gradle task assembleDebug failed with exit code 1
my 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 FileNotFoundException("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'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 33
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.fun"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
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 {
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
implementation 'com.google.android.gms:play-services-auth:20.4.1'
implementation 'com.google.android.gms:play-services-location:21.0.1'
}
apply plugin: 'com.google.gms.google-services'
// Work around for onesignal-gradle-plugin compatibility
googleServices.disableVersionCheck = true
My android/build.grade
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.15'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
my flutter doctor summary
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.71.0)
[✓] Connected device (4 available)
[✓] HTTP Host Availability
• No issues found!
I am just trying to launch the app on an android emulator so It can create a debug.keystore file, I have tried many options from other facing kind of the simillar problem
I'm trying to build a release appbundle for an Andriod app using Flutter,
When I run:
flutter build appbundle
I get:
* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: build_9z8dp8vvjumdxnixrakr4imyg.android() is applicable for argument
types: (build_9z8dp8vvjumdxnixrakr4imyg$_run_closure3) values: [buil
d_9z8dp8vvjumdxnixrakr4imyg$_run_closure3#775a0064]
I tried to clean+repair cache but its still not working. Flutter doctor works fine.
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'
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
apply plugin: 'org.jetbrains.kotlin.android.extensions'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
androidExtensions {
experimental = true
}
android {
compileSdkVersion 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.example.Application"
minSdkVersion 23
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile']
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:27.1.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'
// Declare the dependency for the Firebase Authentication library
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-auth'
// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
implementation 'com.facebook.android:facebook-login:[8.1)'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.fragment:fragment:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
android\build.gradle file:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google() // Google's Maven repository
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android\key.properties file:
storePassword=123456789
keyPassword=123456789
keyAlias=upload
storeFile=C:\\Users\\User\\Documents\\Application\\upload-keystore.jks
full output:
C:\Users\User\Documents\Application>flutter build appbundle
The plugin `flutter_open_whatsapp` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since
a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety
Kotlin plugin should be enabled before 'kotlin-android-extensions'
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\User\Documents\Application\android\app\build.gradle' line: 41
* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: build_9z8dp8vvjumdxnixrakr4imyg.android() is applicable for argument types: (build_9z8dp8vvjumdxnixrakr4imyg$_run_closure3) values: [buil
d_9z8dp8vvjumdxnixrakr4imyg$_run_closure3#27144de8]
* 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 'bundleRelease'... 2,990ms
Gradle task bundleRelease failed with exit code 1
Try opening the /android directory as a project in android studio and build the release without using Flutter.
Even try using Java for the project and see if it works or not ??
if it works, then there might be some issue with your Kotlin version.
I am getting the following error when trying to debug my flutter app on my phone
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'android'.
compileSdkVersion is not specified. Please add it to build.gradle
My app build. gradle file is as follows:
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 FileNotFoundException("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 30
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.wizzcrete"
minSdkVersion 23
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 '../..'
}
My android build.gradle file is as follows:
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
I have checked my SDK version and it is indeed 30. I even experimented with using the Android SDK version 29 and updating the compile and target SDK version to 29 in the gradle and that still did not work. My minSDK version is 23 as in order to use firebase in flutter minimum 23 is required. I hope this information is enough to convey the problem, any ideas?
SOLVED
The issue was that I did not add all the necessary firebase dependencies to my project level gradle. The plugins I added were in the app level gradle which was wrong, they were supposed to be in the Project level gradle. Additionally, I had to add missing dependencies such as the implementation fo the firebase core bom and the firestore and authentication dependencies to my project level gradle like so:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:28.4.0')
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-firestore-ktx'
}
I am adding this answer to help another lost soul like mine was for 6+ hours wracking my brains on this issue. To sum it up: check the dependencies in both your gradle files and make sure you have all of it sorted out.
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.
I am new to flutter framework. I am trying to install cloud firestore in flutter but got the problem. Below is my code and gradle files:
Android/build.gradlew:
buildscript {
// ext.kotlin_version = '1.2.31'
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App/build.gradle is:
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.barcode_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 {
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'
After running flutter run -v or build it in android i got the error:
'ERROR: Plugin with id 'com.google.gms:google-services' not found.'
I tried to almost all the solution available on stackoverflow and github but the problem is still there.
At the bottom of your app/build.gradle file you've got:
apply plugin: 'com.google.gms:google-services'
This should actually be:
apply plugin: 'com.google.gms.google-services'
Notice the period between gms and google-services, instead of the colon.
EDIT: You're probably having this problem because Google's own docs (last edited 20 March) are incorrect. I've sent them feedback to have this corrected.
archived here http://archive.is/4Ujuc
Actually Google is correct: classpath 'com.google.gms:google-services:4.2.0' is correct and apply plugin: 'com.google.gms.google-services' is also correct. One has a COLON and one has a PERIOD. but the names are so similar that it is easy to think they should be the same.
Just remember "classpath" - COLON, "plugin" - PERIOD.
If the problem still persists after applying the Jmorris and Johnhunter solution, check this solution
The solution was:
Upgrade the Android Gradle plugin to 3.5.0
Upgrade the Google Services plugin to 4.3.3
Upgrade Gradle to 5.4.1 (the required Gradle version for this Android Gradle plugin version)
Just delete the google-services.json file and re configure the firebase with your project.