Build.gradle is syntax error? How I can fix this? - flutter

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
I write flutter with firebase and I use Authentication and I meet this syntax error enter image description here
How to fix this somepeople can help me

You Simply Need to Download Google-Services file
App>Build.gradle
plugins {
id 'com.android.application'
// Add the Google services Gradle plugin
id 'com.google.gms.google-services'
...
}

Related

How to setup Firebase distribution in a flutter app

I'm trying to add firebase distribution to my flutter app following these instructions
Everything is file until I get to step 3.b which says "In your module (app-level) Gradle file (usually //build.gradle), add the Google services plugin".
I can't figure out what "app-module" refers to or where the path to the gradle file is. If I append it to the /android/app/build.gradle the build crashes. Can somebody please tell me exactly which file and where to paste this content? There is no similar pattern for plugins anywhere.
plugins {
id 'com.android.application'
// Add the Google services Gradle plugin
id 'com.google.gms.google-services'
...
}
Add Just Like this in buid.gradle,
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

implement external library android in flutter plugin

i try to implementation an android external library in flutter plugin let's called myPlugin. But i have no idea how to build build.gradle which has implementation of external library. i tried run main project that depend on myplugin. but still i cannot call any api of external library here's myplugin build.gradle :
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
rootProject.allprojects {
repositories {
google()
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
}
dependencies {
implementation 'com.android.support:support-v4:26.1.0'
}
when i try to import android.support.v4...ActivityCompat, it's called cannot resolve symbol. please tell me how to do the right way. thanks
There are 2 build.gradle files.
The one in your android folder is the project-level build.gradle. You usually do not edit it.
The one in your android/app folder is the app/module-level build.gradle. Place your dependencies in this file.
Thanks. i solve it .
Open in android studio Project/android
and wrapping with gradle.
thanks

fix the error : Plugin with id 'com.android.application' not found

When I create a new project in android studio, at first every thing is o.k and it runs on my mobile phone. But if I press the sync button then a terrible error(which I afraid of and hate it) is appeared: "Plugin with id 'com.android.application' not found". I search and read all answers related to this error and do every thing. But my problem is also remained.
Here is my build.gradle(module.app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.masood.pietest"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
}
and here is my build.gradle(project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha09'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Really, I don't know what I need to do...
Could anyone help me?
After 3 days of trying to solve my above problem and searching and examining very solutions, I found that the problem raised from my "Android Plugin" version. So, if this problem occurs for every one especially for those who are new to android studio, before all, try to use from an appropriate version of "Android Plugin" which adjust with "Gradle version". To do this it's enough to look at this address: https://developer.android.com/studio/releases/gradle-plugin.html#updating-plugin and https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle.
For example, my Gradle version is "gradle-4.4" which requires at least to Plugin version "gradle:3.1.0". My Plugin version (when I had the above problem was gradle:3.1.0-alpha09) and the Sync process was encountering with error. So I change it to : "gradle:3.1.0" and now it works very well.
Notice:For checking your "gradle version" please go to the below directory on your application:
Gradle Scripts -> gradle-wrapper.properties
and for "plugin version" go to: Gradle Scripts -> build.gradle(Project:...) (NOT: build.gradle(app:...))
I hope this answer be useful for every one who have the same problem.

Gradle custom plugin's build throws "unable to resolve class"

I'm trying to build a gradle custom plugin that in turn depends on other plugin. In particular, the plugin depends on com.bmuschko.docker-remote-api plugin (that again depends on java library com.github.docker-java:docker-java:2.1.1).
So I tried with the following gradle.build file
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'com.bmuschko.docker-remote-api'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-docker-plugin:2.6.1'
}
}
group = 'com.example'
version = '1.0'
dependencies {
compile gradleApi()
compile localGroovy()
compile group: 'com.github.docker-java', name: 'docker-java', version: '2.1.1'
}
and the following plugin file:
package com.example.build
import org.gradle.api.Project
import org.gradle.api.Plugin
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
class BndPlugin implements Plugin<Project> {
#Override
void apply(Project project) {
task buildDockerImage(type: DockerBuildImage) {
println file("${projectDir}/docker/")
}
}
}
but what I get with gradle build is just the error
unable to resolve class com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
Question: how to properly manage custom plugin's dependencies?
You can get the full plugin project on github.
If you're going to use classes from the plugin, as opposed to just applying it, you should also include the plugin binaries as compile dependency in your lower dependencies section.

Gradle provided dependencies present in war

I would like to set several dependencies in my war as provided because theses jar are provided by the server.
So I set my build.gradle like this:
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
dependencies {
compile project(':project1')
providedCompile 'xml-apis:xml-apis:2.0.2',
'javax.servlet:servlet-api:2.5',
'javax.servlet.jsp:jsp-api:2.1',
'javax.servlet:jstl:1.2',
'com.sun.faces:jsf-api:2.1.6',
'com.sun.faces:jsf-impl:2.1.6',
'javax.transaction:jta:1.1'
}
But when I deploy my generated war in my server, all jars set in provided are present and my server doesn't start.
What is wrong in my configuration ?
Thanks.
Looks correct, and works fine for me. Chances are that the problem is somewhere else.