i'm using windows 10 Visual Studio Code and i'm trying to run my code after writing them and this is what it shows me afterwards.
Launching lib\main.dart on TECNO Camon CX in debug mode...
* Error running Gradle:
ProcessException: Process "C:\Users\IB\Desktop\Android\myapp\berry_networks\Dart test\Flutter App\first_flutter_app\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\IB\Desktop\Android\myapp\berry_networks\Dart test\Flutter App\first_flutter_app\android\app\build.gradle' line: 24
What went wrong:
A problem occurred evaluating project ':app'.
Failed to apply plugin [id 'com.android.application']
Illegal char <<> at index 9: C:/users//.android\analytics.settings
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 7s
Command: C:\Users\IB\Desktop\Android\myapp\berry_networks\Dart test\Flutter App\first_flutter_app\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Exited (sigterm)
how do i fix this?
#iRuth
This is my app/build.gradle on Visual Studio 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 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' (This is line 24)
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.kkkkkkkk"
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'
}
After many researches on how to fix my debugging issue with visual studio code proves abortive then i tried switching to android studio and downgrading my windows 10 to 8, but still that didn't solve it, it worsen the case.
I tried to have deep sleep and do nothing about it just to have some days off, i watch movies and making little researches.
eventually after boxing my head and loosing the tightened knot, i upgrade my system back to windows 10 and install everything one after the other:
Step 1: i install ADB
Step 2: i install Android Studio code
Step 3: i install Dart and Flutter
Step 4: i install SDK for android studio and set the environmental variables
Step 5: i install SDK platform tools and as well as setting the path in environmental variables.
Step 6: i install JDK for android studio and set the environmental variables as well
It wasn't easy for me as a beginner because i spent almost 2 month fixing this and i eventually find the answer through self taught and self motivation.
I want to thank everyone that contributed to the cause which i laid down here.
#IRuth i really appreciate your effort...
to fix all of gradle errors on vscode you need to update your gradle to last version for this first go to
android > app > src > main > click on java folder and then click on plugins then debug the plugins with F5
or install this extension https://marketplace.visualstudio.com/items?itemName=redhat.java
so after this vscode ask you to update plugins click on update and wait till it end to update your gradle project and java project so after this
flutter clean
and debuge your project it will install your build again with last version
hope this helpfull.
Related
Facing this issue when building the flutter project in Android 31.
ERROR:
Plugin project :sign_in_apple not found. Please update settings.gradle.
FAILURE: Build failed with an exception.
* Where:
Script '/Users/myusername/fluttersdk/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 421
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Cannot invoke method afterEvaluate() on null object
You can just replace this code into the
android>>settings.gradle
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
Check out the steps for adding Apple SignIn to android.
https://pub.dev/packages/sign_in_with_apple
Have run into a similar issue and although the suggestion above works (manually changing the gradle rule to look for the .flutter-plugins file) this should be handled by the default android/settings.gradle file.
The root cause for me turned out to be that the plugin's pubspec.yaml didn't have a
flutter:
plugin:
platforms:
android: # <-- was missing
...
entry. This in return caused it not to show up in android plugins of the .flutter-plugins-dependencies file, which in turn made the flutter gradle rules not pick up the dependency
(The .flutter-plugins file is deprecated in favor of .flutter-plugins-dependencies).
I have another issue after related question
DevEcoStudio Version: 2.1 Release and 3.0 Beta 1
SDK: 6
Already updated compileSDKVersion version in project level and module level build.gradle files
ohos {
compileSdkVersion 6
defaultConfig {
compatibleSdkVersion 5
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
Error Screenshot:
As the solution in error suggests:
SdkError: DOWNLOAD_SDK_ERROR
> Cause: Unable to find the toolchains component.
> Solution:
1.Open SDK Manager and download toolchains.
2.Alternatively, modify the compileSdkVersion settings in the project- and module-level build.gradle files.
Navigate to Tools-> SDK Manager -> Select "SDK Tools" tab under HarmonyOS SDK. Check "Toolchains" for the installation. Confirm. Accept the agreement and Download.
Sync and re-build the project successfully.
EDIT: In case, someone is facing the same issue with the new DevEco IDE (details below) and SDK 6, follow these steps:
DevEco Studio Version:
DevEco Studio 3.0 Beta1
Build Version: 3.0.0.601, built on October 19, 2021
Solution:
Open project-level and module-level build.gradle files and change:
compileSdkVersion to 6 (by default it is 7)
compatibleSdkVersion to 5 (by default it is 4)
I wanna add notification in my app with flutter_local_notifications but once I add the plugin to my .yaml, my app doesn't run again.
Below is the error
```D8: Program type already present: android.support.v4.app.INotificationSideChannel
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/2.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/3.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/7.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/10.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/11.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/12.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/13.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/14.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/16.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/17.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/18.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/20.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/21.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/23.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/24.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/25.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/26.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/27.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/28.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/29.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/30.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/32.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/33.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/35.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/36.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/37.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/38.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/39.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/40.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/41.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/42.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/44.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/45.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel
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 29s
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See ... for more information on the problem and how to fix it.
Finished with error: Gradle task assembleDebug failed with exit code 1```
Thanks.
First you need to upgrade all the packages that you have to the version where they are compatible with AndroidX. You can know that from the ChangeLog.md of each package on the dart packages page. Next you need to open the android project of your flutter in AndroidStudio, then select Refactor->Migrate to AndroidX. Wait a bit until android studio refactors your project. And the run rebuild project from android studio. It should work then!
I followed all the steps on the Flutter official site and thought I'd done everything correctly but it is failing to locate the keystore file when I build it.
This is the error message I get showing it taking wrong path instead of
D:\flutterapps\testapp\key.jks:
PS D:\flutterapps\testapp> flutter build apk
Initializing gradle... 1.3s
Resolving dependencies... 4.3s
Gradle task 'assembleRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'D:\flutterapps\testapp\android\app\ D: lutterappspublishkey.jks' not found for signing config 'release'.
* 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 4s
Gradle task 'assembleRelease'... Done 5.3s
Gradle task assembleRelease failed with exit code 1
PS D:\flutterapps\testapp>
On Windows you have to use 2 backslashes to indicate the path separation.
In your key.properties, you should have something like this:
storeFile=D:\\flutterapps\\testapp\\key.jks
You don't need to copy your key.jks file to your flutter project.
modified key.properties file with
storePassword=123456
keyPassword=123456
keyAlias=key
storeFile=key.jks
instead of this
storePassword=123456
keyPassword=123456
keyAlias=key
storeFile=D:\flutterapps\testapp\key.jks
and also moved key.jks to
D:\flutterapps\testapp\android\app\key.jks
as this path shown in error inside terminal
Thanks all.
it's wherever call it from in your build.gradle. insert this:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
and call this in above your android{}:
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
and that key.properties file (which should be in your root android folder) should have this:
storePassword=12345
keyPassword=12345
keyAlias=key
storeFile=/Users/me/somekey.jks
Yeah, for me... I forgot to change my signingConfig to singingConfigs.release in my build.gradle file.
buildTypes {
release {
//CHANGE THIS TO RELEASE
signingConfig signingConfigs.debug
}
}
In build.gradle
Replace
def keystorePropertiesFile = rootProject.file('key.properties')
to
def keystorePropertiesFile = rootProject.file('app/key.properties')
I was having the same issue, I ended up having quotes around my path.
In key.properties, change
storeFile="D:\\mypath\\tokeystore\\key.jks"
to
storeFile=D:\\mypath\\tokeystore\\key.jks
I'm using "TFS 2018 Update 2" and trying to build a package marked as a pre-release according to the microsoft semantic
I tried using the .nuspec file inserting the (ex: 1.0.0-beta and changing the Build number format as: $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)$(Suffix)
setting the $(Suffix) variable at queue time.
Every attempt failed: the package never contains the suffix, than is never marked as pre-release.
I see that the nuget pack command never contains the suffix (missing "-beta" after "2018.6.12.9"). In my test build $Suffix is set to "-beta":
nuget.exe pack
C:\agent_work\4\s\DotNetClassicLibrary\DotNetClassicLibrary.csproj
-NonInteractive -OutputDirectory C:\agent_work\4\a -Properties Configuration=debug -version 2018.6.12.9 -Verbosity Detailed
The Build task on TFS is:
"DotNetClassicLibrary / Build DotNetClassicLibrary_2018.6.12.9-beta /
Job / NuGet pack"
So I'm sure that the variable is assigned because of the presence of the suffix "-beta" in the path.
Here there is the configuration of the nuget pack task
This is the Build number format
I could reproduce your scenario on my side. In my opinion, Nuget pack task with build number doesn't support character or numbers. You may check this task and try to modify it.
case "byBuildNumber":
tl.debug("Getting version number from build number")
if(tl.getVariable("SYSTEM_HOSTTYPE") === "release")
{
tl.setResult(tl.TaskResult.Failed, tl.loc("Error_AutomaticallyVersionReleases"));
return;
}
let buildNumber: string = tl.getVariable("BUILD_BUILDNUMBER");
tl.debug(`Build number: ${buildNumber}`);
let versionRegex = /\d+\.\d+\.\d+(?:\.\d+)?/;
let versionMatches = buildNumber.match(versionRegex);
if (!versionMatches)
{
tl.setResult(tl.TaskResult.Failed, tl.loc("Error_NoVersionFoundInBuildNumber"));
return;
}
if (versionMatches.length > 1)
{
tl.warning(tl.loc("Warning_MoreThanOneVersionInBuildNumber"))
}
version = versionMatches[0];
break;
As an alternative, you could choose Nuget custom, and specify the
pack command there with parameter -version $(Build.BuildNumber),
I've tried on my side, this works.