Monday, September 21, 2020

Flutter Notes (Week 2, Sep 2020)


Ques: How to fix initialization error for DefaultKotlinSourceSetKt?
  Error: Could not initialize class org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSetKt

Answer:
This error comes on upgrading Android Studio (from October 2019 Release to Sep, 2020 (v4.0.1)) and the SDK Components.

On updating the Kotlin version on Android Studio -> Tools -> Kotlin -> Check For Update.

Then make changes on Kotlin Version as below on build.gradle 

After changing: ext.kotlin_version = '1.3.72' Old value: 1.3.10 Issues appearing in "Build" process logs: 1. Deprecation Warning for 'Android Gradle' plugin: WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'. It will be removed in version 5.0 of the Android Gradle plugin. For more information, see https://d.android.com/r/tools/task-configuration-avoidance. To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information. WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'. It will be removed in version 5.0 of the Android Gradle plugin. For more information, see https://d.android.com/r/tools/task-configuration-avoidance. To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information. 2. > Task :app:compileFlutterBuildDebugArm ╔==== ║ A new version of Flutter is available! ║ ║ To update to the latest version, run "flutter upgrade". ╚==== C:\Users\Ashish Jain>flutter --version Waiting for another flutter command to release the startup lock... Flutter 1.9.1+hotfix.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 2d2a1ffec9 (1 year, 1 month ago) • 2019-09-06 18:39:49 -0700 Engine • revision b863200c37 Tools • Dart 2.5.0 3. Manifest merger failed : Overlay manifest:package attribute declared at AndroidManifest.xml:2:5-37 value=(com.survival8.survival) has a different value=(com.survival8.one) declared in main manifest at AndroidManifest.xml:2:5-32 Suggestion: remove the overlay declaration at AndroidManifest.xml and place it in the build.gradle: flavorName { applicationId = "com.survival8.survival" }
4. On replacing the entire code from a back-up of code developed on 'Ubuntu': "\home\administrator\flutter" was our path in Ubuntu machine. Error: C:\Users\Ashish Jain\AndroidStudioProjects\survival\android\app\home\administrator\flutter\packages\flutter_tools\gradle\flutter.gradle (The system cannot find the path specified)
We have a "local.properties" file with contents: Path: C:\Users\Ashish Jain\AndroidStudioProjects\survival\android\local.properties Contents from Ubuntu back-up code: ## This file must *NOT* be checked into Version Control Systems, # as it contains information specific to your local configuration. # # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the header note. # Mon Sep 21 19:31:06 IST 2020 flutter.buildMode=release flutter.versionName=1.0.0 flutter.sdk=/home/administrator/flutter sdk.dir=C\:\\Users\\Ashish Jain\\AppData\\Local\\Android\\Sdk flutter.versionCode=1 Here, we need to change the property "flutter.sdk" according to our current system. --> flutter.sdk=E\:\\programfiles\\flutter C:\Users\Ashish Jain\AndroidStudioProjects>flutter upgrade Flutter 1.20.4 • channel stable • https://github.com/flutter/flutter.git Framework • revision fba99f6cf9 (7 days ago) • 2020-09-14 15:32:52 -0700 Engine • revision d1bc06f032 Tools • Dart 2.9.2 Running flutter doctor... Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [Version 10.0.18363.1082], locale en-US) [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2) X Android license status unknown. Try re-installing or updating your Android SDK Manager. See https://developer.android.com/studio/#downloads or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions. [√] Android Studio (version 4.0) C:\Users\Ashish Jain\AndroidStudioProjects>flutter --version Flutter 1.20.4 • channel stable • https://github.com/flutter/flutter.git Framework • revision fba99f6cf9 (7 days ago) • 2020-09-14 15:32:52 -0700 Engine • revision d1bc06f032 Tools • Dart 2.9.2
5. When opening a project, open the "android" folder and not the parent directory such as "survival" or "survival8".
6. Where to view the Gradle version running:
7. Way to clone 'stable' Flutter GitHub repository: $ git clone -b stable https://github.com/flutter/flutter.git

No comments:

Post a Comment