rror when compiling and in flutter pub upgrade and pub outdated - flutter-dependencies

I am creating an application in flutter and everything was going well, but at the moment it started giving me an error. It won't let me compile and flutter pub upgrade and flutter pub outdated don't work, but flutter pub get if it works fine.
I am new to flutter and I will not understand most of the things they tell me, please, if you can explain me as detailed as possible I would appreciate it
Flutter --no-color build apk
C:\src\flutter\bin\flutter.bat --no-color build apk
Building with sound null safety
Running Gradle task 'assembleRelease'...
/C:/Users/LEO/AppData/Local/Pub/Cache/hosted/pub.dev/google_fonts-2.3.3/lib/src/google_fonts_base.dart:14:1: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.
import 'asset_manifest.dart';
^^^^^^^^^^^^^
/C:/Users/LEO/AppData/Local/Pub/Cache/hosted/pub.dev/google_fonts-2.3.3/lib/src/google_fonts_base.dart:32:31: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.
AssetManifest assetManifest = AssetManifest();
^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1154
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
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 18s
Running Gradle task 'assembleRelease'... 18,8s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1`
Flutter pub upgrade
C:\src\flutter\bin\flutter.bat --no-color pub upgrade Resolving dependencies... Git error. Command: git rev-list --max-count=1 HEAD`
stdout:
stderr: usage: git rev-list [] ... [--] [...]
limiting output:
--max-count=
--max-age=
--min-age=
--sparse
--no-merges
--min-parents=
--no-min-parents
--max-parents=
--no-max-parents
--remove-empty
--all
--branches
--tags
--remotes
--stdin
--exclude-hidden=[receive|uploadpack]
--quiet
ordering output:
--topo-order
--date-order
--reverse
formatting output:
--parents
--children
--objects | --objects-edge
--disk-usage[=human]
--unpacked
--header | --pretty
--[no-]object-names
--abbrev= | --no-abbrev
--abbrev-commit
--left-right
--count
special purpose:
--bisect
--bisect-vars
--bisect-all
exit code: 129
Process finished with exit code 69`
Flutter pub get
C:\src\flutter\bin\flutter.bat --no-color pub get Resolving dependencies... build_runner 2.3.3 (2.4.0 available) cross_file 0.3.3+2 (0.3.3+4 available) flutter_adaptive_scaffold 0.0.9 (0.1.0 available) flutter_facebook_auth 4.4.1+1 (5.0.7 available) flutter_facebook_auth_platform_interface 3.2.0 (4.1.1 available) flutter_facebook_auth_web 3.2.0 (4.1.1 available) flutter_html 3.0.0-alpha.5 (3.0.0-alpha.6 available) flutter_html_audio 3.0.0-alpha.3 (3.0.0-alpha.4 available) flutter_html_svg 3.0.0-alpha.3 (3.0.0-alpha.4 available) flutter_html_table 3.0.0-alpha.3 (3.0.0-alpha.4 available) flutter_html_video 3.0.0-alpha.4 (3.0.0-alpha.5 available) flutter_launcher_icons 0.9.3 (0.11.0 available) flutter_layout_grid 1.0.6 (2.0.1 available) flutter_local_notifications 8.2.0 (13.0.0 available) flutter_local_notifications_platform_interface 4.0.1 (6.0.0 available) flutter_slidable 1.3.2 (2.0.0 available) flutter_svg 1.1.6 (2.0.0+1 available) google_fonts 2.3.3 (4.0.3 available) google_geocoding 0.2.0 (discontinued) google_maps_flutter_web 0.3.3 (0.4.0+5 available) image 3.3.0 (4.0.13 available) intl 0.17.0 (0.18.0 available) json_serializable 6.6.0 (6.6.1 available) mobx 2.1.3 (2.1.3+1 available) numerus 1.1.1 (2.0.0 available) share 2.0.4 (discontinued) shared_preferences_foundation 2.1.2 (2.1.3 available) source_gen 1.2.6 (1.2.7 available) table_calendar 3.0.8 (3.0.9 available) timezone 0.8.0 (0.9.1 available) webview_flutter 3.0.4 (4.0.2 available) webview_flutter_android 2.10.4 (3.2.4 available) webview_flutter_platform_interface 1.9.5 (2.0.1 available) webview_flutter_wkwebview 2.9.5 (3.0.5 available) win32 3.1.3 (4.1.1 available) Got dependencies! Process finished with exit code 0
Flutter doctor
`Windows PowerShell
Copyright (C) Microsoft Corporation. Todos los derechos reservados.
PS C:\Windows\System32\WindowsPowerShell\v1.0> flutter doctor -v
[√] Flutter (Channel master, 3.8.0-3.0.pre.22, on Microsoft Windows [Versi¢n 10.0.17763.107], locale es-CU)
• Flutter version 3.8.0-3.0.pre.22 on channel master at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 69421c1 (34 hours ago), 2023-02-02 23:28:57 -0800
• Engine revision e3fe6dade9
• Dart version 3.0.0 (build 3.0.0-198.0.dev)
• DevTools version 2.21.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\src\Sdk
• Platform android-33-ext4, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2022 17.4.4)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
• Visual Studio Build Tools 2022 version 17.4.33213.308
• Windows 10 SDK version 10.0.20348.0
[√] Android Studio (version 2021.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[√] Connected device (2 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Versi¢n 10.0.17763.107]
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.120
! Device 9888d9463636504450 is offline.
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
PS C:\Windows\System32\WindowsPowerShell\v1.0>`
I tried flutter clean, pub get, I tried in another project and everything is fine, the error is in this one only

This error message indicates that there is a naming conflict with the import of AssetManifest class in your code. It looks like you have imported the AssetManifest class from both package:flutter/src/services/asset_manifest.dart and package:google_fonts/src/asset_manifest.dart which are conflicting with each other.
To fix this issue, you can specify the import path with an alias to differentiate between the two imports like this:
import 'package:flutter/src/services/asset_manifest.dart' as flutter_asset;
import 'package:google_fonts/src/asset_manifest.dart' as google_fonts_asset;
Then, you can use the aliases to access the AssetManifest class like this:
flutter_asset.AssetManifest
google_fonts_asset.AssetManifest
Alternatively, if you only need to use one of the AssetManifest classes, you can remove the import of the other class to avoid the conflict.

Related

React Native Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0

after installing some packages like react-native-safe-area-context or react-native-screen, I always have this problem: can't run the app
when I run yarn android:
> Configure project :react-native-async-storage_async-storage
Subproject ':react-native-async-storage_async-storage' has location 'D:\ewm\git\itc\node_modules\#react-native-async-storage\async-storage\android' which is outside of the project root. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0.
> Configure project :react-native-safe-area-context
Subproject ':react-native-safe-area-context' has location 'D:\ewm\git\itc\node_modules\react-native-safe-area-context\android' which is outside of the project root. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0.
> Task :react-native-safe-area-context:compileDebugKotlin
w: D:\ewm\git\itc\node_modules\react-native-safe-area-context\android\src\main\java\com\th3rdwave\safeareacontext\SafeAreaView.kt: (50, 23): 'getter for uiImplementation: UIImplementation!' is deprecated. Deprecated in Java
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
* What went wrong:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0
* 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 26s
when I run react-native info:
OS: Windows 10 10.0.19044
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU # 2.60GHz
Memory: 3.90 GB / 15.96 GB
Binaries:
Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 29, 30, 31, 32
Build Tools: 30.0.1, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
System Images: android-Tiramisu | Google Play Intel x86 Atom_64
Android NDK: Not Found
Windows SDK:
AllowAllTrustedApps: Disabled
Versions: 10.0.18362.0, 10.0.19041.0
IDEs:
Android Studio: Version 2021.1.0.0 AI-211.7628.21.2111.8193401
Visual Studio: 16.11.32106.194 (Visual Studio Community 2019)
Languages:
Java: 17.0.2
npmPackages:
#react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-windows: Not Found
npmGlobalPackages:
*react-native*: Not Found
use ./gradlew clean to delete all previous build and rebuild
In my case the issue was to do with duplicate files in android resource folders. I used below commands to remove the duplicates.
rm -rf ./android/app/src/main/res/drawable-*
rm -rf ./android/app/src/main/res/raw
See: https://stackoverflow.com/a/57975287/10030693

React Native and Android Studio licenses issue

I'm having a problem with React Native and Android licenses.
My Android knowledge is dated, I do write React but have no experience with React Native. Which is why I hired someone to turn a progressive web app I made into a native one. But due to circumstances I now have to finish the final thing myself.
The app was created on a mac, I'm trying to run it on pc.
The app does build for both IOS and Android from the Microsoft Appcenter. So I know it works, but I want it to run locally as well.
After doing all the installing and running react-native run-android the build starts but halts due to unaccepted licenses.
I already had Android Studio installed. I have checked the SDK Manager for the correct package versions (with 'show package details').
Updated everything I can think of including reinstalling Android Studio for the nth time. After the first uninstall/reinstall it would put it into a directory suffixed with '1' probably because the original directory couldn't be deleted. Yet the environment variables still pointed to the one without the suffix.
Accepting the licenses through cli with sdkmanager --licenses did opt me to accept a couple of times, but it didn't match the number of unaccepted packages I get from the react-native run-android error and the error remained the same afterwards (forgot to pay attention to which packages I was accepting though).
Two curious things:
- the error seems to be looking for licenses in a folder licenses yet my Android Studio folder only contains a folder license
- the error states Using Android SDK: C:\Program Files\Android\Android Studio but during the install of Android Studio I put mine in C:\AndroidSDK because it was whining about spaces.
Here is the error I get after running react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 905 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
> Configure project :app
Checking the license for package Android SDK Platform-Tools in C:\Program Files\Android\Android Studio\licenses
Warning: License for package Android SDK Platform-Tools not accepted.
Checking the license for package SDK Patch Applier v4 in C:\Program Files\Android\Android Studio\licenses
Warning: License for package SDK Patch Applier v4 not accepted.
Checking the license for package Android Emulator in C:\Program Files\Android\Android Studio\licenses
Warning: License for package Android Emulator not accepted.
Checking the license for package Android SDK Tools in C:\Program Files\Android\Android Studio\licenses
Warning: License for package Android SDK Tools not accepted.
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Program Files\Android\Android Studio\licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in C:\Program Files\Android\Android Studio\licenses
Warning: License for package Android SDK Platform 28 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
patcher;v4 SDK Patch Applier v4
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
emulator Android Emulator
tools Android SDK Tools
platforms;android-28 Android SDK Platform 28
platform-tools Android SDK Platform-Tools
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Program Files\Android\Android Studio
* 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
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
error Failed to install the app. Please accept all necessary SDK licenses using SDK Manager: "$ANDROID_HOME/tools/bin/sdkmanager --licenses". Run CLI with --verbo
se flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
patcher;v4 SDK Patch Applier v4
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
emulator Android Emulator
tools Android SDK Tools
platforms;android-28 Android SDK Platform 28
platform-tools Android SDK Platform-Tools
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Program Files\Android\Android Studio
* 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
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
at checkExecSyncError (child_process.js:611:11)
at execFileSync (child_process.js:629:15)
at runOnAllDevices (C:\Users\foo\bar\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAl
lDevices.js:74:39)
at buildAndRun (C:\Users\foo\bar\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:15
8:41)
at C:\Users\foo\bar\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (C:\Users\foo\bar\node_modules\#react-native-community\cli\build\cliEntry.js:160:7)

Alloy compiler failed but classic Titanium works

when I try to run a basic alloy app (two-tabbed template) I get this error:
[ERROR] : : Cannot find module './validators/react/isReactComponent'
[ERROR] : Alloy compiler failed
[ERROR] Application Installer abnormal process termination. Process exit value was 1
But when I run a classic app (two-tabbed template) whithout alloy then program runs ok.
My system is:
Operating System
Name = Mac OS X
Version = 10.14.5
Architecture = 64bit
Node.js
Node.js Version = 8.9.1
npm Version = 5.5.1
Appcelerator CLI
Installer = 4.2.15
Core Package = 7.1.2
Titanium CLI
CLI Version = 5.2.2
node-appc Version = 0.2.49
Try to update your Node version to 10.x (e.g. https://nodejs.org/dist/latest-v10.x/). After that install the CLI again (npm install -g appcelerator titanium alloy) and run appc use 7.1.2 --force to be sure that all packages are rebuild and you should be able to run the app

An error occurred while running ionic cordova build android

when build android app using ionic ionic cordova build android comment getting an error
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=...\AppData\Local\Android\Sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information
ionic cordova build android
ionic cordova build android
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=...\AppData\Local\Android\Sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
As of Cordova-Android 6.4.0, Gradle is now required to be installed to build Android.
When installing on Windows, you need to add Gradle to your path, (see
Setting Environment Variables)

Error 'Could not determine java version from ‘10’

npm run android is not working.
node version: v8.9.4
npm version: 5.7.1
genymotion: 2.12.0
I'm getting the error:
Could not determine java version from ‘10’
I don't have have an Android Studio installed, but I have installed Gradle 4.6, and also set the path for Java, created JAVA_HOME and set path for genymotion.
Revert back the java version to 8*. Android does not support 9 or above, yet.