Why I get these errors I try to release apk
I run "flutter build apk --release"
Execution failed for task ':app:lintVitalRelease'.
A problem occurred configuring root project 'android_intent'.
What went wrong: A problem occurred configuring root project 'android_intent'.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
android/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.deleviry"
minSdkVersion 21
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 'com.google.firebase:firebase-core:17.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }
apply plugin: 'com.google.gms.google-services'
android/build.gradle
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.3'
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 }
Upgrading gradle build tools seems to break some lints.
To fix this you can:
If your error says debug/libs.jar, build --debug then --release.
If your error says profile/libs.jar, build --profile then --release.
from https://github.com/flutter/flutter/issues/58247#issuecomment-636500680
If the above doesn't work you can disable the check.
Add checkReleaseBuilds false in lintOptions in the android/app/build.gradle file.
android {
...
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false //<- add this line
}
}
If your error says debug/libs.jar, build --debug then --release:
flutter build apk --debug
flutter build apk --release
If your error says profile/libs.jar, build --profile then --release:
flutter build apk --profile
flutter build apk --release
Taken from here
If you're having this issue and you can't fix it with either fixes like me, you might be having different flavors. I had to run the run and run --release command for every flavor before I could build one without an error.
so
flutter run --flavor dev
... (do so for every flavor)
flutter run --flavor lastFlavor
then
flutter build apk --flavor dev (error)
... (do so for every flavor)
flutter build apk --flavor lastFlavor (SUCCESS!)
and from now on you can build every flavor without error :)
I've stuck to the latest Android Studio Gradle plugin from the 3.x series (3.6.4) paired with an up-to-date Gradle version (AS plugin 3.6.4 + Gradle 6.6 yields no error for me).
Edit: As of today July 13th 2021, Flutter 2.2.3 runs fine with Android Studio Gradle plugin version 4.2.2 and Gradle 6.8.3 (stable)
Not sure if this is the correct way, but I solved similar issue by adding these lines
release {
signingConfig signingConfigs.debug
shrinkResources false // Add this line
minifyEnabled false // Also add this line
}
in my case, this part of the code was absent in android/app/build.gradle so i added it and it worked.
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
I have resolved this issue by adding classpath "com.android.tools.build:gradle:7.2.1" in android>build.gradle dependecies. It worked perfectly.
Note: my gradle wrapper version was https://services.gradle.org/distributions/gradle-7.4.2-all.zip in gradle-wrapper.properties
Basically this problem occurred some of dependencies uses latest gradle version and your project version is different.
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false //<- add this line
}
add this code will solve your problem
Related
After Upgrading flutter to 3.3.09 and then to .10 The Release Build Only Stopped Working With Problems In Local Notifacations Package, After Many Many Many Edits In Gradle And Kotlin I Stopeed The Error From The Package And A New Error Pops-up
I've Tried Every Possible Gradle.Wrapper , Gradle , Kotlin Combination And Allways there is a Compatability Problem, Checked Here And Here And Here To Try To Get A Possible Working Combination With No Luck, And No Fix Found On Stack overflow Helped.
android/gradle
buildscript {
ext.kotlin_version = '1.5.32'
repositories {
google()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
jcenter()
google()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/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"
apply plugin: 'com.google.gms.google-services' //this line
android {
compileSdkVersion 33
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.laamarRose.laamar_distribution"
minSdkVersion 21
targetSdkVersion 31
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
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation 'androidx.multidex:multidex:2.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-analytics'
}
gradle-wrapper.properties
#Fri Jul 09 02:12:26 EEST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
The Error
* What went wrong:
Execution failed for task ':app:compileReleaseKotlin'.
> Compilation error. See log for more 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 15m 52s
Running Gradle task 'assembleRelease'... 955.0s
┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update │
│ D:\LaamarRose\Projects\Trust-Fund\trustfundapp\android\build.gradle: │
│ ext.kotlin_version = '<latest-version>' │
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘
I Would Like To Get The Release Build Working Again Without Deleting Anymore Packages
Tried Multiple Stackoverflow Solutions And Google And Other Scources No Luck
Edit #1
When Setting The ext.kotlin_version = '1.6.10' Got This
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not delete old build\app\reports\lint-results-release-fatal.html
Trying A Secound Time Showed This Error `
Could not resolve all artifacts for configuration ':flutter_local_notifications:debugUnitTestRuntimeClasspath'.
Please try to change your Kotlin Version hope its help to you. and rebuild again flutter build apk --release command, I just test on my machine
form
ext.kotlin_version = '1.5.32'
to
ext.kotlin_version = '1.6.10'
after succeful build result
Running Gradle task 'assembleRelease'... 122.9s
√ Built build\app\outputs\flutter-apk\app-release.apk (42.6MB).
Try doing flutter build apk only. It generates app-release.apk also.
Location: build/app/outputs/flutter-apk/app-release.apk
I'm also using flutter v3.3.10. Works for me.
Edit:
I use ext.kotlin_version 1.7.20 as mentioned below. Maybe you need to update your build.gradle to a newer version. Also replace jcenter() with mavenCentral() as JCenter Maven repository is no longer receiving updates.
buildscript {
ext.kotlin_version = '1.7.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.14' // this is for firebase
}
}
Also do flutter clean and invalidate and clear caches of your IDE, before building release apk.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Users\Arslan\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\launch_review-3.0.1\android\src\main\java\com\iyaffle\launchreview\LaunchReviewPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\Arslan\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_android-2.0.12\android\src\main\java\io\flutter\plugins\pathprovider\PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
e: C:\Users\Arslan\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\share_plus-3.1.0\android\src\main\kotlin\dev\fluttercommunity\plus\share\MethodCallHandler.kt: (34, 24): Type mismatch: inferred type is String? but String was expected
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':share_plus:compileDebugKotlin'.
Compilation error. See log for more 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 48s
Exception: Gradle task assembleDebug failed with exit code 1
Getting this compiling flutter app tried everything flutter clean etc nothing is working.
I had the same problem today.
The only solution for me, was this.
Go to your pubspec.yaml
delete your share_plus line, and put share_plus: ^4.0.4 (or latest version from pub.dev
ctrl+s
flutter run
enjoy
I had the same problem yesterday, although I do not quite remember how I solved it. Let's try to go through the standard:
Wipe all flutter cache (flutter clean) and upgrade to latest flutter and dart.
Update your plugins to the latest version.
I'll give you my android/build.gradle file below, compare.
I will also show you my android/app/build.gradle file, look for the lines where kotlin is written, its version, import, etc.
I won’t say, but as far as I remember, I had this problem when I used one of the translation plugins, this plugin added an additional translate method to the String object, it was displayed correctly in the code, but when launched it gave an error related to Kotlin. Example:
String text;
print(text.translate); //Error for no apparent reason
So check your code carefully.
Pay special attention to this warning from your error message: "Type mismatch: inferred type is String? but String was expected". Try to find this gap in the newly written functionality.
android/build.gradle:
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
// gradle.projectsEvaluated {
// tasks.withType(JavaCompile){
// options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
// }
// }
}
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
}
android/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 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.legend_application"
minSdkVersion 22 //flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
// 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.android.support:multidex:1.0.3'
}
I'm new to flutter and am trying to run a new project on VS code.
installed the latest flutter at 19/1/2022. flutter --version gives me 2.8.1.
jdk is 17.0.1
this is what i get ...
Launching lib\main.dart on SM N975F in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'G:\1-programing\Projects\Flutter\flutter_application_2\android\settings.gradle' (C:\Users\username\.gradle\caches\6.7\scripts\1fnwrr8g4rohfp291nvlxj5qe).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61
* 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
Exited (sigterm)
tried to change gradle, which is 6.7 in gradle-wrapper.properties, to 7.3.3 which is the latest.
and this is what i get...
Launching lib\main.dart on SM N975F in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #30206a4d
* 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 3s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
i have tried changing the build.gradle in android/app/src
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_application_2"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
to
defaultConfig {
applicationId "com.example.gfgpagination"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
and it was not helpfull.
have tried searching these errors but i could not use them to this day.
my build.gradle in android folder
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
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
}
and my build.gradle in android/app folder
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 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.flutter_application_2"
minSdkVersion flutter.minSdkVersion
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-stdlib-jdk7:$kotlin_version"
}
soooo, I am going to answer my own question.
it seems i was using the latest java SDK version.
As mentioned in the install web page, i must have downloaded java SDK8 .
that's probably everything i did to fix it.
Try this for last error 'Unable to make field private final java.lang.String java.io.File.path' : https://exerror.com/accessible-module-java-base-does-not-opens-java-io-to-unnamed-module/
In your Manifest.xml add below line if it is not present:
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="31" />
For more further information you will visit below link
Stack Overflow Answer
I reset my pc recently, So the path of my project have changed, I don't know if it has to anything with this error.
I tried changing minSdkversion, compile SDK version, upgraded and downgraded all the firebase plugins, but no luck.
Here is my Complete error log
Launching lib\main.dart on Android SDK built for x86 in debug mode...
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-
1.0.3\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java:92:
error: cannot find symbol
() -> {
^
symbol: method metafactory(Lookup,String,MethodType,MethodType,MethodHandle,MethodType)
location: interface LambdaMetafactory
Fatal Error: Unable to find method metafactory
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':firebase_core: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 32s
Here is my 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 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 plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
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.orangesprout.wlyk"
buildToolsVersion = "28.0.3"
minSdkVersion 23
targetSdkVersion 30
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 platform('com.google.firebase:firebase-bom:26.5.0')
implementation 'com.google.firebase:firebase-analytics'
}
apply plugin: 'com.google.gms.google-services'
From the error log it looks like theres a syntax error on line 92 at this location
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.0.3\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java
So you could either go to that location and edit the file and fix the error or I would suggest you to
remove the
firebase_core: ^1.0.3
from your pubspec.yaml and also delete pubspec.lock then run
flutter packages get
and then re-add the
firebase_core: ^1.0.3
and then run
flutter packages get
so as to refetch the files related to this package
* Error running Gradle:
ProcessException: Process exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user\AndroidStudioProjects\stop\android\app\build.gradle' line: 5
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'reader' for project ':app' of type org.gradle.api.Project.
* 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 17s
Command: C:\Users\user\AndroidStudioProjects\stop\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Process finished with exit code 1
Info:-
1.I have deleted IOS directory before running build apk
2.I don't know if IOS directory affect a flutter app or not
3.After trying to build apk this above error is displaying in the console box
I have added build.gradle code
//buildscript {
// ext.kotlin_version = '1.3.50'
// repositories {
// google()
// jcenter()
// }
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
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
}
Local.properties
sdk.dir=C:\\Users\\user\\AppData\\Local\\Android\\Sdk
flutter.sdk=C:\\Users\\user\\flutter
flutter.versionName=1.0.0
flutter.versionCode=1
flutter.buildMode=release
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 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.ramram.quit"
minSdkVersion 16
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'
}
gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
I have added build.grale and local properties please help now...
Below code is the latest error
* Error running Gradle:
ProcessException: Process exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user\AndroidStudioProjects\stop\android\build.gradle' line: 30
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not find method classpath() for arguments [com.android.tools.build:gradle:3.5.1] 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 1m 15s
Command: C:\Users\user\AndroidStudioProjects\stop\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.